randomport.com

PWM to PPM

I wrote a PWM to PPM encoder to use with my quadcopter. The firmware is quite advanced in the sense that everything is done in interrupts, so that main can be empty and interrupts can be "naked" (registers not saved and restored). This makes interrupts extremely fast and enables precise pulse width measurements.

It works without skipping frames on my Corona CR8D type 2 receiver (all servo channels output simultaneously). It should work fine on type 1 receivers also (servo channels output sequentially), but I don't own any so I can't test it. If you decide to use this for your multicopter, don't blame me if it crashes. Definitely use an oscilloscope to verify the signal first.

The firmware supports 8 channels (#define NUM_CH) but my TX doesn't, so I haven't been able to test it. The firmware does not pretend to do any crisis management (what to do in case of signal loss) - that's the receiver's/FlightCtrl's/someone else's responsibility.

Schematics

PD6 is tied to GND only to simplify protoboard construction. You can leave it unconnected.

pwm2ppm schematic pwm2ppm board

Protoboard construction

This is how I put it together with a 3 strip protoboard (bought at Conrad, Best.Nr.529618). I used only 4 pins for +5V and 4 for GND so they can be separated and I didn't have to cut tracks on the board to avoid a short circuit.

Protoboard top Protoboard top annotated

Protoboard bottom Protoboard bottom annotated

Put together and installed

pwm2ppm on receiver pwm2ppm installed

Again, I'm not responsible for crashing your expensive model, you are!

Files

Source and hexes for 5,6,7 channels