Self Balancing Robot

This is a short guide on how to build a self balancing robot at a single weekend. We use only parts from stock. Required software can be download from this page.

The frame consists of rectangular plastic boards. It possible to use glue for the frame construction however we prefered aluminium brackets. Given the parts below all we needed is a drilling machine with 4mm drilling bit and a soldering iron.


We basically prepared these parts added some screws, brackets and cables, ...


For the position calculation and motion control we use the CoPiino board on top of the Raspberry Pi. The CoPiino is able to gather position data from intertial motion sensors and runs the control loop to stabilize the robot. Live data will be transmitted from the CoPiino through the serial connection to the Raspberry Pi. The onboard web server accessed via WLAN transfers control data to any web browser (tablet, laptop, PC, ... ). Equiped with a camera the Pi also transfers a FPV.


standard wheels

frame parts

DC motor driver - L298

5V voltage regulator

Gyro+Acc MPU6050


CoPiino stacked on Raspberry Pi


Our communication platform is the Raspberry Pi. We equiped the Pi with SD card and WLAN USB stick. The standard raspbian OS can be configured to run as WLAN access point or WLAN ad-hoc device. A step-by-step guide can be provided.

Click to enlarge

After successfully booting the Raspberry Pi the control software (BlueberryC) for CoPiino needs to be installed. Just follow the instructions on the download page.

The control software will be the source code editor, compiler and programmer for the stacked CoPiino board. All functions are accessible through the web user interface.

The microcontroller on the CoPiino will be programmed like Arduino UNO. Any sketch which runs on Arduino will run CoPiino. The same applies to Arduino Shields, the connectors of CoPiino match the ones on Arduino.

All we needed to do for stabilizing the robot was:

  1. write an Arduino Sketch
  2. add the libraries
  3. hit "compile and run"
  4. done!

The compiled program will be automatically downloaded by the Raspberry Pi to the CoPiino.

Source Code and Libraries

Source Code and libraries can be downloaded here