Difference between revisions of "ATmega328 PPM Encoder Board"

From PaparazziUAV
Jump to navigation Jump to search
m
m (add link to new ppm encoder page)
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[ATmega_PPM_Encoder_Board|PLEASE USE NEW PPM ENCODER PAGE]]
<p>Thanks to Chris we have a way to use virtually any RC receiver with Paparazzi without any modifications to the receiver.</p>
<p>Thanks to Chris we have a way to use virtually any RC receiver with Paparazzi without any modifications to the receiver.</p>
<p>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.</p>
<p>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.</p>
[[Image:Ppmencv3_sm.jpg|250px]]
<gallery>
Image:Ppmencv3_sm.jpg|Assembled Board
Image:Ppzppmencsetup.jpg|Example. Note I am only connecting 5v and Gnd to Ch1 connections. The rest are only PPM signal wire as the connector is 90 degrees and covering only the signal pins on Ch2-7. Ch8 is unconnected and the signal will be generated by the PPM Encoder.
</gallery>


Note: see the [[ATmega168_PPM_Encoder_Board]] page for the more recent hardware version. Wiki refactor in progress, these pages will be merged.
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.<br>
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 PPM encoder ==
<p>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:</p>
<p>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:</p>
For ATmega168:
<code>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</code>
<code>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</code>
Fuse settings shown above may give unpredictable results and strange behaviour, depending on device and crystal.
So the better settings are:
<code>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</code>
For ATmega328P set the fuse bytes as shown next:
<code>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</code>
If you use 328P and a PonyProg-Cable for COM or a Mikrokopter SerCon, type the following: (replace COM1 with actual COM-port):
<code>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</code>
-----
-----
'''Source files'''
'''Source files'''
Line 15: Line 58:
:*download ''[[Media:Gerber_for_PPM_Encoder.zip|PPM Encoder gerber & drill files (zip)]]''
:*download ''[[Media:Gerber_for_PPM_Encoder.zip|PPM Encoder gerber & drill files (zip)]]''
:*download "[[Media:Servo2ppm_manual_v4_2.pdf|PPM Encoder manual (PDF)]]"
:*download "[[Media:Servo2ppm_manual_v4_2.pdf|PPM Encoder manual (PDF)]]"
[[Category:Hardware]] [[Category:RC]]

Latest revision as of 19:08, 4 March 2012

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