Editing Servo control

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
 
== overview ==
 
 
  dial-------|
 
            [ encoder ]-+-(rc ppm)->-[RF modulator]--antenna
 
  joystick---|          |
 
    +-------|          +-(rc ppm)->-[buddy box connector]
 
 
 
    antenna--[RF demodulator]->-(rc ppm)->-[decoder]
 
                                                  |-(rc pwm)->-servo1
 
                                                  |-(rc pwm)->-servo2
 
                                                  |-(rc pwm)->-servo3
 
                                                  |-(rc pwm)->-servo4
 
 
== details ==
 
 
 
Many (perhaps most) radio control transmitters multiplex all the "RC PWM" channels into a single physical wire, using a system called "RC PPM" (radio-control pulse position modulation).
 
Many (perhaps most) radio control transmitters multiplex all the "RC PWM" channels into a single physical wire, using a system called "RC PPM" (radio-control pulse position modulation).
 
[http://www.futaba-rc.com/faq/faq-pcm1024.html] [http://books.google.com/books?id=EcbjKvhgPLsC&q=pulse%20position%20modulation] [http://www.hobbytronics.co.uk/decode-rc-control-ppm] [http://books.google.com/books?id=EWZumms67AUC&q=pulse%20position%20modulation] [http://pages.cs.wisc.edu/~bolo/rc/radio_types.html] [http://adamone.rchomepage.com/guide1.htm] [http://www.495thsquadron.org/PDF_Files/UnderstandingRC.pdf]
 
[http://www.futaba-rc.com/faq/faq-pcm1024.html] [http://books.google.com/books?id=EcbjKvhgPLsC&q=pulse%20position%20modulation] [http://www.hobbytronics.co.uk/decode-rc-control-ppm] [http://books.google.com/books?id=EWZumms67AUC&q=pulse%20position%20modulation] [http://pages.cs.wisc.edu/~bolo/rc/radio_types.html] [http://adamone.rchomepage.com/guide1.htm] [http://www.495thsquadron.org/PDF_Files/UnderstandingRC.pdf]
  
 
Often this "PPM" signal is transferred from the a student's RC transmitter through the buddy box wire to the teacher's RC transmitter.
 
Often this "PPM" signal is transferred from the a student's RC transmitter through the buddy box wire to the teacher's RC transmitter.
(see [http://thomaspfeifer.net/ppm2usb_adapter_en.htm "PPM2USB - RC PPM to USB-Adapter"] and
 
[http://www.mftech.de/buchsen_en.htm "R/C buddy box plugs/ pin assignment"]
 
for a variety of "standard" connectors for this buddy box wire).
 
  
 
The "combined signal" -- the "RC PPM signal" -- looks something like this
 
The "combined signal" -- the "RC PPM signal" -- looks something like this
 
(based on diagram from Richard J. Prinz[http://www.min.at/prinz/?x=entry:entry130320-204119]):
 
(based on diagram from Richard J. Prinz[http://www.min.at/prinz/?x=entry:entry130320-204119]):
 
[http://blog.ncode.ca/?tag=remote-control] [http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=75692&start=0] [http://users.belgacom.net/TX2TX/tx2tx/english/tx2txgb1.htm] [http://rcarduino.blogspot.com/2012/11/how-to-read-rc-receiver-ppm-stream.html] [http://www.rcgroups.com/forums/showthread.php?t=1654104&page=2]
 
[http://blog.ncode.ca/?tag=remote-control] [http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=75692&start=0] [http://users.belgacom.net/TX2TX/tx2tx/english/tx2txgb1.htm] [http://rcarduino.blogspot.com/2012/11/how-to-read-rc-receiver-ppm-stream.html] [http://www.rcgroups.com/forums/showthread.php?t=1654104&page=2]
[http://sarconastic.tripod.com/servodriver.html]
 
[http://www.endurance-rc.com/ppmtut.php]
 
[http://www.mftech.de/ppm_en.htm]
 
 
    "RC PPM signal"
 
  
 
     Sync    1      2    3    4        5    6    7  8  Sync...
 
     Sync    1      2    3    4        5    6    7  8  Sync...
Line 43: Line 18:
 
     * - low separator pulse, always 0.5 ms
 
     * - low separator pulse, always 0.5 ms
 
     1..8 - high "RC PWM pulse" for channels 1..8      0.5 – 1.5 ms
 
     1..8 - high "RC PWM pulse" for channels 1..8      0.5 – 1.5 ms
 
Is decoded to:
 
 
        "RC PWM signal"
 
                    2
 
                +--------+
 
                |        |
 
                |        |
 
                |        |
 
        ---------+        +-------------------------------------...
 
                            3
 
                          +---+
 
                          |  |
 
                          |  |
 
                          |  |
 
        ------------------+  +--------------------------------...
 
    2: - high "RC PWM pulse" as sent to servo 2.      1.0 – 2.0 ms
 
    3: - high "RC PWM pulse" as sent to servo 3.      1.0 – 2.0 ms
 
    etc. for all 8 channels.
 
 
''(FIXME: tweak illustrations to show at least 2 complete cycles?)''
 
 
  
 
The long "sync pulse" between frames is typically at least 5 ms long.
 
The long "sync pulse" between frames is typically at least 5 ms long.
 
All the other pulses are no more than 2 ms long.
 
All the other pulses are no more than 2 ms long.
 
Most transmitters have a fixed frame rate somewhere in the range of 40 Hz to 200 Hz.
 
Most transmitters have a fixed frame rate somewhere in the range of 40 Hz to 200 Hz.
 
While most servos use 1.5 ms as the neutral centered position,
 
some servos have a wider range and require 0.5 to go all the way counterclockwise, and 2.5 ms to go all the way clockwise.
 
  
 
When the pilot moves the positions of the joysticks on the transmitter,
 
When the pilot moves the positions of the joysticks on the transmitter,
Line 79: Line 29:
  
 
The corresponding radio control receiver decodes the radio signal to a RC PPM signal on a single physical wire.
 
The corresponding radio control receiver decodes the radio signal to a RC PPM signal on a single physical wire.
 
 
Often the receiver includes either a 4017 decade counter[http://en.wikipedia.org/wiki/4000_series#4017_decade_counter] or a 4015 shift register --
 
Often the receiver includes either a 4017 decade counter[http://en.wikipedia.org/wiki/4000_series#4017_decade_counter] or a 4015 shift register --
 
that chip decodes the RC PPM signal at its CLK input into to several independent "RC PWM" outputs. The various RC servos[http://en.wikipedia.org/wiki/servo_(radio_control)] are connected to those outputs with standard 3-pin connectors with 0.1" spacing.
 
that chip decodes the RC PPM signal at its CLK input into to several independent "RC PWM" outputs. The various RC servos[http://en.wikipedia.org/wiki/servo_(radio_control)] are connected to those outputs with standard 3-pin connectors with 0.1" spacing.
Line 87: Line 36:
  
 
(The standardized "RC PWM" works differently enough from the PWM used to control DC motor speeds that some people say that RC PWM signals "are not really PWM signals"
 
(The standardized "RC PWM" works differently enough from the PWM used to control DC motor speeds that some people say that RC PWM signals "are not really PWM signals"
[http://www.microchip.com/forums/m450082.aspx] [http://www.technobots.co.uk/discus/messages/7/387.html?1225050483] [http://www.rcgroups.com/forums/showthread.php?t=1318288] [http://www.cmucam.org/boards/8/topics/2877?r=2882#message-2882] [http://www.pololu.com/blog/16/electrical-characteristics-of-servos-and-introduction-to-the-servo-control-interface].
+
[http://www.microchip.com/forums/m450082.aspx] [http://www.technobots.co.uk/discus/messages/7/387.html?1225050483] [http://www.rcgroups.com/forums/showthread.php?t=1318288] [http://www.cmucam.org/boards/8/topics/2877?r=2882#message-2882] [http://www.pololu.com/blog/16/electrical-characteristics-of-servos-and-introduction-to-the-servo-control-interface]. Alas,
[http://forum.arduino.cc/index.php/topic,5701.0.html]
 
Alas,
 
 
none of those people give any suggestions as to what we *should* call these signals, so I call them "RC PWM signals" for lack of a better name.
 
none of those people give any suggestions as to what we *should* call these signals, so I call them "RC PWM signals" for lack of a better name.
 
Perhaps I should call them "RC control signals"[http://www.mitchr.me/SS/batteriesRequired/RCcontrolTheory/] ?).
 
Perhaps I should call them "RC control signals"[http://www.mitchr.me/SS/batteriesRequired/RCcontrolTheory/] ?).
 
 
"I have been campaigning for years on this forum to avoid calling the servo pulses PWM because analogWrite is the way Arduino produces PWM and driving a servo using Arduino analogWrite can destroy servos. ... Avoiding references to PWM controlling servos should help reduce confusion with the output from analogWrite, so I will continue to evangelize the use of PPM to refer to servo signals." --
 
mem[http://forum.arduino.cc/index.php?topic=14146.msg104470#msg104470]
 
[http://forum.arduino.cc/index.php/topic,5701.0.html]
 
  
 
If two transmitters are transmitting at the same time, then yes, there will be an overlap of pulses.
 
If two transmitters are transmitting at the same time, then yes, there will be an overlap of pulses.
Line 137: Line 79:
 
etc.
 
etc.
 
[http://electronics.stackexchange.com/questions/82387/how-can-i-understand-a-servo-well-enough-to-build-one]
 
[http://electronics.stackexchange.com/questions/82387/how-can-i-understand-a-servo-well-enough-to-build-one]
[http://www.seattlerobotics.org/encoder/200009/Servos.html]
 
 
== continuous rotation servos ==
 
 
''(say a few words here about servos modified for continuous rotation)''
 
 
Martin Locker.
 
[http://robotika.cz/articles/servo-encoder/en "Servo-encoder: odometry sensor for a simple robot"].
 
2006.
 
 
 
== I have an Arduino, and I want to see these servos turn ==
 
 
Have you tried the [http://arduino.cc/en/Reference/ServoWrite servo.write(angle)] command?
 
 
The [http://arduino.cc/en/Tutorial/Sweep Sweep tutorial]
 
shows how to use servo.write(angle) -- part of the [http://arduino.cc/en/Reference/Servo Servo library].
 
(formerly called the MegaServo library[http://playground.arduino.cc/Code/MegaServo] ).
 
 
"driving a servo using Arduino analogWrite can destroy servos." --
 
mem[http://forum.arduino.cc/index.php/topic,5701.0.html][http://forum.arduino.cc/index.php?topic=14146.msg104470#msg104470]
 
 
 
  
related:
 
 
* Tom Igoe. "Servo motor control with an Arduino". 2014.[https://itp.nyu.edu/physcomp/labs/labs-arduino-digital-and-analog/servo-motor-control-with-an-arduino/]
 
* "ServoTimer2 - drives up to 8 servos"[http://forum.arduino.cc/index.php/topic,21975.0.html]
 
* "Help with PWM for controlling servos and electronic speed controllers (ESCs)"[http://forum.arduino.cc/index.php/topic,5701.0.html] lists many different libraries designed to drive servos, each with a few features the other one doesn't have.
 
* "How does a servo work (PWM or PPM)?"[http://forum.arduino.cc/index.php/topic,14146.0.html]
 
 
If you want to control more than a few servos,
 
it's often easier to generate something like a full "RC PPM signal" on one Arduino pin and use a separate cheap chip to separate it into individual "RC PWM signals":
 
 
* ... ''(FIXME: write up some more details on controlling multiple servos with a single Arduino pin, or link to some other page with those details)'' ...
 
 
 
''(Is there a better page elsewhere on OpenCircuits for General Arduino PWM?)''
 
 
General Arduino PWM:
 
 
* Ken Shirriff."Secrets of Arduino PWM".[http://www.righto.com/2009/07/secrets-of-arduino-pwm.html] lists many different ways to persuade an Arduino to produce PWM. Any one of them could be used for generating a "RC PWM" signal; a few of them could be used to generate the "RC PPM" signal.
 
 
(
 
The "LED PWM" used to make LEDs appear to dim and brighten, and set a variety of colors with RGB LEDs,
 
has some significant differences from the "RC PWM" used to make servos move.
 
But is there some way we could adapt such libraries to drive servos?:
 
"ShiftPWM: the easiest software PWM library for Arduino. Control many PWM outputs with only 3 Arduino pins."
 
[http://www.elcojacobs.com/shiftpwm/]
 
[https://web.archive.org/web/20140528141917/http://www.elcojacobs.com/shiftpwm/]
 
[https://github.com/elcojacobs/ShiftPWM]
 
[http://arduino.cc/forum/index.php/topic,66988.msg887412.html]
 
)
 
 
== I have a RC receiver, and I want to connect one of its outputs to an Arduino ==
 
 
Have you tried the
 
[http://www.arduino.cc/en/Reference/pulseIn pulseIn()] command?
 
 
Related:
 
* "Read PWM Signal from a RC-Receiver"[http://forum.arduino.cc/index.php/topic,20286.0.html].
 
* "3 axis auto stabilized platform"[http://forum.arduino.cc/index.php/topic,42462.0.html]
 
* "Reading PWM signals from a remote control receiver with Arduino"[http://www.camelsoftware.com/firetail/blog/radio/reading-pwm-signals-from-a-remote-control-receiver-with-arduino/]
 
* "Reading servo PWM with an Arduino"[http://www.cheapscience.com/2010/01/reading-servo-pwm-with-an-arduino.html]
 
* "Read PWM value of a RC rx with an arduino"[http://letsmakerobots.com/content/read-pwm-value-rc-rx-arduino]
 
* "How to read PWM from Rx with Arduino UNO?"[http://diydrones.com/forum/topics/how-to-read-pwm-from-rx-with-arduino-uno]
 
* "connecting an RC receiver to your Arduino"[https://www.sparkfun.com/tutorials/348]
 
* "Arduino Demo: PWM Input"[http://www.instructables.com/id/RC-Quadrotor-Helicopter/step12/Arduino-Demo-PWM-Input/]
 
* RCArduino: "How To Read Multiple RC Channels" (has a discussion of "volatile")[http://rcarduino.blogspot.com/2012/04/how-to-read-multiple-rc-channels-draft.html]
 
 
== I have a RC receiver, and I want to connect multiple outputs to an Arduino ==
 
 
If you are trying to listen to *more* than 1 output of the RC radio reciever, it's often easier for the Arduino to decode the PPM signal on a single wire than try to decode multiple "PWM" signals on several wires:
 
 
* Jordi Muñoz. "How to hack the PPM signal from any receiver (Futaba) with Arduino"[http://diydrones.com/profiles/blog/show?id=705844%3ABlogPost%3A38393] via "Intercept PPM signal from any receiver with Arduino"[http://makezine.com/2009/03/11/intercept-ppm-signal-from-any-recei/]
 
* "Decoding Radio Control signal pulses"[http://forum.arduino.cc/index.php/topic,22140.0.html]
 
 
== OpenServo ==
 
  
 
The people at the OpenServo project have developed an [[open hardware]] motor driver circuit that fits inside a typical servomotor case.
 
The people at the OpenServo project have developed an [[open hardware]] motor driver circuit that fits inside a typical servomotor case.
Line 222: Line 87:
 
[http://www.openservo.com/]
 
[http://www.openservo.com/]
  
== Moti ==
 
  
Moti is a smart servo motor that includes an Arduino compatible Atmel AVR microcontroller, full-turn position tracking,
 
and other features not commonly found in a servo.
 
Like OpenServo, Moti supports a daisy chain of servos
 
which simplifies wiring.
 
[https://hackaday.io/project/249-moti-a-smart-servo]
 
[http://moti.ph/]
 
  
 
== Further reading ==
 
== Further reading ==
 
* Jan's article "Servo control interface in detail" has some good o'scope photos showing pulse trains (the "RC PWM signal") going to a single servo, and the current that servo pulls in response.[http://www.pololu.com/blog/17/servo-control-interface-in-detail]
 
  
 
* The original rough draft of this page was inspired by questions about [http://robotics.stackexchange.com/questions/4456/pulse-position-modulation-as-used-in-rc-controls "Pulse Position Modulation as used in RC controls"].
 
* The original rough draft of this page was inspired by questions about [http://robotics.stackexchange.com/questions/4456/pulse-position-modulation-as-used-in-rc-controls "Pulse Position Modulation as used in RC controls"].

Please note that all contributions to OpenCircuits may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see OpenCircuits:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)