Project tutorial
All About Servo Motors and Servo Motor Tester

All About Servo Motors and Servo Motor Tester © CC BY-NC-ND

Servo!!! The motor for Robots

  • 2,326 views
  • 1 comment
  • 8 respects

Components and supplies

Apps and online services

About this project

Hi Before Start Reading. Kindly take a Minute and Subscribe me on YouTube - Click here -> RoboCircuits

Thanks

I needed a servo tester for my workshop, to have at hand whenever I change servo horns or need to see if a servo is dead. I decided to use a 555 timer to do this.

YouTube Video

Driving a servo

This is covered everywhere on the internet, so I’ll be brief. A typical RC servo is controlled by a 50Hz square pulse signal called Pulse Width Modulation (PWM). The high pulse time varies from 1ms to 2ms, where 1ms gives 0 degrees and 2ms gives 90 degrees. This is followed by a low time of 16-18ms.

The servo has a three pin 0.1″ connector with the following pinout:RED – +4.5v to 6.5vBLACK – GroundWHITE/YELLOW – PWM Signal

Implementation

In order to have a low time that is longer than the high time, it it is necessary to put a diode over R2, in a configuration called extended duty cycle astable. Thus, the schematic becomes:

We need to use maths to solve for R1, R2 and C.

With the diode in place, the formula is given as:

The potmeter regulates between 1ms and 2ms for the high pulse, so it follows that 2200 Ohm corresponds to one millisecond. The high pulse should never be under 1ms long, so we need an 2.2kOhm resistor in series with the potmeter. This is the value for R1 in the schematics. When the potmeter is fully on, we have 4.4 kOhm and a 2ms high pulse. Knowing this, we can solve for the capacitor value C:

Since we know that we need 2200 Ohm per millisecond, we can simply say that

Or, if we want to do things the hard way, we insert our capacitor value into the formula to solve for R2:

To verify this, I had a look at the graph in the 555 timer datasheet, knowing now that R1+R2 = 44kOhm.

The graph gives a capacitor of about 0.7uF, so it seems things are correct. Using these values as a starting point, I made the final circuit and did some small adjustments on the component values by watching the output pulses on an oscilloscope. This is my final parts list:

TLC555CP (555 timer)8-pin solder tail DIP (socket)2.2kOhm potmeter (R1_pot)2.2kOhm resistor (R1)33kOhm resistor (R2)500nF capacitor (C)150nF capacitor (C)100nF capacitor (decoupling)47uF capacitor (decoupling)3-way male 0.1″ pin connector (servo connector)

Filling in all values, the schematic now looks as follows:

I tested Fritzing, a simplified electronics layout editor for hobbyists. I still prefer Eagle, but at least it is cool to be able to show the circuit as it would be on a bread board:

Then I created a PCB design for this. and went to jlcpcb.com for ordering my PCBs. I got my PCBs in 6 days and for $2 + 25$(shipping) only. The quality of PCB was awesome.

Then I soldered everything and it looks like this.

So that was it. It worked fine.

Make sure to Subscribe me on YouTube. Click here - RoboCircuits

Thank you for Reading Have a Nice day!!!

Code

Code for Servo MotorC/C++
#include <Servo.h>

Servo myservo;  // create servo object to control a servo

int potpin = 0;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() {
  val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023)
  val = map(val, 0, 1023, 0, 180);     // scale it to use it with the servo (value between 0 and 180)
  myservo.write(val);                  // sets the servo position according to the scaled value
  delay(15);                           // waits for the servo to get there
}

Schematics

Fritzing File For Servo Tester
servo_tester_zQKDVpxBc2.fz

Comments

Similar projects you might like

Controlling of Servo Motor with Arduino and MPU6050

Project tutorial by Hammad Iqbal

  • 4,297 views
  • 3 comments
  • 12 respects

Using Serial Monitor to Control Servo Motor

Project tutorial by Kub_Luk

  • 15,893 views
  • 9 comments
  • 38 respects

Servo Motor Control with Remote

Project showcase by Electronic Clinic

  • 3,804 views
  • 1 comment
  • 19 respects

Obstacles Avoiding Robot With Servo Motor

Project tutorial by Sora JY

  • 12,423 views
  • 3 comments
  • 29 respects
Add projectSign up / Login