Servomotor Control Program


Posted on Feb 4, 2014

In our first program, we will simply sweep the servomotor from CCW to CW and then sweep back. The program will be kept simple as to demonstrate the priniciples of controlling a servo with a the PIC Basic language. The schematic can be seen in figure 2 (below). The variable pw controls the pulsewidth, and is started at 100 (extreme left, -45 degrees). The program sends the pulse out to


Servomotor Control Program
Click here to download the full size of the above Circuit.

the servo, and then is increased by a value of 1 until it reaches 200 (extreme right, 45 degrees), at which point it will reverese the rotation. If desired, we could extend the rotation of the servomotor to a full 180 degrees (-90 to 90 degrees) rotation by decreasing the minimum pulsewidth to below 1 ms and increasing the maximum pulsewidth to over 2 ms. This can be accomplished with our previous program by modifying the occurances of 100 and 200 to your desired minimum and maximum pulsewidths, respectivly. However, a note of caution: the pulsewidth required for servos varies from brand to brand. One motor may require a 2. 8 ms pulsewidth for maximum rotation, while another may only need 2. 4 ms. Furthermore, servomotors have end stops that limit its rotation. If you send the motor a pulsewidth that is beyond the end stops, the motor will keep trying to turn. A motor in this stalled condition not only draws more current, but also puts wear on the internal gears, shortening the lifespan of the motor.




Leave Comment

characters left:

New Circuits

.

 


Popular Circuits

Adaptor for the Dreamcast serial port
AC Arduino dimming circuit
Transistor current mirror circuit
40 segment led s meter
dc servo motor controller
transistor tester circuit
555 Timer as an A/D converter
Morse Keyer Redesign and Rebuild
SAA1042 stepper motor control circuit



Top