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:

Related Circuits

  • New Circuits

    .

     


    Popular Circuits

    Yelping-siren
    Rc Decade Box Circuit
    15 Watt switching power supply
    Laptop Audio-Out Splitter
    Analog Equaliser
    15 kV @ 30 mA Floating-Output AC or DC High-Voltage Power Supply
    Cymbal Vacuum Tube Push/Pull Power Amplifier 6H30 6W
    Repeating Timer 5
    high-level accessory front end for the HF amateur bands
    Automatic light control circuit curtains
    An ultrasonic transmitter circuit diagram discrete components
    Test circuit diagram with feedback factor of 1 83 of TDA6120Q



    Top