1000 steps Servo motor

1000 steps Servo motor

In many project like CNC machines people use stepper motors. They are probably always more expensive than servos. They can rotate 360°, 1 step = 1,8° (mostly). Servos can rotate only from 0° to 180°, 1 step = 1°. But why are they working this way, inside them we will find potentiometer which rotates as servo (up to 180°), but have 1024 steps.

I’ve started to think about it.
Step 1: What I have used
Picture of What I have used

Parts that I’ve used to make a prototype version:

Servo (normal, you can also use microservo),
Arduino and USB cable,
H-bridge (I have L293D, any other will work too),
100nF capitator (optonal, symbol: 104),
Soldering iron and small screwdriver.

Firstly, let’s prepare servo:

Open it and remove the electronics. Leave the potentiometer and DC motor. If your engine don’t have capitator I prefer to solder one to it, that is not needed, but with capitator your motor will have more power.

Than solder the wires to engine and potentiometer, so you can put them into breadbord.
Step 2: Breadbord circuit
Picture of Breadbord circuit

Build a circuit like you see in the picture. If you have different H-bridge than I have used you should find how to connect it.


Analog pin 1 checks the potentiometer,
Digital pins 2 and 4 sets the direction of rotation,
Digital pin 3 set motor speed (PWM, symbol on Arduino board: ~ ),
+5V and GND powering engine and potentiometer (WARNING: in microservo 5V could damage motor).

Step 3: Program
Picture of Program

// 1000 steps Servo by TheSuperSewcio

#define pos 500 //servo position, use 10 – 1010,
int distance; //potentiometer may have trouble with values > 1010 or < 10

void setup() {
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);

void loop() {
distance = analogRead(1) – pos;
if(distance < 0){
distance = -distance;
if(distance == 0){
digitalWrite(3, LOW);
}else{if(distance < 100){ //reduces speed 100 steps before target
analogWrite(3, distance + 50); //minimum speed: 50
digitalWrite(3, HIGH);
if(analogRead(1) > pos){
digitalWrite(4, LOW); //set direction of rotation
digitalWrite(2, HIGH);
}else{if(analogRead(1) == pos){
digitalWrite(2, LOW); //stops motor
digitalWrite(4, LOW);
digitalWrite(2, LOW);
digitalWrite(4, HIGH);

Your servo may be different from my, if for some reason something isn’t working try to change values in lines 21 and 22.

As you can see here, servo position is sometimes exactly 500, sometimes 499 – 501. It depends on servo gearbox and potentiometer quality.

For More Details: 1000 steps Servo motor

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us: