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

Whenever I try to make some robotics project I always needed servos that rotates 180 as well as 360 degree and I had no problem in getting 180 degree rotation servos but getting full rotation servo was always a problem. Although i knew that I can convert the half rotation servo in to full rotation servo, It was not completely satisfactory for me since most tutorials spoke about rotating it in only one direction. But this functionality is there in servo 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.

Servo 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 servo which is compatible with Arduino. In this case I have used a modelcraft servo, but there other servos are also following the same principle. Now  to start doing the modification you need to open the servo. I would recommend using a proper screw driver to open the bottom of the servo.

After you open the servo you will find  a bunch of gear wheels like a tower of hanoi.

After you remove the wheels you will find a motor, PWM controlled and a potentiometer. In oder to make the servo 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 changed in electronic to do the same.

Mechanial part:

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

2

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

Now comes the electronic part, The head of the servo is nothing but a potentiometer which is connected to a PWM controller. The controller gets the position of the servo 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 connection between the PWM controller and the potentiometer and connect a wire to PWM controller and extend it outside the servo and control it via Arduino.

Now im not giving any specific pin in PWM controller, as I tried only this servo and it may vary with other servo, I suggest you to follow the potentiometer pins and test it 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

Leave a Reply

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