How to convert/modify a Servo Motor for Continuous Rotation in both direction using Arduino

This article is a tiny hack to modify Servo motors from 180 to 360 degrees rotation.

Whenever I try to make some robotics project I always needed servo motors that rotates 180 as well as 360 degree and I had no problem in getting 180 degree rotation ones. But getting full rotation servo motors was always a problem. Although I knew that I can convert the half rotation ones into full rotation. It was not completely satisfactory for me since most tutorials spoke about rotating it in only one direction. But this functionality is there in this motor, so I tried to get this work. I have video blogged it in detail and you can find the video at the bottom of the blog.

Hardware Required:

The below link are part of my affiliate program

Motor:

https://www.banggood.com/TowerPro-SG90-Mini-Gear-Micro-Servo-9g-For-RC-Airplane-Helicopter-p-1009914.html?p=W214159476515201703B

A Screwdriver-Set(if necessary)

https://www.banggood.com/16Pcs-Precision-Mini-Hex-Screwdriver-Set-Electronic-Micro-Hobby-Jeweler-Watch-Repair-Tool-p-1143298.html?p=W214159476515201703B

You can choose any 9g micro motor which is compatible with Arduino. In this case I have used a modelcraft motor, but there are others that also follow the same principle. Now to start doing the modification you need to open it. I would recommend using a proper screw driver to open the bottom part of it.

After you open it, you will find  a bunch of gear wheels like a tower of hanoi.

Once you remove the wheels you will find a motor, PWM controller and a potentiometer. In order to make the motor rotate continuously we need to do two things, firstly remove the mechanical barrier which stops the motor from rotating beyond the 180 degree and the next is to make changes in the electronics part to do the same.

Mechanial part:

1. The top most gear which acts as the head of the motor has a small barrier which needs to be removed.

2. Now lets remove the barrier of the potentiometer. In most servo motors the potentiometer will come out of the casing, but if in case its fixed then remove while its fixed.

 

Electronics part:

The head of the servo is nothing but a potentiometer which is connected to a PWM controller. The controller gets it’s position by reading the potentiometer. For example, zero resistance means left and maximum resistance means right. We will make use of that to tell the PWM controller to turn right or left by controlling this via GPIO pin. So we remove the connections between the PWM controller and the potentiometer. We connect a wire to PWM controller and extend it outside the motor and control it via Arduino.

Now I am not giving any specific pin in PWM controller, as I tried only this servo. So it may vary with other motors. I suggest to follow the potentiometer pins and test them before closing it back.

 

Now lets try to connect the servo with Arduino and code.

 

CODE


#include <Servo.h>

Servo myservo; // create servo object to control a servo
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
pinMode(5, OUTPUT);
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}

// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
if( sensorValue > 525 )
{
digitalWrite(5, HIGH);
myservo.write(180); // sets the servo position according to the scaled value
}
else if ( sensorValue < 500 )
{
digitalWrite(5, LOW);
myservo.write(180); // sets the servo position according to the scaled value
}

myservo.write(180); // sets the servo position according to the scaled value
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}

VIDEO

One thought on “How to convert/modify a Servo Motor for Continuous Rotation in both direction using Arduino

  • April 17, 2019 at 7:06 am
    Permalink

    can we control the motion of the servo if we do this that is can we give the exact angle how much the servo can rotate

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *