Monday, August 2, 2010

Gold Rush Serial Data Packet Control

Over the last week I have been able to get wireless control working with my AVR micro. Communication to the AVR is being done by sending wireless serial data packets using xbee modules.
At the moment my packets consist of two header bytes (0xff) to designate the start of a new packet. The header is then followed with 4 bytes to hold the values of 2 joystick (horizontal and vertical axis). The packet is then ended with a checksum.

I have created a simple python and wxpython app to simulate the control of two joysticks using some slider widgets. This app simply reads the value of the 4 sliders, forms a data packet and writes it out serially to a xbee module connected to my PC around 30 times a second. demo window.

On the micro side I have a second xbee module connected to one of the atmega644's usarts. The micro is adding every byte it receives on this usart to a ring buffer. Then, when called, a function is able to search this buffer for a full data packet, pull out the joystick data and flush the buffer.

Here is a little video I took to demonstrate it all working. Off camera I am changing the values on the top two sliders in my python app. These two sliders represent the vertical and horizontal axis of a single joystick. In turn the value of each slider determines the walking direction of the robot.


  1. Good job!!!
    I just some questions. How did you connect your dynamixel servos to the MCU??? Which pins are you using since I have also notice that dynamixel have 4 connectors (instead of 3 like hitec)?? And how many can you connect to the atmega??


  2. The dynamixel ax-12 servos are connected to the TX and RX pins of USART1 on the ATmega. As the servos are serially controlled up to 255 can be addressed and controlled from a single USART on the mcu.