Go Down

Topic: [Bumped!] Wireless Joystick with Arduino control for 3pi Pololu robot (Read 8290 times) previous topic - next topic


Here one of my robotics projects.

Video of the wireless control and 3pi in action!

XBee control for a 3pi Pololu robot using Arduino and a joystick.


XBee Joystick Control:
-Arduino Fio (Osepp Fio)
-XBee 802.15.4 module (Transmitter)
-2-axis joystick (Parallax 27800)
-Rechargeable baby battery (Dantona 3.6V/1500mAh Ni-MH)
-Miniature toggle switch
-Project Enclosure (4 x 2 x 1)

XBee 3pi Pololu Robot:
-3pi Pololu robot
-3pi wireless robot shield
-XBee 802.15.4 module (Receiver).
-4 AA batteries.

-Arduino IDE 1.0 (see below)
-Atmel Studio 6 (see below)
-Pololu USB AVR Programmer
-Xbee/USB board (XBee-USB Gravitech)

Code 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 an 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 finally 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.

Electric Schematic

Code sample:
The C++ code of the robot was compiled using Atmel Studio 6 and programmed in the Atmega328 of the robot using the Pololu USB AVR Programmer. The Fio code was done using Arduino IDE.

New sketches for the robot and Fio will be posted soon! [Update: 12/10/14]




could you post your complete code? I want to know how you recieve the



I used AVR Studio for programming the robot and Arduino IDE for the Fio. Given that the people from Pololu recently developed an Arduino Library for the 3pi Robot (and the Orangutans), I've ported the robot code to Arduino making this project fully developed in the Arduino environment. I will be posting soon both sketches (robot and Fio). Stay tuned!


Go Up