General purpose Arduino shield for self-balancing machines.
Why did I make it?
I previously made an Instructable in 2010 on how to build a self-balancing skateboard.
There are >500 comments on this and many express confusion setting up the balance sensors, software and electronics. On top of that, the analog output inertial measurement units that were commonly available stopped being made.
Here, I have taken a low price obscure analog IMU that IS currently still made in China, that IS available on ebay, and used an Arduino prototyping "shield" to mount ALL the parts, including a cable to a basic hand-controller (for steering and fine-tuning the balance point) and a cable with just 2 wires that you connect to a 2 x 25Amp "Sabertooth" motor power controller.
I have tried to make it as easy and in particular, non-confusing as possible to build.
NOTE December 2013: Even these are getting rare now but I have just found the "Grove" series of analog sensors from Seedstudio and added contact details to page 6.
In essence a complete re-vamp of the control system, making it simpler to build at the same time.
NOTE (March 2014): I have finally made something similar to this that actually works with a modern DIGITAL IMU from Sparkfun, the 6dof sensor, code No: SEN-10121. It has its own new Instructable here:
NOTE(December 2014): I have also done an Instructable using the same digital Sparkfun IMU in a self-balancing scooter. This instructable is most up to date and has the circuit diagram and latest code here:
I have included the basics of how to connect this to the Sabertooth motor power controller, which is an off the shelf commercial robot power controller, how to power the Sabertooth and how to connect the motors to it. For a really detailed explanation of the mechanical side of the build, take a look at my original Instructable of 2010, linked at the top of this introduction page.
One gyro is used for balancing (complementary filter with an accelerometer). Another gyro measures rate of rotation laterally (e.g. when steering).
This provides another useful feature for free; when running in a straight line, if it detects rotation faster than 10 degrees per second laterally, it will change power to the motors to resist this effect. For example the motors often have different friction so when you slow to a stop, one stops before the other and you spin off. This feature stops that happening, and means the wheels can be mounted quite close together.
See this video http://www.youtube.com/watch?v=FEaTxahyQxc and you will see this happening at 0.51 mins, the spare gyro is used to reduce this effect.
NOTE: Added 15/03/14. For those who may manage to have one of the old, no longer available, Sparkfun 5dof analog IMU's, I have just attached the same code as written in this Instructable for the Chinese IMU, to step 30 but with the gains changed for the gyro to suit the old 5dof analog Sparkfun IMU.
Main parts list
www.maplin.com part number GBP US$
N39KR RockerSwitch 2.39 3.62
N39KR RockerSwitch 2.39 3.62
GW72P Microswitch with lever 2.49 3.77
FH04E Sub-Min Toggle switch 2.79 4.23
Project Box 3.79 5.74
XR27E 9 way multicore cable 5.14 7.79
2 core screened cable 0.99 1.50
N30KU Arduino Uno 24.99 37.86
N35KU Arduino protoshield 14.99 22.71
5DOF analog IMU 17.81 26.99
NOTE: List of sellers of this updated August 25th 2013 (See Step 6 for the list)
4 x LED’s 2.56 3.88
Video of latest self-balancing skateboard in action using this IMU and code