ATmega328 PPM Encoder Board

From PaparazziUAV
Jump to: navigation, search

PLEASE USE NEW PPM ENCODER PAGE

Thanks to Chris we have a way to use virtually any RC receiver with Paparazzi without any modifications to the receiver.

This board plugs into the servo output ports on a R/C receiver and encodes them into a single PPM pulse suitable for the paparazzi autopilot. It is also possible to remap channels by changing the connection between the receiver and the encoder. Want Tx ch5 to be output on ch7 of the ppm stream? Just connect the Ch5 signal from the receiver to the Ch7 input on the encoder.

Note: see the ATmega168_PPM_Encoder_Board page for the more recent hardware version. Wiki refactor in progress, these pages will be merged.

Radio file considerations

See the Radio_Control page for more details, here the short version:

1. The encoder board outputs 8ch so your radio.xml file must have 8 channels with distinct function names.
2. The encoder board outputs POSITIVE regardless of your Tx so the first line of your radio.xml needs to be like:

<radio name="MX-16" data_min="800" data_max="2200" sync_min="5000" sync_max="15000" pulse_type="POSITIVE">

3. If channels are not mapped properly don't worry, the file has 8 lines, one for each channel, just alter the order. The first row is ch1, the second ch2 and so on.

Here's the file I used on my XTremelink 2.4gHz Mx-16Tx and Xtremelink 8ch Rx

<!DOCTYPE radio SYSTEM "radio.dtd">
<radio name="MX-16" data_min="800" data_max="2200" sync_min="5000" sync_max="15000" pulse_type="POSITIVE">
<channel ctl="B" function="THROTTLE" min="950" neutral="950" max="2050" average="0"/>
<channel ctl="C" function="ROLL" min="950" neutral="1500" max="2050" average="0"/>
<channel ctl="D" function="PITCH" min="2050" neutral="1500" max="950" average="0"/>
<channel ctl="A" function="YAW" min="950" neutral="1500" max="2050" average="0"/>
<channel ctl="E" function="MODE" min="950" neutral="1500" max="2050" average="1"/>
<channel ctl="F" function="FLAPS" min="950" neutral="1500" max="2050" average="0"/>
<channel ctl="G" function="GAIN1" min="950" neutral="1500" max="2050" average="1"/>
<channel ctl="H" function="GAIN2" min="950" neutral="1500" max="2050" average="1"/>
</radio>

Note on Ch3 (3rd channel row) I reversed the PPM signals from 950, 2050 to 2050, 950. That was because on my funjet the ailerons were reversed. I went to this file and reversed them there not in the Tx.

Programming the PPM encoder

Programming the board can easily be accomplished using an AVR ISP (in-serial programming) programmer. These are inexpensive and can be found many places online. Once you have the ISP connected to the PPM encoder, simply use avrdude with the following command:

For ATmega168:

avrdude -p atmega168 -P <Insert port here> -c <Insert ISP type here> -U lfuse:w:0b00100010:m -U efuse:w:0b111:m -U flash:w:servo2ppm+bootloader.hex

Fuse settings shown above may give unpredictable results and strange behaviour, depending on device and crystal.

So the better settings are:

avrdude -p atmega168 -P <Insert port here> -c <Insert ISP type here> -U lfuse:w:0b11110111:m -U efuse:w:0b111:m hfuse:w:0b11011001:m -U flash:w:servo2ppm+bootloader.hex

For ATmega328P set the fuse bytes as shown next:

avrdude -p m328p -P <Insert port here> -c <Insert ISP type here> -U lfuse:w:0b11110111:m -U efuse:w:0b111:m hfuse:w:0b11011001:m -U flash:w:ppm_encoder_v4_3+bootloader_16Mhz.hex

If you use 328P and a PonyProg-Cable for COM or a Mikrokopter SerCon, type the following: (replace COM1 with actual COM-port):

avrdude -p m328p -P COM1 -c ponyser -U lfuse:w:0b11110111:m -U efuse:w:0b111:m hfuse:w:0b11011001:m -U flash:w:ppm_encoder_v4_3+bootloader_16Mhz.hex


Source files

Gerber & Drill files