Servo Problems

by Nerudin on Thursday, 24 December 2009,

I have been having some problems with the movements of the robot. It seems that the two Servo motors which control the movemements of the robot aren't doing what they are supposed to do. The code I sent/uploaded to the Arduino, is meant to make the robot move in a way close to the figure 8, but all it's currently able to do, is to spin left and right in an endless loop. This is similar to what was happening with my first prototype where I was using the MotorShield and the two DC motors. At the time I thought it was a problem with my code, but it turned out that it was infact a problem to do with the Servos not being calibrated.

There are two different types of Servo motors, Regular Servos and 360Servos. 360Servos, as the name suggests, can rotate 360 degrees in either direction. Every 360Servo has something called a 'Centre Value', this value stores the the 'Neutral' position of the Servo. This position is the point where the Servo has the exact same amount of potential rotation in both the clockwise and anticlockwise directions. The value for this point can differ in all Servos, therefore a proper calibration is required to identify the exact 'Neutral' value.

I conducted some research into how to calibrate the Servos, and I discovered two ways to do it. Calibrating the Servos can be done manually, which involves manually rotating the arms of a Servo in one direction until it stops making note, then doing the same going in the opposite direction until it stops.

The other method to calibrate the Servo is automatic. Automatic in the sense that you can use dedicated applications to do the calibration, some are free, some you have to purchase. I was able to get my hands on a free one, but unfortunately it didn't work for me. In the end I was able to use the Serial monitor on the Arduino IDE so that I could send commands/serial data to the Arduino. The Serial Monitor is able to connect and send the serial data to the Arduino at a rate of 19200bps (short for 'Bits Per Second'). The 19200 bps or Baud rate, is the rate in which to transfer data to the Arduino.

With the Serial Monitor I was able to send commands to the Arduino to rotate the Servos. To do this, you have to send commands using the Serial Monitor by typing, e.g. SXX (XX = numerical value) and clicking 'Send'. 'S' is a delimiter and the 'XX' numerical value is the angle of rotation to send to the Servo. The 'Neutral' point can be found by sending the command e.g. s89, s90, s91, s92 and so on and so forth, until the servo stops moving. Each of the Servos have to be calibrated this way seperately, i.e. connected to the Arduino one at a time. My two Servo 'Neutral' points turned out to be at s87.

And that was it, my Servo problems were no more.


0 comments for this entry:

Leave a Reply