Modifying a Servo Motor for Analog Feedback
Lately I’ve been working on an internet connected smart door lock (similar in concept to the August Smart lock sold at Apple Stores, but with more functionality), and in order to keep the number of parts down, I chose to use a servo motor. (I’ll post more about the lock system in a later post…it’s my junior design project.) My reasoning behind a servo motor is that for a relatively low price, you can have a powerful motor with precise, position-based movements. A basic servo motor has three parts: a DC motor, a potentiometer, and a microcontroller. The part I’m particularly interested in is that potentiometer (hereby referred to as a pot). In essence, a pot is a variable resistor. They have three pins, a voltage, a ground, and an output. Generally, servos don’t give you access to the output directly. Rather, it takes the output and runs it to the microcontroller. The microcontroller uses this output to keep track of where the motor is so that users can control its position. However, sometimes it would be really useful to know exactly what position the servo is in without moving it. Very few servos have analog feedback, and even fewer are inexpensive with the amount of torque needed to turn a deadbolt. So, in order to fix this problem, I decided to modify my own servo.
I started with a Tower Pro SG-5010 servo, which has plastic gears and can provide a bit over 6kg-cm of torque (quite a bit more than I need). The image below is my finished product, but if you imagine this motor without the green wire, that’s what it looks like out of the box.
The first step in getting that analog feedback is obviously opening it up. There should be some thin, long screws on the underside of the motor. Just unscrew those and pop the top off.
Underneath the lid, you’ll notice a circuit board and a motor. The motor connects to that board, which has some controller chips onboard. Underneath the board is a standard 3 pin pot. Those pins come through the board and are soldered on the underside.
In order to get the analog feedback I want, I needed to solder on a fourth wire to the servo’s potentiometer. On a standard potentiometer, the center pin is the output. You can easily test which pin is the output by running the servo as usual and reading the voltage on each pin. If the voltage changes linearly with position, you’ve found the right pin. In this case, I found it was, in fact, the center pin. I soldered on the green wire to the center pin and cut a small hole in the casing to feed the wire back out.
Since it is just a voltage coming out of the potentiometer, you’ll need to make sure to read it as an analog input on whatever device you decide to connect it to. I’m using it with an Arduino Uno, so I’ve got it wired up to analog pin A0 in my circuit. Check out below to see a preview of the Arduino portion of my smart lock system.
Soon, I’ll post more about the locking system. Right now I’m thinking about using a Raspberry Pi to communicate with the outside world and this Arduino to control the hardware.