Let's Make Robots!

YASBR – Yet Another Self-Balancing Robot

Self-balancing robot

The self-balancing robot building is today an activity that every robot builder can perform with Arduino. Searching in Google for self-balancing robot you can find tons of realizations, with tons of different sensors and control systems. So to build a self balancing robot is a standard task for the robot builder, like a simple home rover.

Trying to be at least original, I though to build a self balancing robot with these goals:

  • low-low-cost
  • simple in the hardware
  • simple in the software 

So I tried to build a self-balancing robot using only one sensor: a Sharp IR distance sensor e nothing else. No gyro, no accelerometer, no other sensors. All is self-built, in the DIY pure spirit.

These are the components used:

  • Plexiglass chassis
  • Wheels for servo (Boe-Bot wheels). At first time I tryied to use two trolley wheels, but without success
  • Servos modified
  • Sharp IR sensor 10-80 cm
  • Arduino 2009
  • 2 batteries pack 4x1,2V 
  • some screws, jumpers etc.

 We are under 100 euros, a good results concerning the cost.

Some details here: http://robottini.altervista.org/yasbr-yet-another-self-balancing-robot/

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

It measures the distance from the floor then it tries to maintain a constant distance reading using a PI algorithm.

To operate it, you first balance the robot and then the algorithm tries to maintain the reading from the sensor, thus keeping a constant angle between the robot body and the floor. Since you started the robot when it was balanced it will keep itself balanced. I guess this only works on flat surfaces because a change in the distance between the sensor and the floor would tilt the robot. It could probably stay on an inclined surface if recalibrated for that angle. If you start the robot out off balance it will probably move forward continuosly. I probably drifts too. I wonder if changes in floor color would throw it off balance.

You are right. The sensor measures the distance from the floor and it tries to mantain a constant distance using the PI algorithm. The surface has to be flat, otherwise the distance measured has no sense, so the robot tilt. This is the main difference with gyro and accelerometer sensor. The gyro and the accelerometer work always. The IR sensor works only in a flat surface.

Another possibility is to use 2 IR sensors, that is better for precision of balancing. But also with 2 sensors you can use only in a flat surface. 


I am betting you are right that changes in floor colour will unbalance the robot.  I have been using the same type IR sensor, and found that colour and texture of the object it is measuring has given me varying readings.  While I trust the IR sensor more than I trust the ultrasonic ones, I'm not so sure they are sufficiently accurate for keeping a robot balanced.

That said, I saw that your robot did seem to be keeping highly accurate balance with only minor corrections.  Perhaps that is more a testament to your programming rather than relying totally on the abilities of the sensor.

Good job.

Perhaps you could try laying out (taping down) some black strips on the floor and see what happens to his balance when he tries to cross them.

Hmmm, I was thinking of a possible "fix"...  If the readings from the sensor suddenly changed, but did not continue to change, the robot might assume it was a floor fluctuation and ignore it, but if the change continues for so many milliseconds [Testing for optimal performance would be needed.] then the robot would consider it was indeed off balance and apply corrections.  That would make him respond more slowly, as he waits for corroboration but could protect against disrupting his balance in the case of floor-colour or slope-change differences.

I am wondering: You said, "No gyro, no accelerometer, no other sensors." --so if that is the case, then how does the robot keep its balance?  How does it know if it is tipping over?


i would hazard a guess that using the ir sensor to measure the distance to the floor, when the robot pitches forward or backwards the servos kick in to realign it