- Published: Saturday, 13 March 2010
- Written by Graham Mitchell
- Hits: 6207
To ensure my Dedicated Servo Controller worked and was stable, I made a Servo "Ranger" program. It's a dual purpose design (discussed later) that allows the user to control 8 servos via two potentiometers.
One potentiometer selects the servo, and the other sets the position. While there are 8 servos to choose from, there is a 9th mode which displays both the total number of packets sent and the total number of errors that have occurred. An error occurs if the value "1" is not returned from the Dedicated Servo Controller after a packet has been transmitted.
Circumstances that could lead to errors
Any number of possibilities could result in a packet validation error, such as:
- Noise on UART interface.
- Dedicated Servo Controller doing something else during a packet reception.
- Noise generated from Servo operation.
- Slow/buggy code (such as incorrect context saving).
Most of the above possibilities will result in ambiguous UART data being received. Before the Dedicated Controller will update servo positions, the entire packet must pass a checksum. Each servo position is XORd together, then compared with the pre-calculated checksim. A failure will result in the controller sending back a "0" (which simply means 'bad packet'). If the packet passes the validation, then a "1" is returned ('good packet').
This project was really a dual purpose. As the name suggests (Servo Ranger), the program allows full control of a servo to "test" deflection angles. This is handy for discovering both the limitations and any linearization errors a servo may have. This is probably the long term role for this little board, so the project was named after it.
What does the rest of this article have to do with the Servo Ranger? The ranger checks every packet transmission and ensures the Dedicated Controller returns a "1". Any failures are clocked and displayed in mode 9 (as mentioned earlier). The project was not intended for long term use, rather for a real life crunch test on the dedicated controller, hence the open-board design below. I left it running for a couple of hours to see how stable the program was - Here's a picture after that time:
Over 900,000 packets (P) have been sent - a single error (E) is yet to occur.
As shown in the picture, over 900,000 packets have been transmitted. There were no errors recorded in that time frame, nor has there been an error in the 12+ hours I thought I would leave it on for.
A brief video of the project in operation:
(video of project not uploaded as yet)
And the source code itself. Note the use of the potentiometers - my new favorite way to do business!
Download the Swordfish program and Gerber files here: Servo Ranger Source Files
Thoughts comments and feedback are more then welcome.