RC Receiver Interface

There are numerous RC Receiver interfacing techniques published on the web.  My quadcopter design is using only one processor for all its computation.  For this reason, I spent extra time designing the interfaces to be as efficient as possible.  Even though RC Receiver interfaces aren’t super complicated, they can cause real-time scheduling issues because of the number of interrupts and the time spent inside these interrupt routines.

Typical RC Receivers output the channel values in a given sequence of pulse width modulated (PWM) signals.  The transmitters and receivers I have tested are Spektrum made.  All Spektrum models seem to have the same design style.  After a small bit of testing, I found that the several channels of signals are output in the same order everytime and have a small time separation.  Since the standard for RC PWM is 50Hz, each pulse comes every 20 milliseconds.  The top 5 lines of the picture above show an example output of a 5 channel Spektrum made receiver.

In a microcontroller, the most accurate way to measure incoming pulses is to use an input capture with a timer.  Measurement occurs when a free running timer value is latched into a register when an event occurs.  Obviously, a higher frequency timer yields a more precise pulse measuring system.  Since most microcontrollers only have a few input capture pins, some special circuitry must be used to measure several pulses.  Since the Spektrum systems do not overlap their output pulses, a simple OR gate structure can be used to combine all the signals into one signal.

Since my quadcopter will be using the Spektrum DX5e and AR500, I’m using a quad 2-input OR gate IC (MC14071BCP), to create this combined signal.  As shown in the timing diagram at the top, there are still 2 voltage transistions per pulse.  This results in 10 interrupts for this design style.  For synchronization purposes, there is always a time between the last pulse and the beginning of the first pulse that is longer than the longest possible pulse.  To capture the values sent by the transmitter, the software is setup for an interrupt to occur on every transition of the signal.  All of the interrupts, except the last one, have a very small amount of time to process.  The last interrupt copies out the five pulse width values and triggers an availability flag so that the rest of the software can have access to it.

An interesting thing that I noticed while testing is that Spektrum has a constant delay of 60 microseconds between each pulse.  To make the system even more efficient, turning off the falling edge interrupts for the first four pulses then back on for the last interrupt results in 4 less interrupts.  For the first 4 pulse width values, 60 microseconds would just be subtracted off.

For my system, this OR gate structure serves another purpose.  The AR500 receiver runs on 5 volts, however, the microcontroller (LPC1768) runs on 3.3 volts.  Of course there are many ways for converting one to another but the MC14071BCP IC has a wide voltage range and is tolerant to 5 volt inputs when running at 3.3 volts.  Without extra circuitry, it will convert the five 5 volt signals from the AR500 into one 3.3 volt signal that represents all five channels.

In conclusion, I’ve found that using a simple OR gate IC is very efficient for pin usage, timer utilization, voltage translation, and interrupt time efficiency.


I implemented this RC receiver interface on the LPC1768 connected to a AR500.  My results are accurate to about 60-70ns.  This leads me to believe that the AR500 is running on the typical ATmega8 (or 168 or 328) microcontroller running at 16MHz (1/16MHz = 62.5 ns).


