The Balancing Robot
Now avaliable as a kit
A balancing robot kit is now avaliable via Kickstarter: http://www.kickstarter.com/projects/tkjelectronics/balanduino-balancing-robot-kit. Check out the blog post as well: http://blog.tkjelectronics.dk/2013/03/balanduino-balancing-robot-kit-kickstarter/.
I have for a long time wanted to build a remote controllable balancing robot aka Segway – that’s was actually the main reason why I created the PS3 Bluetooth Library both for Arduino and the FEZ Devices. It has been a long time since the sneak peak and the performance has been improved a lot since then. The original one had a FEZ Rhino as the main processor, but I discovered that it was not fast enough to read the encoders, as it is not running embedded code. Also I was already using more than 10ms per loop, which I used as a fixed time loop, so I decided to step up a notch and go for a much more powerful device: the mbed microcontroller, which is an ARM Cortex-M3 running 96MHz.
It might have been possible with just a normal Arduino (NB: I have now ported the code to Arduino, see update for the code), but I didn’t want the speed of the processor to be an issue, so I decided to go for the mbed. The robot also features an Arduino Duemilanove with a USB Host Shield on top running a sketch based on my PS3 Bluetooth Library. The mbed board actually has USB Host functionality, but I decided not to port the PS3 Bluetooth Library as my original thought were to use an Arduino Due, but as you might know it hasn’t been released yet, despite the Arduino team announced, that it would be released by the end of 2011. But as soon as it is released I think I will port the code to it instead.
Here is a short video demonstration of the robot and me explaining some of the concepts of the design and how it works:
Here are some pictures of the robot:
Here is a list of all the hardware I used:
- Motors with build in encoders
- Motor Brackets
- Motor driver
- BaneBots Wheels (These wheels are no longer available from the seller, but you can use these wheels and these hubs instead)
- mbed microcontroller
- mbed breakout board
- Arduino Duemilanove for PS3 bluetooth communication
- USB Host Shield
- Bluetooth dongle – it has to support bluetooth version 2.0+EDR
- PS3 Controller
- 12V 3800mAh NiMH Batteries – I got two of them
- Female Tamiya connector
- Two XBee modules for wireless debugging and setting the PID constants wirelessly. Alternativly you could use an inexpensive Bluetooth Serial module
- Two XBee adapter kits
I also used:
The robot itself is made of three pieces of 215x75x7.5mm MDF wood and four threaded rods. The distance between the plates is 7cm at the bottom and 7.5 at the top. In total the robot is 27cm high including the battery.
See the 3D model for more information.
I have created a 3D model in Autodesk Inventor with true dimensions, this will hopefully inspire other people for there robot design. All files can be found at github.
The 3D model can also be viewed at the following site: http://grabcad.com/library/balancing-robot.
Check out these rendered images of the robot:
All the code and 3D model can be found at our github. Here is a list of hyperlinks for all the repositories:
Also check out the wiki.
I have now ported the code to Arduino. The code can be found at github: https://github.com/TKJElectronics/BalancingRobotArduino.
I have thought about how I could improve the performance of the robot. First of all I could try to use an accelerometer with a smaller resolution, as the one I got is a ±3g and ±1.5g would be sufficient for my needs. Also my gyro got a resolution of ±300 deg/s and I have seen people use gyro with a resolution as low as ±50 deg/s.
Another aspect would to use belts to minimize backlash, instead of connecting the wheels directly to the motors – a bit like this one.
Also I don’t compensate for the battery level in the code – so it behaves differently depending on the battery level.
Overall I am really happy about the end result – it balances pretty well and the remote control works perfect!
It has been a really good learning experience for me and a really fun project to do, but also very time-consuming – I have spend many nights tweaking the PID values and adjusting tiny bits of the code before I accomplished the end result.
The next step would to build a full size one, but I don’t know if I will do it the near future – but hopefully some day
That’s all for now. Hope you like my robot. Feel free to post a comment below and I will answer as quickly as possible.