Tutorial: Servo Motor Control
Servo Motor Theory
Hi-Tec Servo Motors have three wires coming out of them.
The power & ground wires are hooked directly up to whatever battery or power supply you are using to power the servos. The Signal wire will be hooked up to the microcontroller used to control the servo, in our case the PIC. A noticeable first impression, the servo only requires 1 pin from the pic.
The PWM Signal
The signal that we need to create inorder to control the servos is called a Pulse With Modulation signal or PWM for short. The general requirements are:
Frequency: 50Hz
Up-time: 0.9mS->2.1mS
Down-time: 19.1mS-17.9mS
At first glance these definitions & numbers might make little or no sense. So lets look at a simple PWM wave at 50Hz.
So a PWM wave is just a signal that changes between 0 volts & 5 volts (digital logic 0 and 1). We see that the wave is symmetrical; uptime is 10mS & downtime is 10mS which when added together give us the period (10mS + 10mS = 20mS).
Now that we have a feeling for what a PWM signal looks like, lets change the wave to look like a normal servo signal input.
Frequency: 50Hz
Up-time: 1.5mS
Down-time: 18.5mS
The Up-time is what determines the angle the servo motor moves to.
Since standard servos can rotate up to 90°, the different
range of possible up-time values will equal a certain angle.
Here are some examples:
Notice our example was using an up-time of 1.5mS. This would make
the servo rotate to the 45°, stay there and not let anything
move it elsewhere. The next step is learning how to create these
specific PWM waves using the PIC microcontroller.
Hi-Tec Servo Motors have three wires coming out of them.
|
·Red - Power (4.8v-6v) ·Black (Ground) ·Yellow (Signal) |
|
The power & ground wires are hooked directly up to whatever battery or power supply you are using to power the servos. The Signal wire will be hooked up to the microcontroller used to control the servo, in our case the PIC. A noticeable first impression, the servo only requires 1 pin from the pic.
The PWM Signal
The signal that we need to create inorder to control the servos is called a Pulse With Modulation signal or PWM for short. The general requirements are:
Frequency: 50Hz
Up-time: 0.9mS->2.1mS
Down-time: 19.1mS-17.9mS
At first glance these definitions & numbers might make little or no sense. So lets look at a simple PWM wave at 50Hz.
So a PWM wave is just a signal that changes between 0 volts & 5 volts (digital logic 0 and 1). We see that the wave is symmetrical; uptime is 10mS & downtime is 10mS which when added together give us the period (10mS + 10mS = 20mS).
Now that we have a feeling for what a PWM signal looks like, lets change the wave to look like a normal servo signal input.
Frequency: 50Hz
Up-time: 1.5mS
Down-time: 18.5mS
|
Up-Time = 1.0mS Period = 20mS Angle = 0° |
Up-Time = 1.5mS Period = 20mS Angle = 45° |
Up-Time = 2.0mS Period = 20mS Angle = 90° |