Where I demonstrate different methods of measuring a servo pulse to ensure it meets requirements.
In the entry on servos I discussed the specific pulse requirements to make a servo move. In a nutshell, a servo needs a positive pulse .5ms to 2.3ms in a 60Hz signal. Or to put it another way, it requires a 60Hz signal with a duty cycle ranging from 3% to ~14%.
This entry will demonstrate different methods of measuring such a signal with a video edition on the Espotek Labrador.
Software to Use
In the examples of the AVR_C or Lab_10C_Class repositories, there is a folder called multi_servo, when compiled/linked/loaded on to the Uno, it will offer a serial interface to set one of up to six servo pins. The software interface looks like this:
Enter servo and angle: EX:2 120 Servo 0 to angle 90 Pulse width: 14 Enter servo and angle: EX:2 120 Servo 2 to angle 120 Pulse width: 17 Enter servo and angle: EX:2 120 Servo 2 to angle 90 Pulse width: 14 Enter servo and angle: EX:2 120 Servo 0 to angle 180 Pulse width: 24
Once a servo and servo angle is entered, the program will provide a pulse which will move the servo to the desired angle. The pulse width shown is the count required given the number of servos and the angle desired.
Using a Digital Multimeter
Some digital multimeters (DMM) have a frequency and duty cycle capability. While this does make it quite easy to measure the signal, it tends to be a all or nothing proposition. Meaning if the signal is being created properly, the DMM will measure it. If there are issues, it is far more difficult to debug them using a DMM.
To measure with a DMM, do the following:
- Calculate the pulse which you are wanting to confirm. For example, a pulse with a 1ms positive width at 60Hz is a 60Hz signal with a 6% duty cycle. The calculation looks like this: 1/frequency * 1000 = period in milliseconds and pulse width/period = duty cycle
- Connect the positive lead of the DMM to your Uno output pin and the ground lead to one of the Uno’s GND pins.
- Turn the DMM to its frequency measurement, run the software above and observe the display, does it show the desired measurement? If so, continue to change the angle to determine if the DMM shows the desired measurements. For example, an angle of 0 needs to be the lowest pulse width with a duty cycle of 3% while an angle of 180, the pulse width needs to be the highest, with a duty cycle of close to 14%.
Simple, enough? Yes! Providing everything is working as it needs to. If not, we need a more powerful form of debugging and for that I’ll use the Espotek Labrador.
Using the Espotek Labrador
Watch the video for the best understanding of how to use the Labrador to better understand how the width of the pulse controls the servo angle.