Balancing bot with ultrasonic sensor

I had an old Boe-bot platform which is two continuous servers on an aluminium base.

 

It's normally used for the standard rover bots, but I stood it up to make a quick balancing robot.

 

Now to make a balancing robot you need accelerometers and gyros, right ?

 

Not here - I'm only using a single hc-sr04 ultrasonic distance sensor.

 

Arduino Code is below:

 

 

He does balance, but not for long: https://www.youtube.com/watch?v=GNenQ4OWgSM

Balances without gyros


This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/balancing-bot-with-ultrasonic-sensor