Decoding Radio Control signal pulses

Good to hear you have it going. I still recommend adding the delay(20) in loop.

The standard servo library uses the same timer as the ServoDecode library so only one of them will run on an Atmega168 or 328. ServoTimer2 was written to use a different timer so it will work with ServoDecode on standard Arduino boards.

But you can use the standard library if you have a Mega board (see earlier in the thread for getting ServoDecode working on the Mega.

Thank you.

Since I want to learn: what is the idea behind using the delay(20)?

Cheers Alexander

The servo library will update the servo every 20 milliseconds, writing to the servo more frequently does not improve performance.

Indeed, constantly rewriting values much more frequently than necessary can actually slow things down.

Thank you,

the code will - of course - get more complex in the future. This was just a basic test and it works. Unfortunately the composit signal that the receiver is supposed to deliver is faulty. Using the basic Satellite works though. So I go on with my tests.

Cheers Alexander

Wow, this thread has been active for (almost) 2 years! [ch61514]

I have read through the entire thing, and I have learned a lot, which also means that it has raised a lot of questions.

Can I use this decoding method if I OR together several RC receiver channels together with diodes? Here is a schematic of what I am thinking of. I took it from the wiki page on diodes and modified it for my plans.

I have successfully decoded individual channels using attachinterrupt on 6 channels. But that maxes out the number if pins available on my Mega for using the attachinterrupt. I would rather just use 1 pin, even if it is just for 4 channels. In the future I am sure I will want more channels.

I guess I need to go through my box'o'parts and see if any of them are diodes. If not, where do I order, and anyone have recommendation on what type? I have not ordered much in the way of individual electronic components.

Am I on the right track? Where can I get current versions of the ServoDecode library?

vinceherman, I don't think that will work because most RC receivers do not have a break between one channel going low and the next going high. In that case the signal will simply remain high from the start of the first channel to the end of the last and no valid decoding will occur.

I have thought about the possibility of using an or gate to trigger a monostable circuit (google 555 timer) but have not had the time to try anything along those lines. Perhaps somone else here has?

The code at the start of the thread is the latest version, with a modification posted in reply #70 to use timer4 if you have a Mega board so ServoDecode can be used with the standard servo library

Thanks for the quick reply. Do you think I can put all the odd number channels on one pin, and the evens on another, so that I do get a break? Or if I put 1,3 and 5 on one pin, can I use the low signal time as the duration of the even channels?

Separating odd and even channels could work although it would require very significant rework of the library to support this.

I don’t have the time to look into this but would be happy to assist if someone comfortable working with timer interrupts wants to try and get this going.

But in my opinion, its much less effort to modify a suitable RC receiver to get access to the PPM stream so it can be decoded by the current code.

Since I aked a lot I just want to give a short update. Yes. Arduino does a perfect job for RC models. I started with a fully programmable Gear Door Sequencer that can handel as mans Servos as pins are available.

Every delay and speed of each servo can be individually set.

This is the init of the servos shown on the video below.

  // Prepare Servo Parameters and timings
  gearParameters[sNosegear].servoPin = 2;
  gearParameters[sNosegear].upPos_us = 1000;
  gearParameters[sNosegear].downPos_us = 2000;
  gearParameters[sNosegear].delays[GEAR_UP].wait_ms = 100;
  gearParameters[sNosegear].delays[GEAR_UP].delay_ms = 4000;
  gearParameters[sNosegear].delays[GEAR_DOWN].wait_ms = 7500;
  gearParameters[sNosegear].delays[GEAR_DOWN].delay_ms = 4000;

  gearParameters[sNoseDoor].servoPin = 4;
  gearParameters[sNoseDoor].upPos_us = 1000;
  gearParameters[sNoseDoor].downPos_us = 2000;
  gearParameters[sNoseDoor].delays[GEAR_UP].wait_ms = 4500;
  gearParameters[sNoseDoor].delays[GEAR_UP].delay_ms = 750;
  gearParameters[sNoseDoor].delays[GEAR_DOWN].wait_ms = 6700;
  gearParameters[sNoseDoor].delays[GEAR_DOWN].delay_ms = 750;

  gearParameters[sMainGear].servoPin = 3;
  gearParameters[sMainGear].upPos_us = 800;
  gearParameters[sMainGear].downPos_us = 2200;
  gearParameters[sMainGear].delays[GEAR_UP].wait_ms = 100;
  gearParameters[sMainGear].delays[GEAR_UP].delay_ms = 5000;
  gearParameters[sMainGear].delays[GEAR_DOWN].wait_ms = 1000; // Wait for door to open
  gearParameters[sMainGear].delays[GEAR_DOWN].delay_ms = 5000;

  gearParameters[sMainDoor].servoPin = 5;
  gearParameters[sMainDoor].upPos_us = 800;
  gearParameters[sMainDoor].downPos_us = 2000;
  gearParameters[sMainDoor].delays[GEAR_UP].wait_ms = 5500;
  gearParameters[sMainDoor].delays[GEAR_UP].delay_ms = 750;
  gearParameters[sMainDoor].delays[GEAR_DOWN].wait_ms = 100;
  gearParameters[sMainDoor].delays[GEAR_DOWN].delay_ms = 750;

Here it is in action:

I plan to add a swicth that tells Arduino if the gear is up to prevent damage if the switch on the TX is set to down and the gear is actually down or vice versa.

Downside: I cannot use the Decoding lib as I had hoped. The PPM signal of the Jeti R10, R14 or R18 is not sufficient. BTW it is also not sufficient to use it in the way Jeti intended it, that one RX can serve as a satellite in case of signal loss. I did some more investigation and observed the same behaviour: wild servo movements if the Sat signal from the other RX is used.

But I am totally happy that I stumbled into Ardino.

And thank you mem for your initial suppport :)

