Code and assets for my ArduRoller balancebot
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.cproject Initial commit, ArduRoller ported to fixed point. Feb 11, 2015
fixp.h Add Eclipse compatibility macros. Feb 11, 2015


This repo contains the source code and assets for my ArduRoller balance bot.

ArduRoller out for a spin

Here's a video of it in action:


  • Chassis: laser cut 2.7mm bamboo ply (Ponoko); various M2.5 machine screws from Amazon; Instamorph low-melt-point thermoplastic to fill in the gaps.
  • Brains: 1 x Arduino Uno
  • Motor driver: 1 x Sparkfun Ardumoto
  • Motors: Sparkfun 2 x 24:1 gearmotor
  • Wheels: 1 set Sparkfun 70mm -- repaired with Instamorph after they cracked around the axle
  • Gyro: 1 x ADXRS613 (Sparkfun breakout) mounted at the axis of rotation
  • Accelerometer: 1 x ADXL203CE (Sparkfun breakout) mounted at the axis of rotation
  • Batteries: 2 x 3.7V Li-poly 850MAh (Sparkfun)


The code is in main.c. The code only depends on avr-libc and it includes the proect files for the AVR plugin for Eclipse.

The code has 3 parts:

  • main() is the entry point, which runs
  • setup() which does start-of-day initialization.
  • ISR(TIMER1_OVF_vect) the interrupt service routine for the timer 1 interrupt. The ISR is the main workhorse function. It runs several hundred times per second.

There are a lot of magic values in the code that took me considerable time to tune. I also find that some of them aren't constant (e.g. the gyro drift changes with temperature and battery voltage). If you try to make one of these it'd probably be a good idea to pick my brains before you start or to use a more standard approach like a complementary filter.


The diagram for the chassis is in the assets directory. I used Ponoko to manufacture it in (2.7mm blonde bamboo).

Creative Commons License
ArduRoller Chassis by Shaun Crampton is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

WARNING It's prototype standard -- I had to rebuild the motor mounts with Instamorph because they were too loose in one direction and sand them heavily because they were too tight in the other.