Tuesday, November 30, 2010

Deficiencies of the TowerPro MG995

(and how to address them)

In my quest to build entertaining little walking robots on a slim budget, I’ve evaluated many low-end servos. When reviewing the options available at the moment, I keep finding myself drawn to the TowerPro digital servos (the MG995 and MG996 in particular). These servos have a deservedly poor reputation - they’re very cheaply made, have high failure rates and poor position-holding - but it’s hard to ignore that you get a digital, metal-gear, ball bearing servo with impressive speed and torque for about $10. I would never use one of these servos on a RC aircraft, where failure would mean an expensive crash, but for the little walking robots I make I’m prepared to accept occasional failures.

My current project is to see if there is a way to take these cheap, nasty, and unreliable servos, and modify them into something more reliable and accurate while still spending less than I would on buying high-quality servos in the first place. Bonus if I can add functions available only on high-end robotic servos such as telemetry feedback from each joint.

The MG995 servos have the following deficiencies needing to be addressed:

1. Generally cheap construction

The most obvious sign that these are very cheap servos when you open them is the general lack of care and quality control in the design and assembly. In the electronics compartment, the PCB is not reliably located in the case, but seems (at least in the servos I have opened) to have some freedom to move in the case. There are glue blobs on the motor wires where they connect to the board, but not on the potentiometer wires, nor on the wire connections on the motor or the external servo connection wires. I have not seen a wire break on any of my servos, but I expect it to be a likely failure mode with long-term use. While this could be improved with some additional hot glue or similar adhesive on the wires, I am thinking to completely replace the board and interior wiring.

In the gearbox section, I have found chips of metal and plastic in the gear assembly, and the grease is thin and uneven and is of unknown quality. I have gotten in the habit of disassembling, de-greasing, cleaning, carefully reassembling and re-greasing these servos before using them, as well as periodically between events.

2. Poor position control

The MG995 is notable for its poor position holding. There is significant ringing and overshoot when the servo is commanded to rapidly change position. When a heavy overhung load is attached to the servo output, such as the leg of a robot, the servo can actually start oscillating as it constantly overshoots and over-corrects while trying to hold position. This was very noticeable with some versions of my walking robot, when I had the robot stand with one leg off the ground sometimes the entire robot would begin shaking uncontrollably. Granted that I am running these servos at above their recommended voltage and with large overhung loads, which is not their intended application, but I have seen that other servos intended for similar use do not have this problem.

Other than asking the servo to do a job it wasn't designed for, I suspect a poorly tuned feedback loop and a motor with a heavy, high-inertia core. I have tried replacing the motor, control board, and potentiometer with those from a Hitec HS-5645MG, keeping the same case and gears. This gives much better position control and seems to be reliable, but is too expensive per servo - if I’m going to have to buy replacement parts for a Hitec servo for each servo I use, I might as well just use more expensive servos. I am probably going to stick with the existing MG995 motors for cost reasons, but replacing the control board is looking like an attractive option.

3. Weak case

The MG995 seems to have been made with the least possible amount of plastic. The most common failure I have found is the plastic lip around the center shaft in the gearbox. The torque on the main output shaft of the servo is effectively felt by this secondary shaft, so there is a lot of shear load applied to this point. There isn't much plastic around the wells in the plastic case top and center section that locate the ends of this shaft, so over time these openings start to oval out and allow the shaft to shift position. This leads to the gears on the center shaft getting out of alignment, leading to increased wear on the gears and increased load on the motor. I have even seen the gears be pushed enough out of line to hit the sides of the servo case, filling the case with gouged-out plastic chips and debris. This is a major problem with these servos, something that seems to happen inevitably even with moderate use. I have tried several things to solve this problem. The most recent and somewhat successful solution was to carefully shave down the interior of the servo case, cut a small piece of thin sheet steel, drill a small hole in the steel and insert it into the case to locate the end of the shaft. This works, the steel plate holds the shaft in place and prevents it from wobbling, but requires very careful work as the exact placement of the hole is critical to maintain proper gear spacing.

The second failure point is the mounting ears. The case is quite thin where the mounting tabs attach to the case, and I have seen them crack off on several servos. Admittedly I am subjecting the servo mounting points to forces they were never intended for, but this is still a failure I have not seen from other servos. On early robots I avoided this failure mode entirely by ignoring or removing the mounting points and simply gluing the servo case to the structure of the robot. I am now trying to avoid any king of adhesive or epoxy on load-bearing joints, and want to have every part of the robot easily replaceable in the field, so I am no longer gluing servos in place.

I have found that the mounting ears are less likely to break if I use oversize rubber grommets and proper mounting ferrules on all four mounting screws, and make sure all screws are securely tightened and treated with a thread-locking compound to prevent them vibrating loose. Even so the TowerPro servos are noticeably weaker here than other servos I’ve tried. I have on an emergency basis held servos with broken tabs in place with tape and zip-ties, but that is obviously not a method I want to rely on.

Ideally, I would like to replace the entire upper case of the servo with one that has stronger mounting tabs and intermediate shaft locating wells. Replacing the upper case with that from a Hitec HS-5645MG is not acceptable, as aside from the price difference the gear spacing between the two is off just enough for the gears to lock up with the Hitec upper case. It has been suggested that I could cast my own cases from aluminum or bronze. Aside from having no experience with metal casting, I live in a condominium and don’t have a suitable work space for metal casting. I have also been considering having new cases made by a rapid prototyping shop, provided I can have it done at a reasonable price. There is also the possibility of having metal sheets waterjet cut and inserted into the existing servo case to provide reinforcement, similar to my current hack but more consistently made.

4. Unreliable potentiometer

