loading

RC transmitter is very well suitable for the projects requires a wireless link as it has encrypted link with good range.

All RC receiver is made to drive servo motors. so there are 3 pins for each channel: ground, Vcc, and signal. here special kind of signal is used. It sends pulses at some interval. When servo receives 1.5ms pulse it sets to 90 degrees and by varying this value from 1-2ms servo goes to minimum and maximum value.
(In above photo a 6 channel receiver is shown with PPM pin)

So easy method is to measuring pulse width on each pin and map that data as per requirement. but here problem is that:

  • For each channel of the receiver, we need to connect a wire to Arduino pin.
  • this not only requires lots of connection but also consume lots of pins on an Arduino.
  • Most of Arduino just has 2 interrupt pin so if we uses more than 2 channel read it add some delay to our code which may be problematic for some application.

To solve this problem many receivers comes with an extra pin called PPM. this PPM pin transmits data of all channel in a single signal.

Step 1: How PPM Pin Signal Composed:

This signal consists of data packets separated by blank space.
Here space in between peaks represents the value of the channel. in this case, I have used 6 channel receiver so there are 7 pulses.

So in our code first, we need to detect separation space and then start recording data from the pulses for each channel.

As can be seen in the second image,

all data is separated with approx 11500 microseconds of time. than 6 values are for each channel.

Step 2: Making and Using Code:

Here read_me() specified as function:

a=micros(); c=a-b; b=a; x[i]=c; i=i+1;

if(i==15){for(int j=0;j<15;j++) {ch1[j]=x[j];} i=0; } }

this part runs on interrupt pin and take 15 time values and store it in array.

another function read_rc()

this part look for any space which is higher than 10000microsecond, in our case it detects separation space and as it detects that space code moves to next section.

after this space next 6 values are for each channel position it is stored in array named ch[ channel no],
here ch[1], ch[2], ch[3], ch[4], ch[5], ch[6] represents value of each chanel.

Step 3: Finally...

As we are using PPM signal with interrupt

  • This code do not add delay to our main functions
  • It consumes just 1 pin from Arduino

Why do you store 15 time samples?
<p>hi...<br>My receiver (of 6 channels) sends PPM for 8 channel (out of 2 are meaningless). I have chosen 15 just to make coding easy. so that, in any case, there is one set of 8 values which represents a value of each channel.<br>for an example<br>(here each number represents a channel number)<br>2 3 4 5 6 7 8 <strong>1 2 3 4 5 6 7 8</strong><br>7 8 <strong>1 </strong><strong>2 3 4 5 6 7 8</strong> 1 2 3 4 5 <br>5 6 7 8 <strong>1 2 3 4 5 6 7 8</strong> 1 2 3<br>8 <strong>1 2 3 4 5 6 7 8</strong> 1 2 3 4 5 6 <br>here we can just pick 8 value after channel 1 </p><p>if you use only 8 values it will become<br>6 7 8 1 2 3 4 5<br>1 2 3 4 5 6 7 8<br>8 1 2 3 4 5 6 7<br>so, in this case, we need to make rearrangement which is also not very difficult but I preferred easier approach.<br><br>hope now you are clear about it. If you have any query let me know.</p>
<p>Thank makes perfect sense. Thank you for responding!</p>
<p>Works great to me (Sanwa RDS8000 via trainer ppm port). Compared to other approaches, yours has no glitch. Only strange thing is the values: they differ on what I know coming out from the tx. Do you have an idea why ?</p>
<p>sorry, I don't have an exact idea. I have checked that values only on my Rx (avionics RZ6) and also on few websites.</p>
<p>my receiver only has pwm outputs. is it okay if i add a ppm encoder between the receiver and the arduino?</p>
<p>Yes, It should work.<br>if it not works, just check signal and do modification in code as per separation (step 1).<br><br>If you don't have any problem with a delay in the reading channel (around 15milliseconds/channel) or do not wont to purchase PPM encoder you can directly use the pulseIn function for each channel.</p>
<p>Nice work. Really informative</p>
Thanks lot... Hope this tutorial was helpful to you

About This Instructable

1,049views

16favorites

License:

More by abhilash_patel:Simple Arduino Trigger for DSLR DIY: Arduino based continuous touch Piano  DIY: Simple Hovercraft 
Add instructable to: