OpenServo Construction Tutorial for the TowerPro MG995

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.

The servo chosen for conversion in this tutorial is the TowerPro MG995 which is widely available for under $20 from a variety of vendors. 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. Here's a picture of the resulting servo.

finished_OSV3

Assembled OpenServo board in a stock TowerPro MG995 servo ready for testing.


The Overview of the process

With servo, OSV3, and required tools, open the case, desolder the motor leads and POT leads. Modify the case such that the OSV3 will physically fit. Then transfer the POT from the original PCB to the OSV3, and button it back up. Took me less than an hour.

Note these servos are very low cost. Quality will vary, you may want to purchase 10% to 20% extra. Some noted issues include chaff or some kind of stuff in the gears, and varying backlash. I ordered 10, and had one with some grinding in the gears. Not a big deal, but I had to pull out some junk with a tooth pick.

Here's a picture of the tools I used to do this modification.

tools_used

Tools required to make the modification.

I used a #1 Philip's screw driver, a soldering iron, a nibbler, and a razor blade.


Test OpenServo Operation

I (the creator of this page) haven't done this process yet, I'm waiting on a digikey order for my wire and connectors.

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 micro-controller 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.

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. Robotfuzz has the OSIF, with windows software that will allow this feature.

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 micro-controller and sensor components. The connections to the OpenServo board are shown below in the "Test OpenServo operation" section. The power feed should be at least 7VDC.

After power is applied wait at least 3 seconds before attempting to communicate with the OpenServo. The reason for this is that the OpenServo boot-loader 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.

Open the OSIF software, scan the device, and click the read at the bottom of the screen. Not the one to the right, the one on the bottom.

At this point you have powered the AVR micro-controller and tested that serial I2C communication with the OpenServo software is functioning. You can now proceed with assembly.


Disassemble Servo

Start by removing the four screws on the back of the servo case to expose the existing servo control board.


Desolder existing servo control board and POT

For the TowerPro MG995 servo there are five connections that must be desoldered from the original control board. It's best to leave the motor in place, so these motor wires need to be desoldered such that you can remove the board. The other three are small pads that attach to the potentiometer and two larger pads that attach to the motor. Removing the POT and screw completely will make it easer to solder, but may introduce some contamination to the lubrication on the POT shaft. I chose to remove the POT for easy of assembly.

motor_wires_removed

Locate motor wire pads on and desolder.

pot_wires_exposed

Locate the POT pads, and desolder.


Modify the case to accept the 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.

In this tutorial the 10-pin dual in-line connector on the back of the OpenServo board 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 radio shack nibbler 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!

case_mod_1

Test the fitting OpenServo board and connector in the case.

(sorry for the fuzzy picture)

nibbler_shot

Notches cut in servo case and bottom cover to make room for the 8-pin OpenServo connector.

nibbler_end_cap_2

Notches cut in servo case and bottom cover to make room for the 8-pin OpenServo connector.

With a razor blade or a hot soldering iron, cut some of the shelf out such that the board can sit flush.

side-view-1

Test the fitting OpenServo board and connector with the side of the case.

body_needs_a_notch

Location needed notch OpenServo board and connector with the side of the case.

body_notched_via_soldering_iron

My soldering iron made a nice hot knife.

I used my soldering iron as a hot knife. The plastic melted and pushed out of the way. I had next to no fumes or any signs of burning. The trick is to have your wet sponge handy, After I melted and pushed material away, It was easy to remove the remaining blobs with a razor blade.

Now Cut the ribs on the side off. I did a much nicer job the second time around, I should post better pictures. You can cut from the screw hole up to the motor off. When you put it together, it will fit, but is a snug fit.

lid1

Test the fitting OpenServo board and connector with the bottom of the case.

lid2

Test the fitting OpenServo board and connector with the bottom of the case. From another angle

Re-attached POT (or open-encoder) to OpenServo board

Three 22 gage wires are used to connect the OpenServo board to the POT. They need to be desoldered, then reattached to the OpenServo board.

