FivePotatoe was created as a gift for my grandchildren but also serves other useful purposes.  It is simply a Balboa self-balancing robot from Pololu.  This is a very nicely designed—both mechanically and electrically—robot which is infinitely modifiable, particularly since a Raspberry Pi can be directly mounted on the motherboard.  The only significant addition is the BlueSMIRF module which allows it to be controlled from an Android app.  You can see a short video here.

A Raspberry Pi is not used here but any additional functionality would probably go on the “Pi” since there is little extra program space left on the Baloa’s 32U4.  Adding a Pi to this increases the options tremendously.  First of all, there is already Bluetooth on the Pi, so the BlueSMIRF is not needed.  Secondly, a number of other options then become possible including the addition of other sensors along with more complex navigation.


The balancing code used on FivePotatoe is derived from TwoPotatoe.  I have not made TwoPotatoe’s code available since it is still under constant revision and, in addition, it is complex and difficult to understand.  The basic algorithm is contained in FivePotatoe’s code so this is a good opportunity to expose it to a wider audience.  FivePotatoe’s code is published here.

Here is some general information for anyone who would like to clone FivePotatoe.  If you have questions, you can click the “Leave a Message” link at the top of this screen.  A preferable option is to join the Pololu form and leave a reply to my post there.  That way others can see your question and my response.

  1. Other than connecting the BlueSMIRF to pins 1 and 2, and the button to pin 5, the Balboa board is completely unmodified.
  2. Any changes in wheel size, gear ratio, or weight distribution—such as the addition of a Pi—will probably require changes to the “cosFactor”.  This factor can be adjusted directly from the controller with buttons 5 and 6.  This value is displayed as the first data item on the screen.  When you find the right value, you should put it in the code and compile it.
  3. The button at the top simply makes it much easier to start up.  Pressing this button while holding FivePotatoe upright starts it running.  If you press this button while lying down, FivePotatoe goes into its “down” mode and can be self-righted and put into its “up” mode with some deft manipulation of the joystick.
  4. When self-righting, the motors draw a significant momentary current from the batteries.  This can cause enough disruption in the power to cause the 32U4 to reset.  A reset is indicated when you hear the startup beep from the buzzer.  With standard alkaline batteries, this can become a problem as the batteries drain.  I suspect that rechargeable batteries, particularly LiPo batteries, are better in this respect.
  5. FivePotatoe uses the Joystick Bluetooth Commander app for android devices.  On the Android app, set the six button labels to “Run”,”Fast”,”Beep”,””,”+cos”,”-cos”.  Set the  data labels to “cos”,Heading”,”Battery”.
  6. Because the center of gravity is very near the wheel axis, this robot is able to self-right, which is one its neatest characteristics.  Unfortunately, the tradeoff is that it cannot handle rough ground or even deep carpet, nor can it go up any but the slightest slope.  If you are considering powering it with a LiPo battery, it would be interesting to mount the battery high up and see the change in its operating characteristics.  The cosFactor, described above, would obviously need to be adjusted.