Jordan Husney, Ted Hayes and myself have written an XBee Internet Gateway [1] for the ConnectPort X2 [2] so that any microcontroller-powered device prototype can connect directly with the Internet. This system is now in use at ITP and in several other locations. Plain URLs sent from an XBee radio (Series 2 XBee ZB or Series 1 802.15.4) radio are processed by the Gateway, retrieved from the Internet, and results are returned to the sender.
To use the gateway you need to:
- Configure your Series 2 radio as a ZB firmware Router or End-Device. Series 1 just use the latest firmware.
- Switch the PAN to AAAA: ATIDAAAA
- For best results, set your radio to 115200 baud: ATBD7
- Set the destination address to zero: ATDH0 and ATDL0
When you’re ready to go, attach the XBee to your Arduino’s hardware serial port (pins 0 and 1), then send a URL and you’ll get back the response. For example to send your request from Arduino:
Serial.println(“http://www.faludi.com/test.html”);
And to read the response back:
if (Serial.available()) {
char inChar = Serial.read();
print ( inChar );
}
Of course, you’ll be doing something way more interesting than just that! Some useful things to know:
Once your XBee is associated to your gateway, you may retrieve the contents of a website from your XBee by sending the URL of the site to the gateway via your XBee. For example, sending:
http://en.wikipedia.org/w/index.php?title=Hello_world_program&printable=yesrn
…will retrieve the printable version of Wikipedia’s entry on a
“Hello, World Program” to your XBee. Note that the “r” and “n” characters are the ASCII carriage-return and line-feed characters.
There are other commands available when using XIG:
All commands are CR “\r” or NL “\n” delimited, except where noted.
- help or xig://help: displays this file
- quit or xig://quit: quits program
- abort or xig://abort: aborts the current session
- http://host/path[:port] retrieves a URL
- https://host/path[:port] retrieves a secure URL
- http://username:password@domain.com/path retrieves a URL using username and password
- https://username:password@domain.com/path retrieves a URL using username and password
- xig://time retrieves the current time from the gateway
- udp://host.domain.com:portnumber sets up a remote UDP streaming connection
- osc://host.domain.com:portnumber sets up a remote OSC connection
- …and pointing any I/O sensor information at the gateway sends I/O samples up to a pre-specified web site
IV. Known Issues
The following URL schemes are not yet supported (help contribute!):
- ftp://
- ftp://
- telnet://
- mailto:
Source code [3] is available online for anyone who wants to download it or participate in development. There are also some sample files [4] that may be useful once the gateway is installed on a ConnectPort device.
XIG Projects: