Hacking a Hitec HS-311 servo for position feedback

Category : Hardware · by Jun 7th, 2016

How does a servo work?

Mechanically, servos are pretty basic bits of kit. They contain a potentiometer, a DC motor and a control board. The DC motor and potentiometer are connected via a bunch of gears. As the DC motor rotates, the resistance of the potentiometer changes. The control board can determine the orientation of the shaft by reading the resistance of the potentiometer. To control the position of a servo, a PWM (pulse width modulation) signal is sent to the control board with the new position. The control board can then power the DC motor to rotate the shaft to the correct orientation.

Positional Feedback?

This is great. But what if we want to be able to read the position from the servo? If everything is working properly. We can send a new position signal to the servo and know what the position is likely to be within a fraction of a second. This is how the Arduino Servo.read() function works. It returns the last angle sent to the servo. However, to get more accurate positional feedback we need to read directly from the potentiometer within the servo.

The Servo

For this example we are using the Hitec HS-311 servo. The same principle should work for other makes and models. To begin we need to remove the four screws on the bottom of the servo. This will give us access to the PCB underneath. These screws also secure the gear housing on top of the servo. Be careful to keep the covering attached so that the gears don’t fall out.

HS-311 Remove Screws

Remove the four screws.

HS-311 PCB

PCB

We can now try to determine where the potentiometer wiper pin is connected to the PCB. Attach the stepper to an Arduino and load up the servo sweep sample code. Attach the black wire to the GND pin, the red to 5V and the yellow wire to pin 9. This code constantly rotates the servo between it’s two end points.

HS-311 Arduino

Attach to Arduino for Sweep sample

Once you have the sweep code up and running and the servo is rotating as it should, grab a multi-meter. We need to probe the pins on the PCB to find the wiper pin from the potentiometer. The voltage across the correct pin should rise and fall as the servo rotates.

Find the wiper pin

Find the wiper pin

Once the pin has been found, tin up a new wire and solder it into place. Be careful if the pin is close to surface mount components. Before proceeding, re-check the voltage at the end of the wire to make sure your solder join is sufficient.

HS-311 Soldered

Solder on new wire

 Now we need a route for the wire to get through the housing. Take a craft knife and notch out a hole in the housing, next to the existing wires. I found it helpful to also notch a hole out in the cover. Do a test fit and make sure the cover fits over the new wire before screwing it back up.

Notch out a hole for the new wire.

Notch out a hole for the new wire.

HS-311 Test fit

Test fit with new wire

That’s all there is to it hardware-wise. If you are using an Arduino or similar micro controller to read the position it would be worth putting a voltage divider together to increase voltage range. I will be using a oscilloscope to measure the voltage directly.

SHARE :

Leave a Reply