Wireless data transfer using XBee modules
Description: This project does a data transfer using XBee modules. We read the data from a compass module CMPS03 Digital Compass (sensor). This data is read in using the I2C ports of the MBED and transferred to the serial port to which the XBee transmitting module is connected. The Compass function compass.readBearing() returns an integer value for the angle. This value is passed on to the serial port to which the XBee module is connected. This data is transmitted over the XBee wireless link. At the receiving end, we have another XBee module receiving data and passing it onto the serial port of the MBED. Then it can be displayed using an LCD or a serial port (Tera Term).
Care must be taken regarding the type of function used for writing and reading data from the serial port at the transmitter and receiver respectively. There are two options - either we can use the pair of printf() and scanf() statements or, we can use the pair of putc() and getc(). We used printf() and scanf() in this project since the 'direction' is a floating value and cannot be used as a variable for the getc()/ putc() function.
The scanf() function reads the numeric data till it receives the first non-numeric character. So inserting a null character or a new line is extremely important else the scanf() would keep on adding the value received & would eventually overflow.
The receiving module should read the data only when it is readable. Use the readable API function of the serial port to detect that & give sufficient delay between each transmission/reception.
XBee Connection Diagram:
1 VCC 3.3v
2 DOUT mbed serial rx (e.g. p10)
3 DIN mbed serial tx (e.g. p9)
4 not connected
5 RESET mbed digital out (e.g p11)
6-9 not connected
10 GND 0v/GND
11-20 not connected
6 comments on Wireless data transfer using XBee modules:
Please log in to post comments.
Project Members: Anoop Mahadevan, Vrajesh Sheth