How to zero a parallax continuous rotation servo

From ROBOTC API Guide
< Tutorials‎ | Arduino Projects/Mobile Robotics/BoeBot
Revision as of 16:18, 11 October 2012 by Jwatson (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Notepad.gif NOTE: This is a place holder for a video.
Please add the id for the YouTube video with description "Zeroing the Parallax Continuous Rotation Servos"


What is zeroing?

Unfortunately, not all servos are created equally. Due to slight manufacturing defects, some continuous rotation servos will move or 'drift' even when they are being sent the 1.5 ms 'stop' PWM signal. To compensate for this, most continuous rotation servos contain a small, adjustable resistor (called a potentiometer) that can be used to 'tweak' the servo to account for drift.

Zeroing the servo

Before we zero the servos we need to ensure that they are drifting in the first place. To do this, we will send a 1.5 ms 'stop' pulse to each servo. If the servos are stationary, they will not need to be zeroed; if they start moving towards one direction or the other, however, they will need to be tweaked.

The following code will continually send a 1.5ms pulse to the Arduino's pins 10 and 11. Create a new source code file, and copy the following code into the file and save it as "Zeroing servos.c"

#pragma config(CircuitBoardType, typeCktBoardUNO)
#pragma config(PluginCircuitBoard, typeShieldParallaxBoeBot)
#pragma config(UART_Usage, UART0, uartSystemCommPort, baudRate200000, IOPins, dgtl1, dgtl0)
#pragma config(Motor,  servo_10,        leftServo,     tmotorServoContinuousRotation, openLoop, IOPins, dgtl10, None)
#pragma config(Motor,  servo_11,        rightServo,    tmotorServoContinuousRotation, openLoop, reversed, IOPins, dgtl11, None)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
 
task main()
{
  while(true) {//wait indefinitely
    motor[leftServo] = 0;    //Set the left servo stop
    motor[rightServo] = 0;   //Set the right servo stop
  }
}

Compile and download the program to the Arduino. After ensuring that the battery pack is plugged into the Arduino flip the power switch on the Boe Shield to position 2. If the servos are moving in either direction they will need to be zeroed.

You can use the screwdriver included in the Parallax kit to turn the adjustment potentiometer on the servo. Slowly turn the potentiometer to one direction. If the servo slows down, keep turning in that direction until the servo stops. If the servo starts going faster, then turn the potentiometer the opposite direction until the servo stops turning. If you turn the potentiometer past the zero point, the servo will start to spin in the opposite direction. If this happens, just turn the potentiometer very slowly in the other direction; it may take several tries to get it 'just right'.