Saturday, August 4, 2012

Multiplexing RC Channels with Arduino

Creative Commons License
RCArduinoChannels by DuaneB is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

RC Transmitters multiplex as many as 9 channels onto a single radio signal. Your RC Receiver decodes this single signal to obtain the individual channel signals for your servos and electronic speed controllers.

If we reverse part of this process we can read all of the incoming channels using just two Arduino Pins.

Not only does this keep our pins free for more important tasks within our projects, but it is also more efficient to read them this way, we simply need to count the pulses to know which channel we are looking at.

This is a technique I have been using in the development of the RCArduino library.

The library uses just two interrupt pins to read as many as six RC Channels. The library is also able to generate upto six RC Channel outputs in its current form. I will soon be adding the capability to drive 9 servos using only 3 Arduino digital pins. 

UPDATE : The library has been reworked so that it now supports three output modes -

1) Generate six outputs using a selected port 
2) Do not generate any outputs, but operate in a mode compatible with the existing servo library and all of the flexibility that it offers - also suitable for working with H-Bridges etc.
3) Serial servos, use less pins and less code to drive more servos - details soon.

So, if you want to be able to do more, with less, with a library that is smaller and faster than the existing general purpose libraries, read on.

The RC Arduino Channel Multiplexer
Some high end receivers offer a 'raw' output, mine don't and yours don't need to either. Instead of modifying the receiver we will simply create a small hardware 'RC Channel multiplexer'. The multiplexer is basically a single diode for each channel.

The key to the multiplexer is that we route all of the even numbered channels 0,2,4 to INT0 (digital pin 2) and all of the odd numbered channels 1,3,5 to INT1 (digital pin 3).

How does it work ?The diodes stop interference between the pulses - if one channel is high and the others are low, the low channels will sink some of the current from the high channel, this would be sufficient to stop the Arduino from detecting the pulse. However adding a diode to each channel prevents any current from the high channel sinking back into the low channels and ensures we can detect all of the channel pulses.

An RC Arduino Channel Multiplexer - 3 Channels into two pins, as simple as that.
Multiplexing the receiver channels into the two Arduino interrupts is as simple as adding a diode to each channel before connecting it to INT0 for 0 and even numbered channels and INT1 for odd numbered channels.

There is an interesting effect where a charge gets trapped between the diodes and the Arduino pins. To overcome this effect a high value resistor can be place between the point where the diodes meet and ground. I am using a 1M resistor. Picture below -.

Schematic - The even half of the channel multiplexer, the odd half is a duplicate but is connected between the odd numbered channels and INT1 (digital pin 3).

The next post in this series will be a conversion of a previous project to use the new library, as always the post will include the full source code of both the library and the project.

Duane B


  1. If the library can control servos, please make sure that it is not just whole degrees. The Servo.h accepts just "int" as a angle.

  2. Hi, Most servo libraries including the Standard Arduino servo library support fine control using the servo.writeMicroseconds function

    Duane B

  3. Would this circuit be able to switch control of servos from rc to arduino?

  4. Hi,
    Most of the code on RCArduino will allow you to operate a project in two modes - Manual and Autonomous.

    The way I usually do this is to have the Arduino connected in between the RC Receiver and the servos/escs and whatever else that makes up your projects.

    The Arduino listens to all of the incoming signals and in manual mode (rc mode) it will pass them straight out to the other devices as if it is not there.

    In autonomous mode, the Arduino still listens to the incoming signals, but instead of outputting them, it runs additional code to read sensors and control the servos/escs etc.

    The benefit of this approach is that you can easily switch back and forth between the two modes while you perfect the autonomous mode.

    Here are some links that are a good starting point -

    Simple two mode project with RC -

    Reading RC Signals intro

    Basics if you need them -

    Duane B

  5. I'm with a high school group and were competing in a autonomous sail boat competition. The thing is we need to drive out our boat manually and then turn it autonomous once out in the water. What are the names of the diodes and resistor you used?

  6. This is not the circuit you need, refer to the links in my previous response, especially this one -

    Reading RC Signals intro

    Also have a look at this video which shows one of my cars using similar code with two modes -

    The first thing you need to do is use the code in the link above to read the channels from your receiver. Once you have that running, you can add some servos and your 90% done.

    Let me know when you have this up and running

    Duane B

  7. Sorry im a bit confused what am I plugging into the arduino physically?

  8. First of all, forget about this post, its an advanced technique that you do not need to use.

    Please post your questions with the background information on this post which is far more relevant to you -

    Start with telling us what it is that you want to control - servos ? ESCs ? anything else ? also what do you intend to use for power in the boat and what model of receiver you are using.

    Duane B

  9. o have a question, im very new in this about arduino and im making a drone uav, so i want to know how to make the sketch paralel to the move of the joystick , i mean if i can make that while im moving the joystick the servo is moving

  10. Hi, If I understand your question just about any project on rcarduino will do what you want - or am I missing something ?

    Duane B