2 Wheeled Self Balancing Robot
by RC Lover san in Circuits > Robots
4269 Views, 15 Favorites, 0 Comments
2 Wheeled Self Balancing Robot


In my humble opinion you are not a real Maker, unless you don't build your own 2 wheeled self balacing robot. :-)
So, here it is... and, most important thing, it works!!!
This project looks very simple. Instead, it requires a good level of knowledge of physics (inverse pendulum), maths (Kalman Filter) and mechanics (PID).
The are people who chose this project as a dissertation to obtain the Degree in engineering, therefore do not underestimate it. Once everything is assembled, you must do a bit of tuning learning about how the PID (Proportional, Integral and Derivative) control works.
I've assembled this bot in 3 different configurations, before achieving a good stability with the robot untethered.
When I saw on Internet the robot carrying the glass of water, I was immediately fascinated and I've decided to give it a go.
WARNING!!!
Please be aware that Lipo Battery are dangerous.
If you attempt this "stunt" waterproof all the electronics using some CorrosionX.
If you spill the water on the robot, you will destroy it, not mentioning the fact the short circuit can ignite the Lipo Battery.
For the frame I used some Oxford look-alike-Lego-parts.
The bot is powered by an Arduino Uno clone.
Shopping List

Lego (compatible) parts
DC Motors
http://www.banggood.com/DC12V-100RPM-Mini-Metal-Ge...
Arduino Clone
http://www.banggood.com/Wholesale-Arduino-Compati...
MPU-6050
http://www.banggood.com/6DOF-MPU-6050-3-Axis-Gyro-...
Motor Shield L298N
https://www.banggood.com/Wholesale-Dual-H-Bridge-D...
Battery
https://www.banggood.com/ZOP-Power-11_1V-850mah-7...
Jumper Wire 20cm Female to Male
https://www.banggood.com/120pcs-20cm-Male-To-Femal...
JST Connector
https://www.banggood.com/10-Pairs-2-Pins-JST-Femal...
*Wheels
* (in one of the previous configurations I've built, I've manage to burn one of the motors,
therefore I ditched the motors, keeping the wheels)
https://www.ebay.co.uk/itm/191788063498?_trksid=p2...
2 zip ties
Build the Frame Using Some Lego (compatible) Parts



This is a very easy task. I believe that if Lego would start to make kits (like this), mixing bricks with electronics up-to-date, they will do much better in terms of sales (they are currently doing).
Anyway, please note that I moved the Lego platform for the Arduino Uno to a higher position to improve the inverse pendulum effect.
To attach the motors, make 4 holes in the base, passing a zip tie (for each motor) in it.
I've added a bit of glue to be sure the motors don't move.
Wiring Diagram & Coding

Following the schematic above, wire to the Arduino Uno clone, the motor shield L298N, the MPU-6050 and the battery.
Regarding the coding, you can easily find on Internet the code for this project, that thanks to Kalman Filter and to the PID (Proportional, Integral and Derivative) control, improves the stability of your bot.
If you don't find it, please subscribe to my Youtube channel and I'll send to you straight away.
Enjoy It!

Congratulations, you have built your 2 wheeled self balancing robot!