The MG995 appears to have a cheap potentiometer that wears out quickly. Admittedly, this flaw is based more on speculation and secondhand reports than direct evidence, as I have not opened up any MG995 potentiometers to personally measure the thickness of the resistive element or measured how they degrade over time. The assessment of poor quality is based partially on secondhand reports from people who have used these in more conventional applications such as RC aircraft as well as my own observation of poor position control that degrades over time.

Of course, the potentiometers in the MG995 suffers from the same deficiencies as any potentiometer-based position feedback. It has a limited arc of travel, is not capable of 360 degree position sensing, and is dependant on a sliding contact that inevitably wears down and can be contaminated by surface oxidation or debris. Also, as a purely mechanical observation, the Towerpro potentiometer is held in its well with an off-center screw which can cause the servo to bind if not tightened with just the right amount of torque.

Although I could probably live with the potentiometer as it is for my purposes, it would be an interesting project to replace it with a noncontact magnetic rotation sensor such as the Asashi EM-3242. These are fairly inexpensive (under $5 each) and take up a comparable amount of space to the original potentiometer (6 pin SOIC package, plus a small magnet). It would require making my own controller board, but that is something I was considering anyway. This would provide position feedback with no increasing inaccuracy due to wear over time as well as give me the ability to have full 360 degree motion of the output shaft. There are a few interesting robot designs I can pursue where a 360 degree movement would be useful.

5. Motor can't survive 8.4V

The MG995 is rated for a maximum of 6.0V. A two-cell LiPoly pack provides 8.4V when fully charged. Many 6.0V rated servos, such as the Hitec digital servos, will run at 8.4V for quite some time, just getting a bit hotter than they would normally. The control board of the MG995 seems to handle 8.4V, but the motors rapidly fail. I have not yet cut any of the failed motors open to identify the exact cause of the failure as these motors are designed to be opened nondestructively, so I do not know if the cause of the failure is in the brushes or commutator or wiring or elsewhere.

I have on some of my servos replaced the motor and control board with that from a similar Hitec servo, but this is obviously not a cost-effective modification. I would like to find a way to work with the existing motors for cost reasons. One obvious option is to use a commercial voltage regulator, either a hobby model designed specifically for this purpose or a scratch-built high-current switching regulator. If I am building and programming my own control boards I might be able to prevent motor failure by placing a limit on the PWM duty cycle to the motor FETs and/or monitoring the drive current and motor back EMF so that the motor is effectively only ever being subjected to 6.0V even if the input voltage is 8.4V. I’m not sure if that will actually work yet.

6. Limited communication method

The MG995, like nearly all hobby servos, uses the standard pulse code modulation system to transmit position control commands. This communications scheme, inherited from truly ancient analog control circuits in the earliest RC toys, has quite a few deficiencies. It can only send one type of information, position commands over a fixed range of angles at a fixed update rate. It requires a separate control line for each servo, requiring me to use a servo control board to translate the serial data stream from the radio into individual servo lines. It can’t return any data back from the servo, not even a basic ‘servo plugged in and working’ indication. Now it is true that most digital servos have a secondary digital communications mode which addresses some of these (the MG995, although digital, does not), and many of the newer servos designed specifically for robots dispense with the old PCM system entirely and use an addressed bidirectional data bus for communication. I approve of this trend, although those robot-specific servos are beyond my budget.

If I am replacing the control boards in these servos with custom-designed ones, I will design them to use a bidirectional addressed data scheme. This will allow me to dispense with the servo controller board, and return telemetry from each servo giving actual shaft position, current draw, temperature, fault indications, and other data such as I will think of.

7. Geartrain - not actually a deficiency!

The gear train in the MG995 is in my experience surprisingly robust, at least as compared with other servos I have tried. I have never seen gear teeth strip in a MG995, while stripped teeth happen with disturbing regularity in the Hitec servos I’ve tried. The Towerpro servo gears are thicker and appear to be more robust than the Hitec gears, which surprised me considering how nearly every other part of the servo was inferior.

I have seen the Towerpro servo gears fail in an odd and unique way, something I’ve never seen or heard of in other servos. Many of the gears are two-part, having a small steel pinion pressed into a larger brass gear. I have seen on a few servos the steel pinion pop out of the larger gear, accompanied by twisting or warping of the brass where the pinion was pressed in to it. This may be due to a manufacturing defect, with the smaller gear not properly pressed into the larger, but I suspect that gear misalignment due to the plastic case failing and letting the intermediate shaft wander out of position may contribute to the failure. Oddly enough, the gears which have failed this way still work if I manually press the loose pinion back into the main gear - the connection between them is not stripped, just not held together anymore.

I don’t intend to change the gears of these servos, they seem to be the one redeeming factor in an otherwise very cheaply made servo. Even if these turn out to strip as often as those in the HiTec servos after I’ve rebuilt the rest of the servo, an entire new MG995 is cheaper than just a replacement gear set for a Hitec HS-5645MG.

Our list of modifications is shaping up as follows:

New controller board with bidirectional serial data control and a better-tuned position feedback loop. Ideally, incorporating temperature and current sensing as well, and able to send telemetry back to the main control system.

Noncontact magnetic position sensing. Ideally, the magnetic position sensor would be mounted directly to the main PCB, provided this can be made to fit in the available space.

Structural improvements. The upper case needs to be stronger, both in the mounting tabs and the locating wells for the intermediate shafts. It is to be determined how I will do this.

You may look at this list of issues and ask why I’m bothering trying to work with these cheap little pieces of junk. To which I will repeat: $10 metal-gear ball-bearing digital servo with impressive speed and torque. The question to be determined is if I can make a reliable servo out of these and still have spend less than I would on a higher-end servo.