Cheers Alexander

Looks good, can't wait to see a video of it installed in the DC-6.

I am curious why the PPM signal was unable to be decoded by Arduino. Do you have any technical information on the JETI PPM output (or a scope trace showing the voltage levels and timing)

Thank you mem. Well I guess you have to be patient.

If you're interestes please follow my build thread on

Regarding the PPM signal. I don't have the electronic knowledge. That's why I use Arduino ;)

But to me it looks like a Problem on the Jeti Receiver. Another Jeti receiver isn't either capable to deal with the signal and shows the same weird behaviour of the servos when forcing it into signal loss.

I forwarded it to Jeti and let's see.

Cheers Alexander

I have subscribed to your rcgroups thread and will follow it with interest.

If you get any info from JETI (or if anyone else with one of those receivers has a scope) I will see if I can help get it working with the library.

Thank you for our interest!

I'll post information here if I find something on the Jeti issue.

Cheers Alexander

Hi all, It's my first post on this Forum ;) I start programming Arduino only few weeks ago. My problem is use the ServoDecode Library to grab 7 ch from a modifyed Graupner RX. The RX send the impulse train all toghether on one wire connected to digital pin of Arduino 2009. I add Servodecode library to my sketch and I have this errors compiling the library: (also with the example sketch)

o: In function __vector_13': C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp\build1989424199835515901.tmp/ServoDecode.cpp:45: multiple definition of__vector_13'

C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp\build1989424199835515901.tmp\ServoDecode\ServoDecode.cpp.o:D:\arduino-0018\arduino-0018\libraries\ServoDecode/ServoDecode.cpp:45: first defined here

o: In function __vector_10': C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp\build1989424199835515901.tmp/ServoDecode.cpp:52: multiple definition of__vector_10'

C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp\build1989424199835515901.tmp\ServoDecode\ServoDecode.cpp.o:D:\arduino-0018\arduino-0018\libraries\ServoDecode/ServoDecode.cpp:52: first defined here

o: In function __vector_13': C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp\build1989424199835515901.tmp/ServoDecode.cpp:45: multiple definition ofpulseEnd'


and many more.....

I'm running Arduino 018 with the library taken from the start of this thread.

Any help will be apreciated and sorry for my bad english ;)


are you sure you tried the code and the example sketch exactly as posted at the start of this thread? they compile okay for me using 0018

@mem I copy/past the code in the first page, maybe happend something during copy. May I ask u the link of the library as file and not as code. just to be sure of the file structure.



This forum does not have a mechanism to upload files but if you compare the beginning and end of the code you copied you should be able to see if there were any characters added or removed.

Problem Solved... was my fault. the example file was in the same dir of the library.... moved away and now i'm able to read data from my 7 ch RX :D

Just to save time in experiment what is the minum delay between two reading loops ? 20ms will be enaugh ?

The data is updated at the rate it comes in typically every 20ms. Each read turns interrupts off while getting the data so I would not read it more quickly than every 10ms or so.

Vince and Mem, check here for a design that uses diodes to encode a PPM stream from individual servo pulses: