Pico Robot With MPU6050

by BobbyBalsa in Circuits > Microcontrollers

51 Views, 0 Favorites, 0 Comments

Pico Robot With MPU6050

Box.JPG
I2C_expansion.jpg

Credits for this project go to Peppe80 and his fantastic tutorials ! I read , studied and tested this one :

using Pi Pico with MPU6050

This is actually not a real project , just a test to use a MPU6050 board in order to make the Pico Robot run on a straight line . But it may be usefull for other people's future projects .

Supplies

IMU_mounted.JPG
  1. Yahboom Pico Robot Kit
  2. MPU6050 gyro/accelerometer board
  3. some jumper wires
  4. a small piece double-faced tape

Make Yourself Familiar With the Pi Pico Robot.

Before starting this silly little project ( it is , in fact , just a test ) you should make sure you have the basic skills ( MicroPython and how to use on the Pi Pico Robot )

This link leads to everythinh you need :

You need to flash your Pico with the most recent MicroPython make sure you pick the right board (Pico , Pico 2 ,W) . Before going further your Pico must have Micropython installed and pico_car.py loaded .

Study very carefully and go through the supplied examples , make sure you fully understand what is happening .

When you master Micropython your future projects will be much easier !

Downloads

Verify Your IMU-module and Install It

IMU_board.jpg
MPU6050_board.jpeg

The I2C expansion port on the robot has a 5V supply . Before connecting our IMU-module we must make sure the module has a 3.3V low drop-out voltage regulator on board . This is the small black circuit next to the Vcc pin . Most of the modules have these chips on board but better be safe than sorry !

If OK , put the IMU on the robot with a small piece of double-sided tape and connect the jumper wires :

  1. Vcc IMU to 5V robot
  2. GND IMU to GND robot
  3. SDA IMU to SDA robot
  4. SCL IMU to SCL robot


Load Your Pi Pico With Silly Software !

Now we are ready to go ! Make sure your Pico has the following files loaded :

  1. pico_car.py
  2. vector3d.py
  3. imu.py

Next you can load gyro_test1.py as follows :

  1. Open file in Thonny
  2. File - Save as - choose Pi Pico - main.py

This will demonstrate the robot running without any gyroscopic correction , both wheels are spinning at the same speed but it will turn around anyway . Skip this if you like , it is just a demonstration .


The real stuff will happen if you load loaded_24_11_25.py as main.py in your Pico , same procedure as above !

It is far from finished as the robot drifts off course , but I am working on a solution :-)

I modified loaded_24_11_25.py into loaded_27_11_25.py , the drift problem is partly solved ... but do not be afraid to experiment with the code , it is all yours !

Most of all , just have Fun !

Video Footage of the Experiment

Pi Pico robot gyro disabled
Pi Pico Robot with gyro

Here are the video's of the experiment , I'll keep on working to improve the off-heading issue and update this instructable .