Xbee Remote controlled robot with telemetry

This project develops a remote controlled robot with telemetry. The robot is controlled through Xbee. It will send back the battery voltage and distance sensor information to the controller. The controller will update the information in a LCD screen in real time.

Robot: /media/uploads/yhbyhb4433/img_2804.jpg

Controller: /media/uploads/yhbyhb4433/img_2805.jpg

Team member

Hanbin Ying

Muhammad Abdullah

Alfredo Monzalvo Jr.

Description

Xbee

We use two Xbee modules (Chip number: XB24-DMWIT-250) for communication, one at the controller and one in the robot. Xbee module uses serial communication. We initialize tx/rx pins using the default Mbed serial class. All commands are a single integer.

Communication Protocol

To control the robot, we send encoded commands from the controller and the receiver decodes the command. The problem with telemetry is two-way communication. For this project, the command is so simple that it does not justify a complicated overhead for two-way communication. Therefore, we set up the communication using master/slave protocol. The master, or the controller, will always initialize the communication, either sending commands for robot movement or requesting information. The slave, or the robot, will always listen for the command. If a command is to move, it will control the motors to perform corresponding movement. If the command is to request information, it will immediately send back the requested information. Through this protocol, we greatly reduce the overhead for communication and make the communication link fast and responsive.

The ADC reading is a float between 0 and 1. Because Xbee only sends integer, we times the ADC reading by 232 and round it to an integer before sending it. The number "232" is experimentally determined to be the maximum integer that a Xbee can send reliably. We are not sure about the reason. The receiver will divide the received number by 232 to get back the original ADC reading.

Command code:

Encoded number=CommandSlave Action
11forwardboth motor rotates in the same forward direction
12reverseboth motor rotates in the same forward direction
13leftright motor rotates faster and left motor rotates slower
14rightleft motor rotates faster and right motor rotates slower
15batterysend back the battery voltage read from ADC
16distance sensorsend back the distance sensor reading from ADC

Distance sensor

We use a Sharp IR distance sensor placed in the front of the robot. It is a pretty nice and responsive sensor that converts the distance to a 0-3.3V analog voltage. The inverse distance is linearly related to the analog voltage, as shown in the graph. We use a linear approximation to scale the inverse voltage to a centimeter reading.

Datasheet: (http://sharp-world.com/products/device/lineup/data/pdf/datasheet/gp2y0a21yk_e.pdf) /media/uploads/yhbyhb4433/untitled.png

Battery Reader

A resistive divider (150k, 150k) is used to scale battery voltage down and read into ADC. The voltage is read by Analogin at pin 20 of the mbed. The circuitry is shown below. The voltage divider is used to drop the battery voltage (Vcc) to a safe, readable level. The battery information is then transmitted via Xbee and displayed on LCD. We use 4 rechargeable Eneloop NiMH AA batteries for a total of 5.2V. They power two motors, the Mbed, and the distance sensor. The battery is very strong. We did all testing on the robot for a month, and the battery only drops to around 5V, still enough to power everything fine.

/media/uploads/yhbyhb4433/4180remotecontrol.png

LCD

The LCD display is the 128*128 uLCD from L3. We use RTOS to update the information once every 0.3s. There is a mutex lock on the distance or voltage variable. The reason is that, when the LCD is trying to accessing the global variable, the variable should not be updated by other routines in the meantime. Without the mutex lock, the thread will crash. This mutex lock also makes sure only one process is accessing the LCD at the same time.

Wiring Diagram

The wiring of the Xbee is shown below. The Mbed pin number can be changed as long as they satisfy the requirement. One important thing to note is that Xbee module has a smaller pitch than 0.1'. It needs an adapter https://www.sparkfun.com/products/11812) if users want to install it on a breadboard.

Controller pinout:

Xbee #Xbee pin nameMbedLCD
1VCC3.3V
2Doutrx (p10)
3Dintx (p9)
5ResetDigitalOut (p11)
10GNDGND
othersnot connected
tx (p13)tx
rx (p14)rx
p28reset
GNDGND
VU (5V)5V

Slave pinout:

mbedH-bridgeMotor
gndgnd
VoutVcc
Vout/STBY
VU(5V)*Vmot
p26PWMA
p25AIN2
p23BIN1
p22BIN2
BO1RIGHT-BLK
BO2RIGHT-BLK
AO2LEFT-BLK
AO1LEFT-RED

Video Demo

Controller Demo

The video demo the communication between master and slave Xbees which are present at controller and robot respectively. Control inputs for various manuevers of the car are requested at the controller and the the desired actions are executed by the robot.

Telemetry

This video specifically shows how the required information is sent back to the master and gets displayed in the uLCD. When the master sends the encoded signal to request battery voltage and sensor information, the values are sent by the slave and are stored in the variables. A separate routine periodically updated the value on the LCD.

Demo Code for Controller

This is the demo code for controller.

Import program2Xbee_Controller1

Xbee robot with telemetry, controller code

Demo Code for Robot

This is the demo code for the robot.

Import program2Xbee_Robot

Xbee robot with telemetry, robot code


Please log in to post comments.