Friday, April 11, 2014

PWM 555 Timer Servo and DC Motor Tester

For robotics, my students use servos and Tetrix motors to actuate mechanisms.  Sometimes programming is not their forte or they don't want to take the time to wire up a motor/servo controller to an NXT and 12V battery and write basic code... they just want the servo or motor to run so they can get a quick feel for if a prototype will work.

I put together two testers which allow them to quickly hook up a servo or a motor and test it.  The testers allow full range of servo motion and full range of motor speeds from full forward to full reverse.  Both of the testers use exactly the same circuity; a 555 timer with a variable resistor using a potentiometer to set the pulse width.  For the servo tester, this PWM signal directly controls the position of the servo.  For the motor tester, the PWM signal is sent to a Parallax HB-25 Motor Controller (not cheap, but I had a few lying around already).  The video below shows an oscilloscope capturing a PWM pulse output from an Arduino.  You can see the width of the pulse varying over time.


The schematic for the servo tester is shown at left.  R1 is  ~250k plus the 20k potentiometer from one pin to the sweep (eg 250k - 270k).  R2 is 12k plus the rest of the potentiometer (eg 32k - 12k).  The capacitor is 0.1 uF.  Using the equations for the 555 timer, we have a range of outputs of T1 = 19500us, T2 = 830us up to 2200us.  The T2 time is what we want to pulse to the servo, but in the configuration given, T2 is the time spent LOW.  To reverse the polarity of T1 (making that LOW) and T2 (making it high), the output from the 555 is run through an NPN transistor which acts as a NOT gate.  The results are shown below:



A breadboard prototype worked fine, so I used Eagle CAD to make boards for each of the testers.  The EagleCAD files can be downloaded from https://sites.google.com/site/rampantrobots/servotester .

The boards for the servo and motor tester are almost identical, except that the servo requires a voltage of ~5V, and the motor requires a voltage of 12V.  I wanted both to run off the 12V batteries we use for robotics.  So I used a LM7805 for both boards.  For the servo board, the 5V output also powers the servo, while for the motor board the 12V supply is connected directly to the HB-25 input.  For the servo tester, a series of capacitors of different values is used to smooth the 5V line because the servo pull might otherwise cause it to drop too low for the 555 timer to work correctly.  The bottoms of each board show the similarities and differences.



The boards work great.  Check out the movies below which show them in action.