I am trying to write Arduino code to read PWM signals from Spektrum receiver.  Decided to examine and document the receiver output waveforms with an oscilloscope and video camera. Thought this information might be of some value to others trying to do the same thing.

Views: 4569


Reply to This

Replies to This Discussion

I think the killer set-up tool for RC/APM checkout would be a box to plug in the APM input cable. It should give bargraph output of each RC channel. That would let someone confirm their RC/APM wiring was correct before ever introducing the APM.

I just went through a APM2.5 setup and thought how cool that gadget would be to have.

Stock out of the box APM requires the firmware upload first before even connecting to Mission Planner before you can start RC calibration.

This just goes to show you that there are very few ideas that are unique.


Very nice! really!

Could you just confirm me that the max voltage for these channel is 3 volts???

Since I don t have an oscilloscope but a logic analyser, I cannot read those values.



My scope was set at 1 V/division and the waveform was 3 divisions high. My scope hasn't been calibrated recently, but the voltage should be pretty close to three volts.


I'm interested in this thread as I'm working on an Arduino based sound system for my Spitfire. So far I have got an Adafruit wave shield to go with my Arduino Uno, and have it working using a sketch that changed the interupt, enabling change in engine speed by an analog pot control - this works. However, I have started thinking about how I could use the servo output waveform to drive a digital Arduino pin - actually analog pin A0 - to control the rate proportionally with the throttle.

The info here is good in that it shows the waveform and timings, however, I have no clear idea how to use this to control the Arduino interupt. Has anyone had any experience of this?

If there is no obvious way, I may have to drive a servo in parallel with the throttle to turn a pot, which then controls the interupt. This will work, but is not at all elegant and adds weight when I don't need it.

I would really like to sort out the digital method and then pass it all on to other interested people.

Can you offer any clues please?


maybe you know already this link

There find you a lot of information about protocolls and PWM pulse reading.

Anyway for you it is really much easier if you connect the pin (put a small resistor between 150 Ohm) to the Channel on the receiver (plus V+ und GND of course). Enable the HW interrupt at the pin to:

- check if the signal at the channel is now HIGH
   -> if yes store the value from the function micros() into a variable (Temp);
   -> if not do nothing;

- check if the signal at channel in now LOW
   -> if it was HIGH then subtract the new value micros() by the old value of Temp. So you get the (exact) pulse duration of the incoming PWM pulses from your receiver.

Of course this was very vey easy and wanted to give you just an idea, how to do the job.
Hope this help.


Thank you Dave, I'll see if I can sort this out. My main problem is in not knowing much at all about Arduino programming. I've attached my sketch which currently reads analog pin A0 from a pot. Do you think you could suggest how I change the code to do what you are saying?

I'll check out the link you kindly sent; I wasn't aware if that site.

Many thanks


Hi Phil

I read your code. It is not appropriate to read PWM signals from a RX receiver.

Please keep in mind, that PWM pulses are a train of pulses (from 0 V to 3.3 or 5 V) http://www.best-microcontroller-projects.com/image-files/pwm.png periodically (~50Hz) generated. Their length (duration) is the "real" information.

They are not an analog current or voltage. SO your code is really not appropriate to read signals from the receiver.

Anyway at this point I would suggest (now I m at work so I cannot help your really) to read something more general about signals from a RX receivers: http://playground.arduino.cc/Code/ReadReceiver

This will help you a lot in your configuration and then to try to write down an appropriate sketch for Arduino. Trust me at this point I would not invest too much time into Arduino. it is much better to try to understand how PWM really works.

Hope that this help!

Hi Dave,

I see what you are saying regarding Rx output. I have looked at the links - thank you - I feel I am out of my depth with this, having no programming experience.

I think I may have to use a servo driven out of the throttle channel to control a pot, the output of which will control the interupt. I know that this works, as I have tested the system using a hand controlled pot. This raises and lower the engine pitch; I can set the upper and lower limits in the code to simulate tickover and max engine revs. Not the most elegant solution, but it will work.

I think I could spend far too much time and frustration trying to sort out PWM coding.

Many thanks for your input though.



Hi Dave,

I have been doing other things until today, so, I'm back on this one and
willing to give it a go. I'm having a good long look at the links you
kindly sent me; it does appear that I can do something with this. The Read
Receiver code, although written for 3 servo outputs could I think, be
trimmed down for just one output.

I will play with this over the next few days to see how I get on. I'll let
you know what happens.




it is much more simpler than you think.

Just forget for a moment about analogic signals and try to image a simple channel line that in a very short lapse of time rise from zero to a stable value, it holds that value and then goes after a while back to the zero. It does it repeatly by a given frequency.

The duration of that while if the information you want. Not the reached value. It doeasn t matter if it reaches at the peak 3,3 or 5 or 12 Volts (of course you should think about the electronic circuit...you really dont want to burn your microcontroller).

All what you want to do is to start a timer when the pulse goes up and stop the timer when it goes back down => the length of the duration. Really really really simple.

Almost all example in internet cxan you adapt to read one channel or much more. Once you wrote the code it is the same for every more channel you want to pick up. 
And with the same trick you can drive servos....but this in the future.


maybe you ask yourself why didnt electricians or engineers just didn t keep using the old good easy and simple analogical signal instead of inventing some tricky methods of sending informations. Well...here the very very short answer:

  • signals are at TTL level and didn t change in a range (You don t need, lets say, a scale from 0 V to 5 or more Volts to make a value readble or to define every possible value in small steps between those 2 extrem values).
    It has minimum 2 different but defined states. Or 0 or 3,3 V[*];
  • PWM (PulseWidthModulation) Signals are much much much harder to disturb by electromagnetic fields or other things. Amplitude modulation suffers even of small disturbance and is not ususally relyble;

Once you understand how servos work, can you read a RX just reading the information instead of trasmitting.The principle is the same: http://en.wikipedia.org/wiki/Servo_control

[*] just for example


Got it Dave. I understand the nature of the pulses and voltage levels, and the fact that the Rx servo outputs are fast square waves of a width controlled by the Tx.

My sticking point has been the coding side of Arduino. I'm not a programmer. However, reading the code I can see the logic of it in terms of the timer and rising/falling edge detection.

Lets now see if I can adapt the code and make it work for my project.

Many thanks for replying.


Reply to Discussion


© 2018   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service