Electronics > Electronics

how do servos maintain a certain position?

<< < (2/2)

greywanderer012345:
Just in case you're asking the simpler question of "How do I tell a servo to go to a certain position?"
Here's the simple answer:
- Every 20milliseconds, give a ~1-2 millisecond 5V signal pulse to the signal wire.

A little more detail:
- I say "about(~)" 1-2 ms, but the maximum and minimum depends on the servo, and can be found in the specs.
- The length of the pulse determines the target position. 1ms = -180 , 2ms = +180. (from center)
- Yes, this is PWM.
- Yes, you can use PWM that's built-in to your MCU, Yes, you can program your own pulse
- Don't bother trying to get the built-in PWM working with admin's $50 robot design. It's not set up correctly for it.
- ... don't use admin's code for sending the signal either, as it sends the pulse AND sets the delay IN THE MAIN LOOP, so all of your other code is both slowed down, and interferes with the signal timing.

Navigation

[0] Message Index

[*] Previous page

Go to full version