In the beginning of this year I’ve written a short tutorial how to read PWM signals from RC radio with Arduino. While it is can be useful when building own RC equipment, it does not help much when one has to deal with PPM (CPPM) signal. Let’s be honest, PPM is much more useful than PWM: all RC channels are sent over single wire. On one side, it simplifies electrical design. On the other, it makes software part more “complicated”, since there is a need to encode multiple PWM channels into single PPM line in transmitter, and then decode PPM signal into multiple PWMs in receiver. And there are very little “ready and working out of the box” solutions in Arduino world.
In this short article I will show how to generate PPM (CPPM) signal using solution prepared few years ago by David Hasko. Originally it was posted of Google Code. But Google Code is not closed and who knows for how long it still will be available. So, let’s not let the knowledge got lost.
Code is relatively simple, and almost all work is done inside
ISR(TIMER1_COMPA_vect) that is executed in the background by timer . Everything user has to do, is to put desired values to
ppm array inside
loop function. This code can generate both positive and negative signal. It can be easily ported to almost any project, as long as TIME1 is free to use.
Slightly more advanced example is available on GitHub.