7/18/2012

XBee Internet Gateway now for Windows, Linux and Macintosh

The XBee Internet Gateway - an open-source project written in Python - is now released to be run under Windows, Linux and Macintosh (XBee Internet Gateway Software).

Before you had to connect a Digi ConnectPort or any other form of XBee/ Ethernet combination to feed data through your XBee(s) into the internet. Now you just connect the XBee on a USB adaptor to your PC and run the XBee Internet Gateway software.

Carefully read the installation instructions, because your XBee firmware needs some special settings to connect to XIG. After this it should look like this:

XIG Windows software displayed in browser

7/11/2012

Raspberry Pi and XBee

XBee perfboard hooked up to the Raspberry Pi
One nice gadget to play with is the quite new Raspberry Pi. I added a XBee (Coordinator AT) to the RasPi and sent some serial data to an Arduino UNO (and back) with a XBee attached (Router AT) via serial terminal (minicom) and Python.

The RasPi is running on Debian wheezy and the perfboard is connected via two row header sockets to the GPIO pins.


The 3.3V for the XBee is directly coming from Pin 1 of the GPIO-Header (GND from Pin 6), DOUT is connected to Pin 10 (GPIO RXD) and DIN to Pin 8 (GPIO TXD). I didn't test it with a XBee Pro attached, this will certainly draw too much current from the RasPi. The 3.3V supply only delivers 50mA as per this wiki . This is fine with the normal XBee which has 40mA max. current demand as per datasheet. If you need more current (XBee PRO needs 295mA@3.3V when transmitting with maximum output power) you could use the 5V power source with a subsequent voltage regulator as mentioned in the blog entries before. Be careful to use a voltage regulator with enough capabilities to deliver ample current.

Still enough legroom for the Raspberry Pi
One big advantage beside being wireless is that there is no level converter needed as the signals are 3.3V TTL to and from the Raspberry Pi.

To get the whole thing working you have to modify some settings in Debian wheezy. There is a nice walkthrough in this blog.

If you want to communicate via Python you have to get pyserial (sudo apt-get install python-serial or sudo apt-get install python3-serial for Python3). Example code for Python2 to send a value to the Arduino would look like this:

import serial
xbee=serial.Serial(port='/dev/ttyAMA0',baudrate='9600')
xbee.write('8')


For Python3 you would have to change the last line to:

xbee.write(b'8')


to send as a String.

On the Arduino side you could read the incoming data with Serial.read().

Connecting the whole thing together gives a huge amount of opportunities for future projects as one can use the combined cpu power/ linux system/ graphic abilities of the Raspberry Pi and the microcotroller skills and shields of the Arduinos - everything wirelessly connected in a mesh network.