The wiper is the center tap, the outer two are the resistor. Solder each of the outer wires to the pins labeled + and - on the board. The square pad should connect to the center lead of the servo. These are close, be careful about creating a solder bridge.

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. If this happens, you can fix it via software. I understand this requires uploading different firmware, if you want to know more about that firmware, inquire in the OpenServo forums.

Also note, the tab on the POT should fit in the little channel for it. If you don't land it there, the POT may rotate excessively, causing wander and problems. Some hot glue may also help keep the POT rigid for additional accuracy.

POT_wires

POT re-attached to OpenServo.

Now if you put it together, it should all fit together snug, but should not cause the case to noticeably bow or bend. If not, trim some more until it does fit well. Once it mechanically fits, move to the next steps where we solder it back together.


Re-attach 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 motor direction needs to match the direction of the feed back. Note above the + pot lead connected to the tabbed side of the POT. So each wire is a straight shot here. Well straight with a loop for vibration stress relief.

Install a .1uF cap across the motor leads. Good choices include Newarks, 36K6164 at $.072 in qty 1. You can either put it on the motor, which is easier to solder, or you can put it on the OSV3 board. Be sure to make the solder flow if you install it on the FET outputs. You have to heat a lot of copper, and a SMT bit may not pump enough heat down to make solder flow.

Motor_cap_on_motor2 Motor_cap_on_OSV3_2

Cap on the motor, cap on OSV3 board.

You can put the cap on the motor. This is easier to solder than it is to solder it to the OSV3 board. However, it's more prone to vibration and mechanical damage issues. You can put it on the OSV3 board, however, the leads for the MOSFET drivers are attached to a sizable piece of copper, so you have to sit on it for a while with the soldering iron to get it to flow. If you are holding the cap in position, your fingers will get toasty warm.

Note both methods of adding the motor cap have a high chance of shorting. Keep an eye on this, perhaps adding an isolating piece of tape might help prevent issues.

That should complete the soldering, and you are now ready to button it up and do some final testing.


Close the case back up

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.


Test OpenServo operation

The OpenServo is now ready to be powered up and tested.

To do this, I first rotating the servo(s) full CW or CCW. I attached a power supply to the OSIF interface, and used a harness I made to connect the servo to the OSIF. I then used the OSIF windows software to read the position. I see full scale is 0-50 or 1000-1050. Then I set it to full CCW, and put in a P of 0010. If a wire is crossed, it would lock up, with out powering very hard into the physical stop, if it was good, it would lazily rotate to it's target position.

Here's a view of the harness.

Min_harness

This is the minimum harnes

This harness allows power and I2C com's. This harness will not allow initial programming. If you purchased from robotfuzz, it has already had the initial firmware, and can re-program by boot-loading via I2C.

The MG995 really doesn't want anything more than that magical 7.2V. Mostly because the motor can't handle it, partly because the on-board Vreg will start getting warm. However in a pinch it would appear you can get by on a 9V battery. That's what I did as my bench supply is currently wandering the globe (it's at someone else's house at the moment).

I used the windows OSIF program. Some notes, about it's use. When you type in a P or D parameter, if you have pwm on, it should update the motor right away. After you type in a number, hit enter, and you should see the message sent in the log. If the servo act's funny, or is non-responsive, it's likely a low voltage issue. Make sure you are above 6.5V normal, and make sure your supply isn't soggy. A solid 7.2V is optimal.

I started with a P of 0010, this should cause the servo to casually move to the set position. Because it's such a low P, if you crossed a wire and are in a positive feed back configuration, it will attack the limits in a mild manner, hopefully preventing damage. If you are already at the CW or CCW limit, it will simply tighten up. You don't need to fix this at the POT, you can cross the wires at the motor instead. However, your scale will be reversed if you swap the motor leads. So what was full scale, will be min scale. If the scale orientation is important, you'll need to current the problem at the POT.


Troubleshooting

[Describe troubleshooting tips here.]


Misc Notes

The MG995 uses a M3 thread for the driving spline. It also uses the Futuba 24 tooth spline. I got a metal gear that fit it just perfect, part number RSA48-FMG-24 from here

http://servocity.com/html/48p_futaba_metal_gears.html