Final Project: Fabbable Servo

Table of Contents

servo sketch

Premise and Related Work

My goal for this project is to develop a low-cost, open source programmable servo-controlled actuator that can be easily produced in a fab lab. I believe that this will be of great use to the robotics community and to great numbers of projects that currently put up with the shortcomings of RC hobby servos simply because of their ubiquity and moderate cost.

RC hobby servos are everywhere. They are gearmotors coupled with a position feedback device (a potentiometer) and a proportional controller that takes a PWM signal as a position input. They can be pretty frustrating to work with. The control signaling was designed to work with remote control receivers for model airplanes, back before anyone really knew what a microcontroller was. The signals are unreasonably difficult to generate with a microcontroller, since the signal has a long (~20ms) period, with only a small fraction of the duty cycle (~1ms) being important. That means that an 8-bit PWM peripheral could generate the 20ms signal, but there would be no resolution left to actually specify the position. The alternative is to use a 16-bit timer to generate the signal, but most 8-bit microcontrollers usually only have one 16-bit timer. Using the 16-bit timer limits the number of servos an application can drive to the number of output compare units associated with the timer (two on most ATmega parts) and means that timer can't be used for other things in the application. Generating the signals in software is also possible, but takes up a significant amount of processor time, and interrupts can result in timing jitter (which translates to actual jitter of the servo.)

The result of all of the above shortcomings of hobby servos is a swath of projects that use them with less than desirable results. It may not be difficult to get a basic implementation that's able to move a servo, but most suffer from a lack of resolution and/or severe timing problems that result in twitchy and imprecise motion. Good implementations frustratingly use more processor time to generate the PWM signal than it would take to read the potentiometer directly, run a PID loop on the microcontroller, and drive the motor H-bridge directly.

Furthermore, RC hobby servos typically do not allow continuous rotation. There are well-known and well-documented procedures for removing the physical stops and decoupling the output shaft from the potentiometer to produce what is usually (and inaccurately) called a "continuous-rotation servo." Decoupling the potentiometer breaks the servo loop, so that the proportional controller will keep driving the motor in the direction it needs to go to reach the commanded "position" of the potentiometer, which it will never reach. The result is a continuous rotation motor that can be roughly torque-controlled by a PWM signal, but with no feedback at all.

Finally, a huge shortcoming of the RC servo is the complete lack of position feedback to the microcontroller. The potentiometer is used internally by the proportional controller, and it is assumed that the application will command a position and trust that the servo will get there after some time. Again, hacks exist to expose the output of the potentiometer (by opening the servo and connecting a wire directly to the potentiometer output.)

There are better commercial servomotors available. Robotis's Dynamixel series are similar in construction to hobby servos, upgrading the motor to a nicer Maxon unit, and using all metal gears. They replace the analog proportional controller with an ATmega8 on an RS-485 or nonstandard multitap RS-232 network, replacing the PWM control inputs with digital signaling. They do provide position, torque, and velocity feedback, and allow the user to adjust many of the parameters of the controller. The controller is non-standard, defining regions of varying proportional gains depending on the magnitude of the error. The non-standard controller doesn't seem to perform as well as a well-tuned PID loop, forcing the user to choose between an actuator that reaches its targets but chatters and twitches, or one that is better behaved, but has a spongy compliant region around its target, often never quite reaching its goal.

The Dynamixel actuators are able to rotate continuously, having no mechanical stops. However, since they still use a potentiometer for posititon feedback, they are only able to measure their position over a 300-degree arc (all potentiometers must have some dead zone.) That makes using them as continuous rotation actuators difficult, because the user must dead-reckon the position of the shaft as it passes through the dead zone. Even worse, there are parts of the dead zone where the actuator will report that it is at positions where it is not.

The Dynamixel actuators are also expensive. A basic unit runs about $100, and units capable of more torque are in the $200 range.

OpenServo is an open-source alternative that replaces the proportional controller board in an RC hobby servo, providing a good controller and a digital communication interface. Like the Dynamixel actuators, OpenServo is still limited for continuous rotation applications by the use of potentiometers for position feedback. The replacement controller board is also designed for specific RC servos, and the PCB is designed to be fabricated by commercial etching processes.

Barrett Technologies' Puck is a motor controller and encoder unit that attaches to a motor, providing torque, velocity, and position control and high-resolution position feedback on a CANbus interface. Originally designed for use on their WAM robotic arms, they are high quality controllers but are also very expensive, and are intended to be used with high-quality, very expensive DC brushless motors.

Design

actuator v1

Bill of Materials

Jameco 253471 12V DC 50:1 gearmotor 1 @ $13.45
DigiKey ATTINY45V-10SU-ND ATtiny44 1 @ $1.26
DigiKey ZXMHC3A01T8CT-ND ZXMHC3A01T8 H-bridge 1 @ $2.54
DigiKey NDS355ANCT-ND N-channel MOSFET 2 @ $0.30
DigiKey LM3480IM3-5.0CT-ND 5V voltage regulator 1 @ $0.44
DigiKey 620-1023-1-ND Analog hall effect sensor 2 @ $1.86
Mouser 649-95278-101A04LF 2x2P 100mil header 1 @ $0.54
Digikey 587-1352-1-ND 10 µF capacitor 2 @ $0.21
Digikey 399-4674-1-ND 100 nF capacitor 1 @ $0.13
Digikey 311-0.0ERCT-ND 0 Ω resistor 2 @ $0.02
Digikey 311-10.0KFRCT-ND 10 kΩ resistor 2 @ $0.02
Digikey 311-10.0KFRCT-ND 10 kΩ resistor 4 @ $0.02
Digikey 311-49.9KFRCT-ND 49.9 kΩ resistor 2 @ $0.02
Encoder magnet 1 @ $1.00
8mm spacers 2
Nylon washers 3

Total cost: $24.20

All parts, except for the encoder magnet, are from the fab lab inventory.

Board & Schematics

schematic

layout

Position Feedback

hall effect output

Return to Index