Skip to content
The algorithm for my balancing robot/segway
Processing C++ Java Shell

This project is deprecated

This project is no longer maintained as I will instead focus on a Balancing robot kit, the Balanduino. For more information see the new repository: and the Kickstarter campaign:

The code is released under the GNU General Public License. Developed by Kristian Lauszus

This is the code for my balancing robot/segway. It's made for the mbed board, but can easily be ported to other microcontrollers like the Arduino - see the Arduino version of the code:

The code is also published on the mbed site:

I use a 6DOF IMU from Sparkfun, I only use 1 of the gyro axis though. For more info about calculating the pitch and the Kalman filter see my post at the Arduino forum:,58048.0.html.

To steer the robot, I use an Arduino with a USB Host Shield on top together with my PS3 Controller Bluetooth Library for Arduino. The code for the remote can be found at my other repository:

For information about the hardware, see the wiki:

For more information see my blog post at or send me an email at:

Also check out the Youtube video of it in action:

Something went wrong with that request. Please try again.