Story
I was wondering about PPM decoder for a while. I liked to have receiver on edge of the wing, but routing of all servo cables there is nonsense. My idea to build one came from accident when I damaged my one of APM1’s main MCU I2C pins. I replaced it with new one and then I get idea to reuse damaged MCU for PPM decoder (I2c wont be needed) They are not cheap (ATMEGA2560 are 18$ in mouser) and it's a pity to throw it away. I realized that APM uses sum PPM signal and can drive 8 servos by hardware timers and has libraries for it so software can’t be too hard. I fired up Eagle and started to draw....
Hardware design
I peeked in schematic of APM1 and duplicated servo and PPM pinout. Basically, you can use APM1 without oilpan to do the same! Then I realized it would be a good idea to do galvanic isolation of receiver to suppress any interference coming through the wires. This is really simple, just isolated 1W DC/DC 5V/5V converter to power receiver side and ADUM1301 isolator IC. Simple optocoupler would do the job well, but I was too lazy as ADUM’s are really simple to work with. It is quick and dirty design at all, board is autorouted with some hand corrections. Parts are chosen to be obtainable in local store here in Czech.
Prototype
I soldered all stuff on board, powered it up and arduino bootloader was not answering :) Long story short, failed crystal. With new one, everything goes well. I still haven't ADUM1301 IC, so there is a piece of wire instead. But receiver has its own power via DC/DC.
Software
This was easies part. I just compiled \ArduPlane-2.32\libraries\APM_RC\examples\APM1_radio\APM1_radio.pde it was all I needed to do! This example is doing exactly what I needed. Decode PPM signal and send it to servos. Well I commented out serial debug messages and added blinking of LED.
Real life tests
I was really brave (or stupid) to put this to my greatest, most expensive and most labour intensive plane ever, UltraMaxiSwift (will show it in another blog post) and even together with my own OpenLRS clone. Everything is working well, it has about one hour in the air.
Future development
When I fix my APM completely, it will replace this decoder. Maybe I will use it in other plane.
But one thing worth to be experimented. If I add second PPM receiver, Decoder can do a sort of diversity. It would choose valid PPM signal from second receiver if first goes to failsafe or vanishes completely.
Is ATMEGA2560 (or 1280) able to decode second PPM stream? I offer piece of hardware to someone who will write software for it :)
Pros and Cons
+ Place receiver freely in airframe
+ Galvanic isolation to help avoid interference
+ Possibility to alter RC signal (mixer, complex failsafe...)
-When this thing fails your plane is doomed
-Not need when APM onboard as it has PPM input
-ATMEGA2560 (or 1280) is expensive overkill for such simple task
Conclusion
If you like this, send my board design to your favourite fab house and DIY. Probably not needed by most of you. I wanted to thank all APM community for such great project.
Comments
Hello Greg,
Can you please send me the code for Pro Mini to decode PPMSUM signal to 9 PWM servo outputs?
You posted that you made it work, here: http://diydrones.com/profiles/blogs/galvanically-isolated-ppm-decod...
Is there anything else needed to do other than
-upload the code(modify it a little if needed, for exact number of channels and so)
-and connect signal in to D8 and servos to PWM outputs?
Thank you very very much.
Your help will make this plane fly further and higher,
when i separate RX from VTX, but need this decoder to decode PPM from RX in fuselage :)
https://www.youtube.com/watch?v=D_kiIUaahac&list=PL7C690E9A7DD76...
T.RESKOVIC@GMAIL.COM
Kolin this is great. I was wondering how did you manage to solder the fine pitch 2560. I have a hell of a time when I try to solder such fine tip connectors. Do you have any tips which others can use? Recently I got a very fine soldering iron, Weller WM120. This is helpful but still I have trouble.
http://www.amazon.com/Weller-WM120-120v-Pencil-Soldering/dp/B0000WT....
Thanks
Hello Kolin, I think I can help you. I have done this before on a Arduino Pro mini board. The 1280 chip is way overkill for this application. You can use any output pin for a PWM out. This doesn't use the PWM modules on the 328 chip (there are only 2 or 3) so you can have up to 9 outputs with 50 Hz PPM. This is possible because the entire program is interrupt driven. The one 16 bit timer does everything. Times the input pulses, sets the output PWM to any pin you want. I did it to hack a transmiter's PPM and change/add some channels for a 3 axis head tracker. The first 4 channels were passed right through and the rest were up to me. I sent the channel data with serial port from the ardu imu board at 50 Hz. It worked without a glitch thru much testing. I then tried to merge the ISR's from the first board onto the imu board, also a 328 chip. The imu board I had at 200Hz so I cut the timers rollover point to 10000 from 40000. That also worked just fine. I made it into a camera gimbal controller. I have never seen the servos twitch. I have seen occasional twitches on the APM board running the gimbal code on the Ardu Plane platform.
If you want to try one I will help you with the code. If you build one you need to know this, the PPM input must be pin D8. The outputs can be any digital or analog pin and I can easily adjust the code for the proper pins.
Get the board here.
I like how you recycled parts. Good idea to reuse rapidly changing technology.