NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Sensors, Actuators, and Robotics » Radio Control Interface - a PPM decoder
January 13, 2010 by icarus |
that carries 3-4 channels. From hours of research, I've found that the information within the signal is contained in the measured time interval between a series of pulses. the time interval for each individual channel is no larger than 0ms-3ms. after all the channels have been sent, there is a longer delay, I've heard over 4ms but under 20ms, used to indicate the data is starting over at ch 1. several forums have stated code examples using the 16-bit timer/counter and an interrupt to measure the interval, but I'm confused as to how that feature works and the "formal" way the code should be written. I have lots of experience in C++, but I cannot wrap my head around how to program to use the interupt feature, or even if thats what i need... any help is much appreciated, thank you |
---|---|
January 18, 2010 by hevans (NerdKits Staff) |
Hi icarus, It sounds like a pretty cool project you are working on. I think you came to the right conclusion in your research that the information is encoded the pulses of a single line. Your best bet to tackling this project is to start by trying to detect the time between pulses of your signal line. To get started with this idea I suggest looking into the Interrupts Tutorial. It deals with interrupts in general, but specifically uses a pin change interrupt to find the rising edge of a clock line. You should be able to combine that with the concepts found in the Real Time Clock Project in order to measure the times between the pulses. Once you find the rising edges of your signal line the time between them will help you decode the signal into the different channels. Let us know how you get along with your project. It should be pretty fun. Humberto |
January 19, 2010 by icarus |
Thanks for the post! I've made great progress in my project. I did just that, using the Input capture function of the MCU and a pin change interrupt on the rising edge of the pulse to trigger a capture. I wrote the code to the best of my ability, with some help from example codes, and loaded it onto the chip. However, when i tested it, it did not work. the source of my problem turned out to be a voltage of less than 0.5 V on the ppm signal. so I'm going to hook the signal line to an oscilloscope to see where to go from there. otherwise, the code seems to be working and I'm making good progress. I'll try to post a copy of my code here in the next few days and also some updates on what all this is for and the results of the oscilloscope test. -Icarus |
January 31, 2010 by icarus |
By gosh I've got it! So, this is an update on my progress into my project. Ive been working on interfacing standard servos with a Hobby-zone Super cub airplane. This is a huge advancement for anyone with a hobby-zone plane, as their servos are "dumb"; they do not have the circuitry to accept a pwm signal. Instead they run 5 wires, 2 for motor leads and 3 for a pot that indicates position. this setup has low quality and poor response, so an interface would be awesome. Conveniently, most hobby-zone airplanes have an x-port jack on their Rx. On the x-port there are 4 pins, positive, ground, the ppm control line, and throttle. so i got to thinking... if i can use the ATmega168 to read the ppm signal, i can output a pwm signal and control my standard servos. this is where this thread comes in, i need a little help at first but now Ive got into it and made a working prototype. I did the oscilloscope test about 2 weeks ago and got all the info on my ppm source. here are the results. The ppm line is 0-5v TTL. so its easy to hook up. the pulses are .325ms the frame is 24.6 ms. channel 1 is throttle, increasing it enlarges the time from 1ms to 2ms channel 2 is elevator. its range is 1.16 to 1.82ms up- elevator increases its value channel 3 is rudder. its range is 1.2 to 1.82 ms. right increases its value. ACT switch produces non uniform pulses the x-port button seems to be frequency modulated, right now it screws up my code when pressed. with this information i wrote this code to interpret the ppm signal and reproduce the elevator commands. The code uses the timer counter 0 found in the real time clock example. beefed up to keep time in hundredths of a microsecond. i then use an int0 interrupt to record the time between rising edges of the pulses. after all that, i had figure a way to record the individual channels in their respective variables. this is done with an array in the ISR. anyways heres my code, i tested it and it works with a futaba s3101 servo on the elevator channel.
Now that i have a stable platform to interface standard servos, i can begin work on expanding it to 2 servos and eventually an autopilot... but thats for another day. if you have any questions or comments, especially an ideas to improve the code please, dont hesitate to post! i check the forum frequently and will reply ASAP :) -Icarus |
Please log in to post a reply.
Did you know that a NerdKit can be used to build an iPhone-controlled R/C car? Learn more...
|