Go Down

Topic: Decoding Radio Control signal pulses (Read 55048 times) previous topic - next topic


Feb 25, 2009, 08:42 am Last Edit: Feb 25, 2009, 08:43 am by mem Reason: 1
I would have thought that the transistor and resistor would have been enough to invert the signal with the 2.5 volt pulses and drive the Arduino input. But no worries if you now have something that works.


Hi, I have a suggestion for the code, instead of using "TCNT1 = 0;", why not remember the previous value of ICR1 and keep track of overflows, this way you can get an unlimited value for the pulse width, also it's more accurate since it takes a few clock cycles to clear TCNT1


The only thing that can go wrong is if the capture event happens when TCNT1 is 0 and the capture interrupt executes before the overflow interrupt
Freelance engineer, consultant, contractor. Graduated from UW in 2013.


Mar 11, 2009, 04:38 pm Last Edit: Mar 11, 2009, 04:40 pm by mem Reason: 1
Hi Frank, resetting TCNT to 0 takes 250 nanoseconds on a 16Mhz Arduino. Because the timer is counting in 500 nanosecond ticks I don't think this delay makes any difference. Indeed I would be surprised to hear if any of the radio control equipment that would be used with this kind of application would notice differences in timing of less than a microsecond.

I am  not clear if  the ability to detect unlimited values for the pulse width are something one would would use in radio control or if you have another application for the code.

Many thanks for taking the time to share your comments, its always interesting to see the different ways people approach things.


Mar 11, 2009, 04:50 pm Last Edit: Mar 11, 2009, 05:29 pm by frank26080115 Reason: 1
oh i totally agree that it's overkill, the RC radio would need a 16 bit ADC for the joystick if it wants to make the accuracy worthwhile, i'm not dividing my timer so i'm getting 0.05 microsecond resolution if i run my chip at 20 MHz
Freelance engineer, consultant, contractor. Graduated from UW in 2013.


Mar 23, 2009, 02:36 pm Last Edit: Mar 23, 2009, 02:37 pm by gmv Reason: 1
You connect the PPM stream to arduino pin 8.

Hi all, mem.... could you tell me what would be the designation for the pin 8, i´m using an Arduino Duemilinove board with an atmega 328 and i think pin 8 is not the indicated one for this board . ::)

thanks in advance


All the pin assignments are the same for the 328 and the 168. have you tried it on pin 8?


Hi again, i think you mean pin 8 at the top board, i haven´t tried yet...i ment IC pin 8(atmega), so i understand now,...i´ve loaded the code and i could visualize the data stream on the arduino serial monitor.
One more dumb question, what are the pin´s used for the outputs ?  :)



If you are using Arduino (and most compatibles) ,  digital pin 8 is clearly marked on the board.

If you have built your own board, the pin assignments can be found here: http://www.arduino.cc/en/Hacking/PinMapping168



Mar 24, 2009, 01:28 am Last Edit: Mar 24, 2009, 03:41 am by ubuntucat Reason: 1
I have the ServoDecode_pde sketch working with my chepo VEX transmitter.  When I attach my scope probe to the ppm pin to view the pulses while it's going to the arduino it switches to Failsafe mode the moment I touch the pin.

Any ideas what would cause this?  The scopes input impedance is 1M ohm.  Not sure why this would effect anything.  I can see the pulses fine on the scope but the arduino goes immediately into failsafe.

I just noticed that if I touch the pull-up resistor with my finger it also goes into failsafe mode....  I'm confused!


Also when I have the sticks centered the values displayed are ~1500.  The pulses when viewed on the scope are ~1ms so I would have expected the values to be around 1000 instead of 1500.  (or is it 2 ticks per us so then it would be 2000)


Most transmitters send 1.5ms pulses with the stick centered. When was the last time you had your scope calibrated?  ;)

How are you connecting the signal to arduino - are you sure you need pull-ups?


Mar 24, 2009, 02:37 pm Last Edit: Mar 24, 2009, 02:38 pm by ubuntucat Reason: 1
thanks for the reply the details of the ppm signal from the vex are listed here http://www.allelectronics.com/mas_assets/spec/JS-6.pdf  As you can see the total range for the pulses is 0.5ms - 1.5ms and 1ms is the center position.  

And yes you do need a pull up in order to see the pulses.


Mar 24, 2009, 02:54 pm Last Edit: Mar 24, 2009, 02:55 pm by mem Reason: 1
You would need to change MIN_IN_PULSE_WIDTH and MAX_IN_PULSE_WIDTH constants to lower values to work with the vex. It looks like the space betwen pulses is the same as  valid pulse width so some of the error checking wont work.

Does the vex support 12 channels?

I don't have a vex so may not be much help if you run into problems. I suggest you keep things simple at first and try to get it working with 6 channels.


Thanks mem will try that when I get home....I forgot about the min pulse widths....  The vex only supports 6 channels (4 analog, 2 digital)

Also it is the low portion of the pulse that changes not the high the high pulses are always 500us.  Is this different than most transmitters?

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131