Friday 9 March 2012

Two way xbee communication

Until now, the xbee radios have just been configured to work one way. As i want both teddy bears to be presence indicators i have to get them to work both ways. This requires feedback from both sides.

There is an example in the 'Building Wireless Sensor Networks' book which is titled the 'Arduino Feedback Doorbell'.

The router xBee circuit has to be modified and an extra LED added as a feedback indicator. I tried to revert to the original circuitry (without an LED), but the buzzer makes a short 'clicking' sound which isn't very noticeable so the LED will be used instead.

The two boards were then configured correctly and the example code from the book run on both. This didnt work at all. The serial.write command overwrites the serial.read command (arduino cant do both: just one or the other). The serial monitor is reading the command OR writing a command, not both so i am looking online for a solution. I found this link: http://www.robotshop.com/forum/showthread.php?614-Xbee-Series-2-Point-to-Point-Duplex-Configuration

This suggested that the xBees are not configured correctly.  The coordinator was previous addressed to itself which resulted in the serial commands been sent to itself in one of the xBees. The serial numbers and destination addresses have to correspond alternately on each xBee.This setup required the use of my adapter so i will pull the xbees out of the circuits and place them one by one on the adapter.

407635AE SL -  SERIAL NUMBER LOW
407A2427 DL - DESTINATION ADDRESS LOW

has to match on the other device:


407A2427 SL -  SERIAL NUMBER LOW


407635AE DL - DESTINATION ADDRESS LOW

This was reconfigured using X-CTU and an adapter. Now the code works perfectly. As soon as the router xBee recieves a signal from the button and lights up (red LED), it responds and sends a message which provides the presser of the button that its has been recognised (green light). This is almost instantaneous.

Below is a video of the new system working. Now that this is working correctly it can be built up around any architecture.




The next step is to incorporate this system into a working prototype to present to users and develop further.

No comments:

Post a Comment