Decoding Radio Control signal pulses

Thanks again mem . ;)


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.

Edit: 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?

thanks for the reply the details of the ppm signal from the vex are listed here 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.

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?

It is correct that the Vex transmitter has 6 channels, but I read (after doing a Google search for this transmitter) that you can connect an extra transmitter and have 12 channels.

I don't know the details, but those that are interested can look it up.

Most transmitters start a channel on the rising edge, but You can easily change it by making a small mod to the library.

in ServoDecode.cpp, change:

volatile byte pulseEnd = PULSE_START_ON_RISING_EDGE ; // default value
volatile byte pulseEnd = PULSE_START_ON_FALLING_EDGE; // inverted pulses

I was thinking that pulseEnd changed what defined the end of the pulse (when it stops counting). I want it to start counting on the falling edge and stop counting at the leading edge.

When I try your suggestion mem it never synchs.. keeps repeating "the decoder is NOT_SYNCHED" Cx0= 0 and all the rest are 0

I'm assuming this is because the synch pulse is low and it is only reading the 0.5ms high pulses that never change.

Is there a way to make it start on a falling edge instead of rising edge? This would also explain why my measurements seemed to be 0.5ms too long

what values did you use for MIN_IN_PULSE_WIDTH and MAX_IN_PULSE_WIDTH

changed the min to 450


Hi all, i´ve been out for a few days but last night i got the chance to connect the PWM data stream of my radio to the pin8 of my board, with Arduino monitor i could see the data on the screen but the "fail safe" message was always there, i even tested with my scope just to confirm and nothing at the outputs, i must check the values(TTL), i guess it may need to be rised a little bit,.....any ideias ?

p.s - i got the data stream from the radio output plug (after the TX module been removed) .


ubuntucat, sorry for the delayed reply, I have been busy and did not see your post.

I have no experience with the vex and it's difficult to help without having the actual hardware on the bench. Did you try and contact jamiechan?

gmv, what transmitter are you using? Can you post a snippet of the data you get on the Arduino monitor? The voltage level of the pulses need more than 2.5 volts when high, ideally between 3 and 5 volts, what do you see on your scope?

does it matter if his radio is in pcm or ppm mode?

Yes, it must be in PPM mode for this library to decode the signal

Hi mem, i´ve changed my transmitter and now i got a good signal from the trainer port to pin8, now i can see the changes each time i move the channel switchs or the joysticks, but how can i drive the servos ?.....wich outputs should i use, ...the PWM ones i supose,....., could you please edit and post here the full sketch file in order for me to compare with mine ? ::)

thanks again and sorry to take your time

Well I’ve got it working… When I ran the example sketch for servoDecode it would frequently go into fail safe. When I run my own sketch everything seems to be working fine. It’s being used to run 4 motor controllers and 3 servos using a servo controller. Thanks for the help mem, and everyone else.

On a side note, which PWM pins will no longer work when using ServoDecode?