Neat demonstration of proportional and PID control systems

Robotics Technology

Spotted in the MAKE Forums:

Liam built this impressive robot, then used it to demonstrate the difference between proportional and PID control. The robot is designed to stay a certain distance from an object, and uses two Sharp IR distance sensors to track it’s position. The system looks like it is working great, however he is noticing some variability in the output of the distance sensors he is using- anyone have any ideas?

This is the GBOT with a PID controller using the ZX-40A microcontroller from ZX-40A is based on the ATMEGA644 AVR chip. Inputs include 2 IR range sensors (GP2D12). Outputs include 2 PWM signals to the Pololu motor driver (VNH2SP30).

The GBOT maintains a setpoint distance of 10-inches from a target and maintains that distance, no matter what. The control system was originally coded with P-control only and resulted in excessive overshoot and oscillations. So then I added PID control. See video to observe P-control vs. PID control.

Had trouble with IR sensor noise. Issue mitigated with hardware and software. Hardware… added low ESR 1,000uF capacitors on VIN and VOUT of the LM2940T voltage regulator. Software includes an 8th order butterworth filter to clean IR sensor position and velocity. I did have issues with a fire, probably caused by a short or the motor driver. Not sure yet. Since isolating the regulator with the filters and after adding a large heatsink to the voltage regulator, no more fires. See picture below of “incident”.

Anyone have experience or information on GP2D12 IR sensor distance variability? I have the noise reduced to 0.025″ amplitude. Can this be reduced further? Thanks.

4 thoughts on “Neat demonstration of proportional and PID control systems

  1. machright says:

    would a better optical setup work?

    Maybe a set of lenses would help. How narrow is the wavelength detection. Maybe further isolating the optical input to a specific IR wavelength would help.

    Sorry I could not be of much help.

    1. Matt Mets says:

      Those are actually some good suggestions. I don’t know what the manufacturing tolerances on the Sharp sensors are (I’ve only used them in simple open-loop controllers), but if they could use help, checking the filter would be a good idea.

Comments are closed.

Discuss this article with the rest of the community on our Discord server!


Maker Faire Bay Area 2023 - Mare Island, CA

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 15th iteration!

Buy Tickets today! SAVE 15% and lock-in your preferred date(s).