Servos are small motors that can rotate 180 degrees and whose position can be controlled. Some types of Servos can also rotate continuously. However, normal servos can be hacked to rotate 360 degrees. They are built with a small DC motor, a potentiometer and some control circuitry. The rotation of the motor changes the position of the potentiometer which acts as feedback for the control board to know the exact position of the servo. This behavior is very useful for some applications, but not so much for others where we don’t care about the current position of the servo but want to perform full rotations (like rotating the wheels of a robot). In this tutorial we’re going to hack a Futaba s3003 servo, connect it to an Arduino and write some code to move it forward, backwards and stop it.
There are two modifications we need to perform on the servo:
- Substitution of the potentiometer with two equal fixed resistances.
- Removal of the physical stop in one of the plastic gears.
By substituting the potentiometer with fixed resistances, we make the servo think it is always in the same position (somewhere between 0 and 180 degrees). For example, if your potentiometer was 5kΩ, two 2.5kΩ resistances would make the servo think it is in the middle position (90 degrees). Don’t worry too much about the resistance as it can be somewhere between 2kΩ and 3kΩ. We will later figure out the position at which it is fixed.
1 - Open the bottom lid by removing the 4 long screws. 2 - Remove the top lid. You will see some plastic gears. 3 - Gently push out the circuit board. 4 - Find two resistances of around 2.2kΩ and join two of the ends together. 5 - Using a soldering iron, remove the potentiometer from the board. Insert the resistances in the holes, inserting the joint ends where the middle leg of the potentiometer was. 6 - Remove the physical stop from the plastic gear using a knive. 7 - Put it all back together.
Time to write some Arduino code, it has great support for controlling servos. Open the Arduino IDE and upload the following snippet to your Arduino board.
Wire the servo to your Arduino following this table, and power it up.
If the servo modification was successful, it should rotate 3 seconds in one direction and 3 seconds in the opposite direction. Finally, we have to find which value will make the servo stop. For this, we have to try passing values to
myservo.write() and waching the direction of the servo. The value will be somewhere between 80 and 100. Depending if your value is bigger or smaller than the “stop value”, the servo will rotate in one direction or the other. Happy hacking!