Blog post: http://blog.tkjelectronics.dk/2012/03/the-balancing-robot

mbed version: https://github.com/TKJElectronics/BalancingRobot

Arduino version https://github.com/TKJElectronics/BalancingRobotArduino