GBOT90 Balancing Bot Demos Dirty Martini Test with PID Cntrl

A previous post on the subject of GBOT with PID control was intended to make and learn the hardware and software aspects of ZX-40A microcontrollers from with control systems. I used that experience to extend the GBOT into a 5 foot balancing robot. I added an aluminum frame, disabled the forward looking IR range sensors and added a new GP2D120 IR sensor for pitch control. The result is the GBOT90 shown in the link below.

Noise and resolution was an issue but manageable. The Vref was set to 3.0V to improve resolution. No gyros and no acceleromenters were used, just the single GP2D120 IR range sensor for pitch rate & angle measurements. I used the same PID control system from the GBOT but updated the gains. Proportional and integral gains were much higher. Integral gain was highest.

The Tamiya motors are controlled with PWM modulation sent to the Pololu VNH2SP30 motor driver. At low duty cycles, the motors are not synchronized. Is this expected?


Very cool, thanks for sharing that with us! I notice the video ended very shortly after the dirty martini test started. Did the test end with the martini in your hand or on the floor?

What do you mean when you say that the motors aren’t synchronized at low duty cycles?

- Ben

My floors are uneven, and without a gyro, the single IR sensor for pitch rate & angle feedback has its limitations. I was able to chase and catch the Martini averting a catastrophe.

Regarding the motors, I meant that the left and right wheels do not turn at the same rate. At very low duty cycles (i.e., small disturbances), one motor spins faster than the other causing the GBOT90 to turn a bit. I’m not sure if this is caused by the motor controller or the motors themselves.

In general, you shouldn’t expect two motors to be perfectly matched, even if they are the same model. There will usually be slight differences in internal friction and the motor windings themselves that cause the motors to spin at different speeds when given the same voltage. This can be especially noticeable at low duty cycles when the voltage is barely enough to overcome the friction (e.g. there will probably be a voltage where one motor spins and the other does not).

If you have an application where going straight is important, you have several options:

  1. Test many of the same model motor until you find two that are well matched.
  2. Empirically figure out how how much more power to supply your slow motor so that it goes at the same speed as your fast one.
  3. Use feedback (such as encoders) to close the speed-control loop.

The third option is the most robust and would probably be very beneficial on a balancing robot.

- Ben

All very good points. Thanks.

Regarding GP2D12 and GP2D120 IR range sensors, have an idea why its taking so long to restock?


Lead times in general are getting very long. 3-4 months is common across the electronics industry; we’re still waiting for some parts that we ordered last September, and we have an expected ship date in December for parts we ordered in February.

- Jan