Go Down

Topic: Library for receiving the RC radio PPM signal (Read 2354 times) previous topic - next topic



I wrote a library, wich can receive a PPM signal, and can handle the channels as You want. Recently I created the following functions:
- do nothing ( just receive the value )  :-)
- build a PWM signal from it for servos
- switch an output on and off depending on the channel value
- select two outputs depending on the channel value

The library does NOT use timer interrupt, only an external interrupt for PPM signal receiving.

Feel free to try it, comments are welcome!

p.s.: this is my first development in arduino ;-)



I have happily used my library in testing phase. After that I built a sketch wich using an another interrupt driven library too, and found a little time "glitching" in the PPM-PWM conversion.
I think this is when the another interrupt blocking the input interrupt. Is there a solution for setting priority between interrupts? Wich interrupt is prior, the input or the timer one?



Its probably the timer0 interrupt. Could test for this by temporarily disabling it.

I think interrupt priority is set in stone.

Have you considered using input capture instead?


Timer0 is always running, if it would be the case, the test also would done "glitching".
I'm sure, this is because of the additional library, wich is using Timer2 for it's functionality.

I would be happy if I would set input Interrupt as a priority for Timer2.

If it is not possible, the proper setting is impossible if other interrupt is used. The PPM signal is 2 ms wide, with resolution of 255.


Jul 27, 2016, 09:23 pm Last Edit: Jul 27, 2016, 09:23 pm by dlloyd
What I was suggesting is that you could try a test with timer0 interrupt turned off and see if the timing glitch goes away.
Code: [Select]
TIMSK0 = 0;  // for testing with timer0 disabled
I would think that using the input capture interrupt with pin 8 could provide an accurate solution that's immune to other interrupts.


I put the other library's interrupt routine's first line a sei() command, the result is much better, almost perfect!



I was trying to get the PPM signals/channels from the DJI Ocusync Unit separated for controlling a custom gimbal driven by 2 servos and your library is working like a charm. Thanks a lot for your affords and making this so easy!



Hey Zoltan,

Most probably you know ppm topic in Arduino world very well. So please advice.
Problem is that I have 6ch ppm signal. In transmitter I would like to install Arduino to :

- catch signal from ppm out from transmitter main board

- read 2 potentiometers connected to Arduino

- replace ch 5 and 6 with potentometers values

- Generate back all 1-4 and 5,6 channels to transfer them to radio module.

Is your library a good start to tinker, or there are better, more suitable for this specific topic?

I found on forum here info about rc channel extender, but it is for extending from 6 to 8, not replacing. And it is not for Arduino but for pic. And not source available.

Cheers, Rafael



The function You try to build is called trainer port in RC radios. The trainer port is a PPM input for the radio, and with the mixes You able to mix the trainer port CH 1 and 2 to radio output CH 5 and 6.

What is the purpose of Your plan?


The purpose: I have old, but lovely radio made by graupner. Mx12s. Some time ago I updated it with frsky dht module to change it to 2,4ghz , and also added oled screen with telemetry made on Arduino (great project by https://www.google.com/url?sa=t&source=web&rct=j&url=https://github.com/xythobuz/FrSky-Telemetry-Arduino&ved=2ahUKEwjMwJeEtKXiAhWJ_CoKHQMDC3sQFjAAegQIAxAB&usg=AOvVaw1ahAoQUYkF76JBLLt-4vfb)

This radio is 6ch, but 5 and 6 are for flaps and landing gear. There are no potentometers for them. And I would need 5 and 6 made analog , for gimbal movement. So the idea is tho replace 5 and 6 with new signals before they will reach dht module in transmitter.

I am not sure if it is doable. If not maybe finnaly buy a taranis radio...


OK. I understand the reason. The concept can work. As I see You can do it with cutting the PPM signal between your radio, and the module, and You can insert the Arduino in between. For receiving the radio ppm signal, this library is OK.For regenerating the PPM signal maybe the loop{} can do, but because it is time critical I suggest a timer based solution instead.
I have a PWM2PPM project, which I wrote to create a PPM signal from my old PWM receiver ( https://forum.arduino.cc/index.php?topic=577210.msg3929704#msg3929704 )
You can cut the PPM generation part from it, and the loop role is only the data transfer, and the ADC.

Go Up