![]() |
||||||||||||||||
|
Vex Radio DecoderThis is a PPM signal splitter for use with the VEX radio transmitter/receiver kit sold at All Electronics For $30 at All Electronics, you can buy a 6 channel radio transmitter and receiver. The transmitter is excellent for $30, trim, scaling, mixing are all programmable on the transmitter itself and it stores several configurations. The receiver only has one output pin, which outputs a PPM signal which needs to be split into individual channels in order to be able to control servos. If you put the receiver right side up and with the socket facing you, the pin on the far left is the Vdd pin, connect this to a regulated 5 volt power supply, the middle left pin is the PPM output pin (it is open collector so a pull up resistor is needed), and the middle right pin is the Vss pin, connect this to your circuit's ground, the far right pin is not connected to anything inside the receiver.
The 6 channel PPM signal has 7 periods of high and low pulses, each of these pulses all start with a high period of 500 microseconds, and a low period of varying lengths. The first low period is a sync pulse with a fixed low period of about 7 milliseconds, this exceptionally long low period indicates the next rising edge of the PPM signal will indicate the pulse start for channel 1. The period from the rising edge to rising edge of the a pulse is equal to the period of the high pulse that should be sent to the servo. Here's the logic analyzer session file of the decoder in action. You will need to use the software provided for Logic (use version 1.0.28) to open and view this file. All the timing data will then be available for you to measure. The start of the recording is triggered by the transmitter being powered on. New Version 2I've recently rewrote the code from scratch, version 1 is still available below. This new version eliminates any timing errors because everything is handled by the 16 bit timer's input capture feature. Timer overflows help determine whether or not the transmitter is missing, and if it is missing, the port is disabled. The serial port can be used to retrieve the pulse width of the channels. The baud rate is defined when you compile the code. First send the channel number, then wait for a three byte reply, the first byte will be 0x01 if the data is good, or 0x00 if the transmitter is missing, the next two bytes is the width of the channel pulse as a 16 bit integer, most significant byte being sent first. Pulse width is given in clock cycles and thus it varies based on the clock frequency you choose to use. Old Version 1My PPM signal splitter uses an ATTINY2313 programmed with AVR-GCC. External interrupts are configured to run the interrupt routines after each rising edge on the PPM pin, and the pulses are sent to the individual servos inside these routines. A 16 bit timer is used to record the length of each servo pulse, and a 8 bit timer is used to detect the sync pulse (using 8 bit for this task speeds up the execution and this reduces timing error). The serial received interrupt will cause the the program to read the byte received as a request for pulse width for the channel number sent, and the ATTINY will return a status byte followed by a 16 bit value representing the pulse width in microseconds. If a sync pulse is not detected within a time frame (overflow interrupt on the 8 bit timer), then the ATTINY assumes the transmitter is off or out of range, a status LED will be turned off to indicate so while all channels will be turned off. The easiest way to use this splitter is to just connect your servos right to the ATTINY. If you need to control a microcontroller with the Vex transmitter, you can connect the UART of your microcontroller to the ATTINY using a baud rate of 9600. To request the pulse width of channel 1, send 0x01 to the ATTINY and it will first return a byte equal to 0x01 or 0x00, 0x01 means the transmitter is off or out of range, the 2nd byte returned by the ATTINY is the upper 8 bits of 16 bits, and the 3rd byte returned is the lower 8 bits of 16 bits, these 16 bits represents the pulse width of the channel in microseconds. To build the splitter, simply connect the power and ground to the ATTINY, connect the PPM output of the receiver to pin 2 of port D (the internal pull up resistor is used so you do not need an external resistor), and pins 7 to 2 on port B are channels 1 to 6 (in that order, 7 = 1 and 2 = 6). A 0.1 microfarad capacitor should be placed between the power and ground of the ATTINY, and if you need the splitter to share battery power for the servos, you need a 5 volt voltage regulator, and a 470 microfarad capacitor between the battery positive and negative. Add a power switch if you need to. version 1 source file: Download C file |
|||||||||||||||