Here one of my robotics projects.
It is a simple Transmitter-Receiver wireless control.
The transmitter comprehends an Arduino Fio with a XBee 802.15.4 module, a 2-axis joystick and a rechargeable baby battery.
The receiver comprehends a 3pi Pololu robot with 3pi wireless robot shield, a XBee 802.15.4 module and 4 AA batteries.
Robotics control concept:
XBee Joystick Control:
Continuously, the Fio reads the X and Y analog voltages (0 to 3.3v) from the joystick's potentiometers connected to A0 and A1. Each voltage represents the position of one of the axis of the joystick as a raw motor speed reference. When the joystick's knob is in its origin, the axis voltages are the same: 1.65v. The Fio converts each axis voltage into a value between 0 to 256 (1 byte). Then, dividing them by 16, each value is scaled into 4 bits (1 nibble). Finally, the Fio packages them into one byte and sends this data byte via XBee to the robot.
XBee 3pi Pololu Robot:
Continuously, the robot receives a data byte from the wireless control and breaks it back down into two nibbles. The most significant nibble indicates the position of one of the axis of the joystick, and the least significant nibble for the other axis. This gives 2 ^ 4 = 16 different speed readings that the code converts into motor voltages.
One joystick axis controls throttle (forward/reverse) and the other to controls steering (left/right). I mixed the axis readings as follows:
LeftWheel = motorSpeed1 + motorSpeed2.
RightWheel = motorSpeed1 - motorSpeed2.
Where motorSpeed1 is throttle and motorSpeed2 is steereing.
Notice that if motorSpeed2 is zero, both motors are set to the same speed and if motorSpeed1 is zero, both motors are set to opposite speeds.
Both XBee radio modules have been matched up using X-CTU.
You can find more details of this project at the Arduino forum.
I am Palliser