Go Down

Topic: PPM decoder with failsafe (Read 4 times) previous topic - next topic


Dec 04, 2012, 06:35 pm Last Edit: Dec 04, 2012, 06:52 pm by balsagrinder Reason: 1
Hello. I have been searching long time for such thing PPM decoder for RC systems that has at least 8 channels and 10 bit resolution, has failsafe that can be preset on at at least 1 channel. This means that when the decoder stops receiving PPM signal from RF modules or receives bad signal it should activate the failsafe and move the servo of this specific channel to a specific position.
The thread I found: http://arduino.cc/forum/index.php/topic,22140.0.html
I think this code does everything I could wish for!
Now for the hardware I needed something small because I will put it in a RC plane and  it should not take too much space; On the other hand I did not wanted to buy any other hardware that I will use only once or twice and then leave to collect dust on the shelf.
After some searching I found this board, with USB connection:

And my first question for this piece of hardware: is it possible to program it using the USB connection by connecting it to the PC?
If that is "yes" then I guess it makes no sense trying to build my own board that is programable through USB.

Thank you very much in advance!


I am unable to open the link on my end, but it looks like you have the Arduino NANO, yea that can be program from the PC, granted you also download the arduino software and install it properly.


   That library appears to reset timer1 in which case you cannot use it with the Arduino Servo library - which limits its use.

   I have an alternative library which reads PPM and controls servos, there is an example sketch for 3 channels, but if you want to use it with 8 or 9 I would be happy to send you a template sketch.

   At the moment the failsafe has been left to the user to code in the loop function, as I generally end up writing the same code for this, I will move it into the library.

   Let me know if you want to give this a go, you can see the library in use in the link.


Duane B




   To respond to the OPs PM -

The Arduino is easily able to read 9 channels of RC Input from an RC receiver and also to generate 9 Channels of servo/esc signals.

RC Receiver -> Arduino -> RC Servos and ESCs = No Problem

The usual approach to generating a servo signal is to use the Arduino Servo library, its a well known, well used library which is very good at what it does, which is this bit -

Arduino -> RC Servos and ESCs

Internally the servo library uses a resource of the Arduino - Timer1 - which the servo library assumes it has full control of.

The library you linked also uses this same timer but in a way which is not compatible with the Servo library, this will cause you a problem.

What I have proposed to you is a library that reads incoming and generates outgoing RC Signals without you having to worry about timers and things.

Other than that, what you want to do is definitely possible but before anyone recommends you go out and buy all the hardware what else do you plan for the project ? is it just to add a fail safe, if so Arduino seems a bit over the top ?

Duane B


Dec 04, 2012, 08:51 pm Last Edit: Dec 04, 2012, 08:53 pm by balsagrinder Reason: 1
Hello and thank you for your detailed reply. As I said I just have RF modules that have no PPM decoders, PPM encoder is not problem because any RC transmitter has PPM output, I just connect it to TX module.
But on the receiver side is the problem I have RX module that outputs PPM signal and I have to decode it so the servos of the airplane can work. I have been searching a lot and finally found what I need: PPM decoder that has at least 8 channels and has programmable failsafe on at least 1 channel (that is made by user "mem")
On every modern rc system even cheap chinese receivers that cost around 10 USD the PPM decoding is done with atmel as far a I know.
So I thought this is the best http://dx.com/p/nano-v3-0-avr-atmega328-p-20au-module-board-usb-cable-for-arduino-118037
it has USB connection so I don't have to buy any programmers. Where I live buying only the atmega will cost as this whole board or more.
So yes I only need PPM decoder that has at least 8 channels and Failsafe. Without this I can't control the model.
If it is possible to decode more than 8 channels it will be great, because with more channels you can control more things for example lights and other misc stuff.


On every modern rc system even cheap chinese receivers that cost around 10 USD the PPM decoding is done with atmel as far a I know.

In most of the cheap RC toys in the UK atmel chips are NOT used. Google "TX-2B" and "RX-2B" this is (I think) the most common coder/decode used in cheap chinese rc toys shiped to the UK.

Using just an Uno you could deal with 64 channel "digital" RC.

Do read DuaneB's blog on RC model hacking and look at his code for reading PPM  signals. Both are most excellent!.

Where I live buying only the atmega will cost as this whole board or more

Where on Earth do live do live!



holmes4 you information is not correct I am talking about proportional RC systems used in RC models not on/off controls used in cheapo chinese toys.
But that Is not my case. I am using other RF modules and I only need the PPM decoder. There is no PPM in cheap chinese toys.
Best regards!



   As you have confirmed that all you want is to decode an 8 or 9 channel PPM Stream and add a failsafe, Erni's suggestion would appear to be the best.

   You may then be wonder why people use Arduino and go to the trouble of writting all of these libraries ?

   Its because it allows you to add more functionality, for example to read sensors and adjust the incoming signals based on the sensor value before sending them to the servos and ESCs. As you have clarified you do not need this capability, I would second Erni's suggestion.

Duane B


Hello That is also good idea but few drawbacks:
This component is very old and impossible to find.
Also is this reliable enough?
Will the failsafe detect correctly when to activate itself? What happens where there is no PPM at all or PPM with wrong pulses coming into this decoder? after that how will the decoder affect the PWM output for the servo channel so that the failsafe can detect this and activate?

Also what is the resolution of that decoder? Is it 10 bit?
And last but not least: whats the difference between CD 4017 and CD4020? I read the datasheed and it comes out that 4017 is 10 channel and 4020 is 8 channel.


As you can see from the posts here, there are many approaches you can take. If you say more about your project then it would be easier to suggest which ones would work best for you.

Other than the failsafe, do you want to analyze the individual channel signals? If so, can you say a little more about what you want the Arduino to do with the channel data.



Dec 05, 2012, 07:55 pm Last Edit: Dec 05, 2012, 11:37 pm by balsagrinder Reason: 1
I dont need to analyze any data I just needed a decoder with failsafe I can set; and your solution is the only one in the world at the moment that does that thing in specific way and can be set for any channel seperately to a different value;
For now I will try with 4017 and this failsafe should do the job:
http://www.rc-cam.com/rcfs2.htm it has 3 modes and can be preset to any servo positioon with a click of a button!


It would help if you explicitly stated what you did want to the application to do. I guess you want 8 or more channels to controlled directly from the transmitter when the the receiver has a good signal, but switch some or all of the channels into preset failsafe values when the PPM signal is invalid.

If that is the case then you may want to try using ServoDecode running in a controller that has two (or more ) 16 bit counters, such as the teensy. In  this configuration, the decode would run off on timer and the servos off another. I wonder if someone has already tried this to see if the two timer interrupts would cause any noticeable jitter.



Measured and reduced jitter using a single timer to read inputs, generate outputs -


PPM Addition to the same -

Works well on an UNO, but as the OP has realised he does not need a microcontroller for his particular application, there are off the shelf solutions.

Duane B

Go Up