Pico Robot With MPU6050
by BobbyBalsa in Circuits > Microcontrollers
51 Views, 0 Favorites, 0 Comments
Pico Robot With MPU6050
Credits for this project go to Peppe80 and his fantastic tutorials ! I read , studied and tested this one :
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
- Yahboom Pico Robot Kit
- MPU6050 gyro/accelerometer board
- some jumper wires
- 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
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 :
- Vcc IMU to 5V robot
- GND IMU to GND robot
- SDA IMU to SDA robot
- 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 :
- pico_car.py
- vector3d.py
- imu.py
Next you can load gyro_test1.py as follows :
- Open file in Thonny
- 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
Here are the video's of the experiment , I'll keep on working to improve the off-heading issue and update this instructable .