Read PWM Signal from a RC-Receiver

Hello,

one short question:

Is there a command/libray that can read a PWM signal with the arduino board???

Or do i have to write code to analyse the signal "by hand"??

Thx
me

As the PWM is an output what do you want to read? Is it the logic level at that instant or is it the duty cycle it is set to?

i am interestet in the "signal" that is send by the receiver!

in my "thinking" i expect a value from -100% to +100%. I don't exactly what you mean with "logic level" or "duty cycle". --> i am a noob :-/

thx

There are a few threads that discuss decoding an rc signal using the Arduino, such as this one: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1204020386/156#156

Note that the radio control signal isn't really PWM, (although it is often called that) it's a form of pulse position modulation (PPM).

A google search for Arduino and ppm should turn up some other links of interest

Note that the radio control signal isn[ch8217]t really PWM, (although it is often called that) it[ch8217]s a form of pulse position modulation (PPM).

I think you misunderstood me.

I want to read the signal that comes FROM the receivers output socket to ONE servo. I don't want to read the complete transmission for ALL channels.

According to wikipedia and other sources this should be a PWM signal. I havent found anything here too.
But then i looks that i have to create/copy code to do that.

One more idea:
Couldn't i use a capacitor and a resistor to convert this signal to an anlog signal???
Maybe i have to compare this signal to with the level of the receiver battery.

Note that the radio control signal isn't really PWM, (although it is often called that) it's a form of pulse position modulation (PPM).

I think you misunderstood me.

I want to read the signal that comes FROM the receivers output socket to ONE servo. I don't want to read the complete transmission for ALL channels.

According to wikipedia and other sources this should be a PWM signal. I havent found anything here too.
But then i looks that i have to create/copy code to do that.

One more idea:
Couldn't i use a capacitor and a resistor to convert this signal to an anlog signal???
Maybe i have to compare this signal to with the level of the receiver battery.

I don't think I misunderstood you, the code in that link will decode a single channel receiver output. But it may be simpler to use pulseIn() to get the pulse width of a single channel. You can read about pulseIn here: http://www.arduino.cc/en/Reference/PulseIn.

You should get values that range from approximately 1000 to 2000 microseconds. After observing the actual values you get from your receiver (i.e. display the value from pulseIn to the serial port), you can write code in your sketch to respond as required.

BTW, Wikipedia correctly defines PWM as “the modulation of the duty cycle".

Information is conveyed in Radio Control systems by varying the time between rising or falling edges of successive pulses. The receiver decodes this and provides a servo signal where the pulse width is varied for each channel. Note that the duty cycle for a given channel can vary even when the value for that channel is not changing. This is because when other channels increase or decrease their pulse width, a typical RC transmitter will increase or decrease the time between pulses. So the PPM value can remain constant even though the duty cycle can change.

You are more likely to find useful information about decoding radio control signals using PPM as a search term.

Anyway, try using pulseIn and see how you get on.

http://www.arduino.cc/en/Reference/PulseIn.

This was the information i needed!

just one little command to read the signal! PERFEKT
thank you very much, mem! :slight_smile:

I have a similar question.. I'm trying to read PWM from a 6 channel RC receiver.It looks as though I can get away with two pulsin calls in the Loop, but not more.. the following snippet works great.. but if I go to 3 or more pulsin calls, the code after the pulsin's never gets executed.. I assume the timing loops on the pulsins are too long.

eg.

#include "WProgram.h"
void setup();
void loop();
int ch1 = 2;
int ch2 = 3;
int ch3 = 4;
unsigned long ch1v;
unsigned long ch2v;
unsigned long ch3v;

void setup()
{
pinMode(ch1, INPUT);
pinMode(ch2, INPUT);
pinMode(ch3, INPUT);
Serial.begin(9600); // open the serial port at 9600 bps:

}

void loop()
{
ch1v = pulseIn(ch1, HIGH);
ch2v = pulseIn(ch2, HIGH);
ch3v = pulseIn(ch3, HIGH);

(... code here never gets executed ... (but does if you comment out the previous line)
}

I've seen solutions in this forum that take the raw RC data from the receiver and separate out the individual channel pulses directly.. but unfortunately, my receiver doesn't give me access to the raw data.. only the 6 individual channels.

So.. my question.. is there any way I can do my own pulsein code so that I could read at least four channels with one arduino ?
Any help/thoughts appreciated
-jc