I got my hand on a few micro:bits and a Kitronic :MOVE mini buggy. They were meant for my kids. But I had always wanted to build a remote controlled self-balancing robot. What's the easiest way to get something working? Repurpose parts from the buggy, add Lego and some code!
Here's version 1. It is fragile and wobbly. With a simple PID controller written in Javascript using makecode/PXT, it self-balances on carpet for over 20 minutes but doesn't do so well on hard floors.
I use a second micro:bit to instruct the robot to turn using the micro:bit's radio service. Turn too much and it falls over!
The bot:
Stripped of the Lego frame:
As you can see, it isn't exactly as "kid-friendly" as just adding Legos.
I had to add a digital gyroscope (MPU-9255), an edge connector and solder some connectors to get access to the I2C pins. See parts list below.
The hardware turns out to be too flimsy. The motors do not stay in position. The wheels have limited friction on hard floors. Tuning the PID parameters was hard and time consuming with so many sources of errors.
In the end, I was just amazed that it somewhat self-balanced on carpet for more than 20 minutes. It is not anywhere near Segway stable, which is not surprising given the rather primitive control algorithm.
Parts:
- BBC micro:bit
- 2x Feetech FS90R 360 degrees servo motors from the :MOVE mini buggy.
- Kitronic servo:lite board from the :MOVE mini buggy.
- InvenSense MPU-9255 9-axis gyroscope, accelerometer, compass.
- Pololu Wheel for FEETECH FS90R/FT90R Micro Servo 60x8mm
- Wires, bolts
- Lego pieces
Version 3 is the updated version 1 without the servo:lite board and Legos.
Links to all the micro:bit robot posts:
- Self-balancing robot version 1 with micro:bit and servo motors
- Self-balancing robot version 2 with micro:bit and DC motors
- Micro:bit code for InvensSense MPU-9255/9250/6500 gyroscope accelerometer
- Code for this self-balancing robot with micro:bit and servo motors
- Code for this self-balancing robot with micro:bit and DC motors
- Micro:bit logging module
- Micro:bit serial to file script
- Micro:bit trigonometry module
- Self-balancing robot version 3 with micro:bit, servo motors and 3D printed frame
- Updated self-balancing robot version 3