How to zero a parallax continuous rotation servo

From ROBOTC API Guide
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?

Zeroing a continuous rotation servo is where you adjust the servo such that the servo does not turn when a 1.5ms pulse is revived by the servo. Not all servos can be zeroed. Even among the ones that can be zeroed, it is not always necessary.

Zeroing the servo

First we need to make a program to send a 1.5 ms pulse to the servos. To speed this up, we are going to provide you with the code, and you can learn about how it is setup in the next section.

First, we need to 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
  }
}

Upload the program to the Arduino. Connect the battery back to the Arduino. Flip the power switch on the Boe Shield to position 2. At this point if the servos are not zeroed, you will find that they are turning. This is bad since it would mean that programing the motors to "stop" would not actually stop the motors.

Now that we know if they are zeroed, we 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 then keep turning in that direction until the servo stops. If the servo starts going faster, then turn the potentiometer the other 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.