Due to popular request, here is the code I used on the LPC1768 (right-click download, then change the “.pdf” extension to “.zip”):

    • Bryan
    • October 1st, 2011

    can you please email me the c code you used to get this to work? my email is bryan3r3@live.com

    thank you

    • Sure! The code should be in your inbox. Enjoy!

  1. Hello nic,

    You have a great website and i see you are also working on a Quadrocopter. Im also making one but not with an ARM uC but with an Xmega from atmel.

    You said:
    “In conclusion, I’ve found that using a simple OR gate IC is very efficient for pin usage, timer utilization, voltage translation, and interrupt time efficiency.”

    I had the same thought and i was searching for combining the channels to one input port. Because it requires less power and you can do it all with 1 hardware timer.

    Have you already tested the OR hardware Ports? And does this work with all receivers? Or only a few.. i just bought one from hobbyking. It’s a 2.4 Ghz transmitter and receiver. I still have to look at the scope if the channels follow each other up. If so i could use an OR gate right? To fuse all the channels together like you did.

    I just wondered if you already tested it if it works ?

    If so could you also send me the C code how you read out the mixed signals? ( hermanwillems@gmail.com )

    I had the idea to use one timer and take an interrupt driven pin that triggers a timer and then transport the time form the timer into an array of channels “channel[0-5] etc.

    Hope you can answer my Questions, als i wish you good luck with your own Quadrocopter.

      • nic
      • November 10th, 2011

      Thanks Herman!

      I have tested my code with a Spektrum Dx7 and Dx5 and it works extremely well. In fact, my C code returns the number of nanoseconds for each pulse width. Given a 100 MHz clock, my precision is theoretically 10ns. However, I’ve noticed that the actual precise is about 60-70ns. This is because the RC receiver is running on a 16 MHz clock!

      Unfortunately I have not tested it with any other brand of receiver. It should work though. The only requirement is that each pulse is separated by some time. If the pulses come right after one another (or on top of each other), the OR gate is going to output one big pulse. Obviously this wouldn’t work. If you have access to an oscilloscope, hook all the channels of your receiver to it and verify its output.

      I’ll send you over my C code if you do me a favor…. Will you test it on your HobbyKing receiver and post the results here? I’d love to figure out how many receiver brands use this pulse output method.

      Your idea about the hardware timer is right! Make sure the digital signal latches the timer value (this is “input capture”). If you just read the timer value within the interrupt function, you’ll get bad results.

      Thanks for reading!

  2. Hey Nic, i really have to dissapoint you….

    I have the HKT6A V2 (mode2) with a receiver HK-TR6A V2.

    It’s a 6 channel one. And i was thinking about the bat pins. First i thought it would just need 5V but then i realised it had 3 pins. I was wondering were this last pin was for on the bat pins.

    So i hooked it up to a scope. And i was so happy!! It is the PPM signal!!

    Just the signal you are trying to get with the OR’ed signals.
    So i don’t have to use OR ports anymore…
    Anyway it’s a great receiver/transmitter for around 25 dollar and it is 2.4 Ghz.

    Hope you are doing great!! 🙂


      • nic
      • November 16th, 2011

      Awesome! Can’t beat that setup 🙂

    • Mike Blumenthal
    • October 3rd, 2012

    Major thankies for the blog post.Really thank you!

    • Muhammet
    • October 19th, 2012

    can you please email me the c code you used to get this to work? my email is zekimuhammet@hotmail.com I’m sorry for my bad english…

    • Sure! The code should be in your inbox. Enjoy!

    • Matt
    • December 23rd, 2012

    Hey, thanks for putting this up – I am doing a similar thing (quad with one processor (atmega1284), with dx5e and ar600).

    Do you think the propagation delay times and output rise times of the OR gates you are using (about 200ns each) would have any effect on the performance of your set-up (especially since you have 3 chained together)? Or would they offset the pulses slightly, by different amounts, depending on the ‘depth’ of the input in the OR-gate chain. Wouldn’t the rise/fall times introduce quite a bit of error (with the respect to the, I assume, 1000ns – 2000ns pulse width at 2048 resolution ~ 500ns/step)?

    I was thinking of using an 8-input NOR/OR gate (CD4078) to minimise this effect (especially the rise/fall times), but do you think a few diodes could be used instead, one at each input (pulling up the line, with a pull-down resistor on the line). Can you tell me the output voltage of the receiver you have – is it close to 5V?

    Thanks, and good luck with what you are doing at the moment!

      • nic
      • December 23rd, 2012

      You are right, the design shown in my diagram gives channel 5 less delay than the rest of the channels. Channels 1 through 4 all have an equal delay through the OR gates, while channel 5 goes through one less gate. To change this, channel five could be OR’d with a 0 volt signal to add one more gate delay.

      You’re idea of using a wider input OR gate is a good idea. It will equalize all the channels and produce lower latency. Diodes with pull-ups or pull-downs is generally a bad idea for latency because when the signal is undriven by the diode and pulled by the resistor, it is like a slow RC circuit. The resistor doesn’t have the strength to quickly pull the signal up (or down). This is the reason that SPI buses can run so much faster than I2C buses.

      The output of the receiver is approximately equal to the voltage input to the receiver. The circuitry uses the input voltage to power the output drivers.

      Good luck!

        • Matt
        • December 24th, 2012

        Thanks for such a quick and informative reply (+ why I2C is slow!), I will design my circuit with the wider input gate.

        Do you think (from your measurements) that the latency is constant, and so the period remains the almost exactly same? I am ‘nervous’ about using this method because I wouldn’t like to reduce this transmitter/receiver’s potential (precision-wise). I am reasonably confident that it shouldn’t affect performance (the error shouldn’t be anywhere too close to 500ns), but could do with a (more experienced person’s) opinion!

        I have found a much higher speed 8-in OR gate at 5V (M74HC4078RM13TR), but this is from Mouser (£12 shipping to UK!).

        Happy Christmas!

  3. I am curious if this is still wordking with spektrum servo-sync
    – enable a 2 servo elevator mixer in a acro prog
    – enable a 120 degr swashplate in a heli prog
    rebind the receiver.

    Also there are 9+ channel receivers available, (spektrum 18)
    who has to output more servos simultanious to get the 20 ms repeatrate.

    Also there are 11 ms repeat rate 6 channel receivers…..

    • I’m not sure if I completely understand your question, but I’ll try to respond. ServoSync looks like a tricky way of getting information from the transmitter to the receiver reliably for setups that use more than one channel to control one function. You shouldn’t need to be concerned about this if you are just reading the outputs of the receiver.

      My OR gate solution for serializing all the channels into one channel has the stipulation that the channels cannot overlap. For receivers that have more channels than can physically be serialized within the 20ms (for 50 Hz) window, the receiver would need to overlap the channel data. In this case, you could either:
      1. Inspect each channel individually. This would consume many pins on your micro-controller. Also, your micro-controller may not have enough timer input pins for this function.
      2. Aggregate the channels onto multiple channels instead of one. You’d need to use an oscilloscope and determine which channels overlap and which ones don’t. Then you could use OR gates to only combine the channels that don’t overlap. If the micro-controller in the RC receiver is sending all the channels at the same time, then you might be stuck with option #1.

      It’s too bad that RC receivers don’t have a better method for sending control signals to servos. In our digital age, there is no need to send pulse widths to the servos. It would be really cool if RC receivers had an I2C or SPI bus that could just give you the data in digital format directly.

  4. In comparison with (long) discussions on rcgroups.com on this topic; converting rx channels to ppm;
    this or-gate is an elegant and plain simple and solution. (Thumbs up!)

    My contribution here is a little reminder, that with recent (spektrum / futaba / etc) much channels / fast speed (11ms) high end systems,
    and often non eningeer-users, this could not always be working.
    Not everybody having a scope to check.

    With DSMX the settings should be checked / dailed down.
    With DSM2, Fassst 8, PCM1, it should be working.

    other ways possible could be:
    – reversed engineered protocol of spektrum sattelite receivers (SPI)
    – a new orange spektrum comaptible receiver with an SBUS output

    ps: also intersted in your code 😉

    • Hasan
    • March 1st, 2013

    can you please email me the c code you used to get this to work? my email is hasanamjad1272@yahoo.com thanks

    • Saqib
    • April 10th, 2013

    hi Nic
    is there any way i can use pulsin() function of arduino to read 4 channels simultaneously?

    • Hey Saqib, I don’t think pulsein() will give you the desired results. First off, it won’t do anything in parallel. It waits for a full pulse them returns. It could be possible to do these one after another and get them all but your code would need to call pulsein() before the next pulse starts, otherwise you’d be reading the wrong channel. I suggest writing an AVR interrupt service that captures all channels at the same time. AVR has a cool method for doing this. It interrupts anytime a pin changes on a full port. Good luck

    • Brendenloucks
    • June 27th, 2013

    I am building a RC wagon for my kids and was wondering if I could use your code for the rc interfacing ? My email is Stropsnoops At yahoo dot com. Thanks for the information as well.

    • Craig
    • September 22nd, 2013

    Very informative site! I am also working on a quadcopter, and am interested in taking a look at how you handled the input from the or gate. Would it be possible for you to send the source to me?



    • joseph
    • October 23rd, 2013

    Very nice

    I have been looking for some code to read the receiver signals also

    Could you please email you code? Thanks


    • Please download the code I’ve linked to at the end of the post. Thanks

    • tuan
    • June 9th, 2015

    can you please email me the c code you used to get this to work? my email is


    thank you

    • Please download the code I’ve linked to at the end of the post. Thanks

    • srikanth
    • October 3rd, 2016

    Hello nic,
    i can’t able to download the code from the link below the post.
    Can you mail it to mymail id ??


    • Just right-click the link and choose “save link as”. Rename the file with a “.zip” extension

    • srikanth
    • November 7th, 2016

    Hello Sir,

    You are using quad 2-input OR gate IC (MC14071BCP) for combing the RC receiver signals. But this IC is not combining all the Four Channels into a single out (ORed output for all the channels). Whether you are using two such IC’s or 1 ?
    Thanks in advance.

      • nic
      • November 18th, 2016

      I’m only using one IC. Why do you say “this IC is not combining all the Four Channels into a single out”? It certainly does! Look at my diagram. That is exactly how I did it.

  1. June 20th, 2011

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: