RC servomotors use a form of PPM (pulse position signaling) signalling to communicate the desired motor angle. PPM itself is an instance of PWM (pulse width modulation) signalling where the pulse high time has specific meaning. Furthermore, there is usually a minimum low time at the start of the signal frame so that the receiving end can reset itself and decode the new command.
Most of the modern embedded controller programming IDEs now have a library for performing this task. That makes it super easy to control servo-motors, unless you want to control more than the chip can provide (in terms of PWM/PPM signal lines). In that case, specialized methods are needed to enhance the functionality of the microprocessor to do more than the libraries are coded to do. Essentially, you'd be coding up your own library.
Part of getting these servo-motors to work involves calibration. Even though they can be commanded, the problem is that each microcontroller and programming interface has its own numerical range for the command specification. Furthermore, it doesn't always align with the angular range of the servomotor itself. Thus, there needs to be a step that measures the angles associated to different command values across the legal range, then fits a line to the data acting as though the angle were the input and the associated command value were the output. A serviceable example of this is the calibration interface for the piktul robot.
To be done.
To be done.
Controlling a servo via the mBed requires you to
The code shown above can control six servos independently. Note that the code includes commands for serial monitoring; leave them commented out if you don't have a serial monitor running or you'll get errors preventing the code from compiling. The code also has commands for using a potentiometer to control the servos - again, leave that commented out if you won't be using the potentiometer. Finally, you must be sure to import the servo library from the mBed website so that you have the required background functions enabled.
The code causes all six servos to move to approximately 90 degrees to the left of its center point, then move to the right for ten steps of approximately 9* (ending back at its starting point), and repeating. The wait can be changed to make this process go faster or slower.
In the servo#.calibrate() lines, the numbers in the parentheses are the pulse width (range from center (1.5ms) to maximum/minimum position in seconds) and the angle from center to maximum/minimum position in degrees. Our team is currently working to further understand how these two variables relate to the actual range of the servo. As we gain more knowledge, this page (and others) will be updated.