Servos
GrendelT
Posts: 23
This is my first stab at a microcontroller. I have a general understanding of basic electric circuits, I'm confused (I guess the book just glosses over it) about how the Servo actually works. I'm confused about the "pulse" given to the servo.
So far, my understanding is that the servos needs 9V (Vin) to drive the motor, and listens for 5V (pin-output) to begin movement.
My problem is, how does the servo know which direction to turn in relation to its current position?
I understand it is listening for pulses, and these pulses convery information to the server driver... The book, WAM, doesn't explain this information... Can someone here explain this?
(I've been playing with the servo setup in Chap.4, thanks for any help...)
So far, my understanding is that the servos needs 9V (Vin) to drive the motor, and listens for 5V (pin-output) to begin movement.
My problem is, how does the servo know which direction to turn in relation to its current position?
I understand it is listening for pulses, and these pulses convery information to the server driver... The book, WAM, doesn't explain this information... Can someone here explain this?
(I've been playing with the servo setup in Chap.4, thanks for any help...)
Comments
First the standard type, inside the servo is a motor, control circuitry, gears and a potentiometer (variable resistor). The motor turns the gears which in turn rotates the potentiometer (and also turns the servo horn which is what you see on the outside). When the servo recieves a pulse, it compares the width of that pulse with the position of the servo horn by way of the potentiometer. If the two are the same, the servo is in the correct position and no movement occurs. If the two are different, the motor turns in the direction indicated by the difference between the pulse width and the current position until the two are the same.
The width of the pulse indicates the desired final position of the servo, the pulse can vary in width from 1ms to 2ms. A pulse of 1.5ms is called a center pulse and indicates the servo should be halfway between the two extremes (normally 180 degrees or half a full rotation). A pulse width of 1ms would direct the servo to turn to one extreme, a pulse width of 2ms would direct the servo to turn to the other extreme. It follws that a pulse width of 1.25ms would direct the servo to turn halfway between the 1ms extreme and the center position, and a pulse width of 1.75 would direct the servo to turn to halfway between the center and the other extreme. Any other value would direct the servo to turn to the equivalent position proportional to that pulse width.
A continuous rotation servo is a standard servo whose feedback potentiometer has been cut and replaced with fixed resistors whose values make the control circuitry·think the servo it is always in the center position. So any pulse width less than 1.5ms will make the servo spin in one direction, and any pulse width greater than 1.5ms will make the servo spin in the other direction. The servo will continue to spin as long as the pulse width continues to be outside a small window around 1.5ms, the servo will stop when the pulse becomes 1.5ms wide.
The servo pulse occurs once every 20ms.
I hope this clears things up for you, ask if your still confused on any part.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
·
Post Edited (GrendelT) : 1/11/2006 4:56:44 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
Problem: Servo behaves irratically. Sometimes it moves step, step, step, step, but then it goes crazy. Step, step, dies. (Long wait) Step, craziness etc.
I'm using
- PIC16F877
- Parallax continuous servo
- Coding in assembly (with MPLab)
- 5 V on everything (except the microcontroller)
Could it be a faulty servo? Umm, I was new with servos, so I tapped the signal wire to power (5 V), to see what would happen. Could that have killed it? I also turned the servo by hand. Could that damage the unit?
Thanks in advance!
Initialize
For inifinity
For 4 times
Pulse servo for 1.25 ms
Wait 18 ms
Pause for a second
For 4 times
Pulse servo for 1.75 ms
Wait 18 ms
Pause for a second
Repeat
· So, servo motors have only one speed then?
·· You should start your own thread and not hijack this one.· Since you are not using a BASIC Stamp or other Parallax Product you should post it in the Sandbox Forum.· Thank you.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Not necessarily, some servos sense how much error there is between the input pulses
and the potentiometer position and ramp the output to the servo motor accordingly. More
error equals faster servo motor ; Less error equals slower servo motor.
As with some continuous rotation servos, the speed can be affected by sending an input
pulse slightly higher or slightly lower than a center position pulse (usually 1.5mS).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
for use in a situation like this:
- ask servo its position
- add/subtract small position adjustment according to data
- send new position adjustment, either up/down
Still learning here, but I just made 2 photoresistor RC circuits, test the two, turn the servo either left or right depending on which "eye" is brighter.
I'd like to have it turn the servo very slowly so it can track a light source...
You can not poll an ordinary analog servos, but I understand you can with some of the newer, digital servos which have a small microprocessor on board. You can certainly save the values from the last PULSOUT command, so from that point of view, you WILL know the current position, or at least the last place you told it to go.
Regards,
Bruce Bates
Do the Parallax/Futaba continuous servos have "proportional control"?· [noparse][[/noparse]There's no mention of this in the data/pdf. ]
·
You are correct about the documentation. The doc on the servo page provides only the basic specs and sample code to test the servo.
·
We have detailed information on how to control the servos in the Robotics with the Boe-Bot book. You can find the free download here (at the bottom of the page):
http://www.parallax.com/detail.asp?product_id=28125
·
Chapter 2 is a thorough introduction. Depending on your experience with electronics and the BASIC Stamp you will be able to skip some of the activities as mentioned in the chapter introduction.
·
Then, Chapter 3 goes even into more detail building the Transfer Curve for your Parallax continuous rotation servo (you can skip the activities about building the robot).
·
After going through that information you will be able to fully control your servo speed and direction with just using a pulse width generated by your BASIC Stamp. ·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Aristides Alvarez
Education and Technical Support Manager
aalvarez@parallax.com
Parallax, Inc. www.parallax.com