OpenServo Construction Tutorial
Note: This tutorial is currently a work in progress. Please leave feedback in the OpenServo forums.
This tutorial documents the conversion of a low-cost R/C servo into an OpenServo using assembled and programmed boards available from Jay Ragsdale of Pendragon Robotics. Information regarding how to obtain your own assembled and programmed OpenServo boards from Jay can be found in this forum message thread.
The servo chosen for conversion in this tutorial is the Futaba S3003 which is widely available for under $10 from a variety of on-line retailers. The conversion of other models and brands of servos will be very similar and the general process outlined below will apply to those servos as well.
Pre-assembled OpenServo board and a stock Futaba S3003 R/C servo ready for conversion.
The Assembled and Programmed OpenServo Board
When you receive your OpenServo board from Pendragon Robotics it will look very similar to those pictured below. The top side of the board will have the 32-pin AVR ATmega168 microcontroller. The bottom side of the board will have the two MOSFET chips and assorted passive components. The bottom edge of the board will have an 8-pin dual-inline connector used for serial communication/control as well as flash programming from an AVR programmer. Depending on how you intend to connect wires to the OpenServo you may wish to desolder the connector from the board. This tutorial assumes the connector will be left attached to the OpenServo board.
Further modification of the OpenServo board and the servo case may be required to fit your specific servo case. These modifications for the Futaba S3003 hardware are described below.
Top and bottom of the assembled and programmed OpenServo.
Test OpenServo Operation
It is recommended to first test the basic operation of the OpenServo board prior to starting the conversion process. Although the board cannot yet drive motors and read the position potentiometer, serial I2C communication can be established with the board and basic operation of the microcontroller and software verified. Making sure the OpenServo board works at this time will help to identifying the source of problems should it fail to operate after the conversion process.
The Dimax U2C-12 USB-to-I2C bridge being used to test operation of an OpenServo board.
To test the basic operation of the OpenServo board you will read the data registers that control overall operation of the OpenServo. To this you will need some type of I2C master with client software that allows you tor read and write data to and from I2C slave devices. The instructions below assume that you have access to such an I2C master with client software and you know how to use it.
First, you must attach attach power, ground, I2C data and I2C clock to the OpenServo on the top four connectors. The OpenServo has an on-board 5 volt regulator to supply power to the AVR microcontroller and sensor components. The connections to the OpenServo board are shown below:
I2C data, power, ground, I2C clock attached to OpenServo board.
After power is applied wait at least 3 seconds before attempting to communicate with the OpenServo. The reason for this is that the OpenServo bootloader uses these three seconds to determine if a controller is attempting to reprogram the OpenServo.
The OpenServo by default responds to I2C slave address 0x10 and appears as a simple memory device to an I2C master with a 1 byte address field. The valid address range is between 0x00 and 0x7F which corresponds to the registers that control the operation and indicate status of the OpenServo.
Using your I2C client attempt to read the first 48 registers of the OpenServo by sending a packet that writes the slave address and register address and then reads 48 bytes.
[XX]...[XX] ^ ^ ^ ^ | | | +--- Read - Data byte 47 | | +---------- Read - Data byte 0 | +-------------- Write - Register address byte (0x00) +------------------ Write - Slave Address shifted left by 1 and 0 R/W flag (0x20)
[Please let me know if there is a way to make this more clear.]
Note that the slave address byte is 0x20 and not 0x10. A read packet in the I2C protocol shifts the slave address to the upper seven bits of the byte and sets the lowest bit to 0 to indicate a read. Your I2C client software may make the shifting operation transparent.
Your client software should return the contents of the first 48 register bytes with values similar to the following:
01 01 00 01 00 03 14 BA 00 0E 00 05 00 00 00 00 01 B5 00 00 00 00 00 00 01 D3 00 00 00 00 00 00 10 02 00 00 00 00 00 00 00 60 03 A0 00 60 28 28
Your specific data will vary because the timer and sensor readings will be different.
At this point you have powered the AVR microcontroller and tested that serial I2C communication with the OpenServo software is functioning. You can now proceed with assembly.
Remove the four screws on the back of the servo case to expose the existing servo control board.
The back of the servo case removed and the existing control board exposed.
Desolder Existing Servo Control Board
For the Futaba S3003 servo there are five connections that must be desoldered before the existing control board can removed. These connections include three small pads that attach to the potentiometer and two larger pads that attach to the motor. The use of a desoldering braid or wick is typically the best way to desolder the connections.
Servos vary in how their control boards can be removed. For instance, some control boards will be attached to the motor and potentiometer using wires. In such cases, the control board can be partially removed away from the case and the wires clipped or desoldered where they attach to the board. Other servos, such as the Futaba S3003, will require that certain pads be desoldered before the control board can be removed. If you have questions regarding how to remove the existing control board from your servo you may be able to find assistance in the OpenServo forum.
Location of pads on Futaba S3003 to be desoldered marked in red.
Existing Futaba S3003 servo control board removed from the servo case.
Cut Servo Case To Fit OpenServo Connector
In this tutorial it was decided to leave the 8-pin dual in-line connector on the back of the OpenServo board. Therefore, the servo case needs to be modified so the OpenServo board and connector fit into the case. The specifics regarding how a servo case should be modified to fit the connector will vary from model and brand as well as your preferred method of cutting. In this instance, a Dremel rotary tool was used to make the notches as shown below in the case and case bottom. Other cutting tools such as hot knife or nibbler tool can also be used. While cutting the case it is important that the servo case be held firmly in a vice or other tool to avoid having the cutting tool slip and cause injury. You have been warned!
Notches cut in servo case and bottom cover to make room for the 8-pin OpenServo connector.
Test Fit OpenServo Board And Connector
After the servo case has been cut the OpenServo board can be tested to ensure a proper fit. During the test fit make sure the servo bottom fits tightly all around the servo case to avoid dirt and other debris from entering the servo during operation.
Test the fitting OpenServo board and connector in the case.
Test the fitting OpenServo board and connector with the bottom of the case.
Trim And Notch The OpenServo Board
For a proper fit into the Futaba S3003 case some slight modification of the OpenServo board is required. To make room for the screws that hold the servo case together and for an optimal fit in the case a Dremel rotary tool was used to cut notches and trim the sides of the OpenServo board as shown below. Care must be taken to make sure that no electrical traces are accidentally cut while trimming or notching the board.
Other servos may not require any modification or require the modifications be made in a different manner. The specifics will vary by servo model and brand.
Locations where OpenServo board was trimmed and notched using a Dremel rotary tool.
Solder Motor Leads To OpenServo Board
Two 1.5 inch 22 gage wires are used to connect the OpenServo board to the servo motor. These wires are soldered directly to pins 5, 6, 7 and 8 on the two MOSFETs that control power to the motor as shown below. These wires will be subject to vibration during servo operation so a liberal use of solder for the joints will help keep them attached for the life of the servo.
The polarity of the electricity applied to a DC motor determines the direction the motor will turn. The use of colored wire helps keep the motor polarities straight during the assembly process. In this instance, a red wire is used to indicate the MOSFET that will be attached to the positive terminal of the motor and a black wire used to indicate the MOSFET that will be attached to the negative terminal. Most DC motors used in servos will indicate the positive terminal with a red marker, plus sign or other distinguishing marker.
Red and black motor wires soldered to the MOSFETs.
Another view of motor wires soldered to the MOSFETs.
Detail showing how motor wires are soldered to pins 5, 6, 7 and 8 of the FETs.
Solder Potentiometer Lead To OpenServo Board
For the Futaba S3003 it is easiest to solder the potentiometer while it is removed from the case. The potentiometer is held in place by two plastic tabs. To remove the potentiometer push the plastic tabs aside with slight pressure from a small screw driver while pulling on the potentiometer . Once removed, the orientation of the potentiometer is checked and then it is soldered directly to the underside of the OpenServo board. The metal tabs are inserted into the three holes on the OpenServo board.
The Futaba S3003 is different from most servos in that it has metal tabs that connect directly to the OpenServo board. Most other servos will have a potentiometer with three wire leads that must be soldered directly to the OpenServo. If you have doubt how the three potentiometer leads for your servo should be soldered to the OpenServo board, please ask for help in the OpenServo forums.
Note: One side of the potentiometer is tied to power and the other side to ground on the OpenServo board. If the power and ground leads to the potentiometer are swapped the OpenServo will function in a positive feedback mode rather than a negative feedback mode. Servos must be operated in a negative feedback mode. In other words the OpenServo will fail to operate correctly and the servo arm will swing to an extreme position when first tested. If this occurs immediately disconnect power to the OpenServo and swap the ground and power leads going to the potentiometer to return the OpenServo to a negative feedback mode of operation.
Potentiometer soldered to bottom side of OpenServo board.
Another view of potentiometer soldered to the bottom side of the OpenServo board.
Insert OpenServo Board Into Servo Case
The OpenServo board can can now be inserted into the servo case. The motor leads should be bent and routed to the motor as shown below.
For the Futaba S3003 care must be taken when inserting the OpenServo board to make sure the potentiometer is properly seated between the tabs that hold it in place. A small flat-head screw driver can be used to push the potentiometer into place if needed. Most other models and brands of servos will not have this issue as the utilize potentiometers with wire leads.
After the OpenServo board is inserted test rotation of the servo arm by manually turning it to ensure that the servo has 180 degrees of rotation. If the servo arm doesn't have 180 degrees of rotation the likely problem is that the potentiometer is improperly mated with the servo gearing.
OpenServo board fitted into place prior to final soldering.
Solder Motor Leads To Motor
Solder the motor leads to positive and negative terminals of the servo motor. These solder joints are subject to vibration during servo operation and a liberal use of solder for the joints will help keep them attached for the life of the servo. Note that the motor in the Futaba S3003 has a circular red marker to indicate the positive terminal.
For the Futaba S3003 it was decided to also add a 0.1 uF capacitor directly across the motor terminals. Many servos will come with this capacitor already mounted. If not, you may consider adding this capacitor yourself to help prevent electrical noise generated by the motor from interfering with the OpenServo electronics.
Motor leads and 0.1 uF capacitor soldered to the motor.
Another view of motor leads and capacitor soldered to the motor.
The servo case should now be closed. Congratulations, you now have a fully assembled OpenServo that is ready for testing.
Note: If this is your first OpenServo it may be possible that the potentiometer or motor leads are reversed and the OpenServo will incorrectly operate in positive feedback mode. See the section on soldering the potentiometer to the OpenServo board for a description of this problem and how to correct it. With this in mind, the first time you power up an OpenServo it is recommended you do it without the case screwed close. This will allow the servo case to come apart rather than gear teeth break if the servo is incorrectly wired and the servo arm driven to an extreme position.
Servo bottom cover in place and screws tightened.
Test OpenServo Operation
The OpenServo is now ready to be powered up and tested.
[Links to how to power-up and communicate with an OpenServo to be added here.]
[Describe how to perform initial test of the OpenServo.]
The Dimax U2C-12 USB-to-I2C bridge being used to communicate with a assembled OpenServo.
[Describe troubleshooting tips here.]