- Rob Faludi - https://www.faludi.com -

XBee Internet Gateway


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.

The XBee Internet Gateway gives any device the ability to connect seamlessly to the Internet by mirroring the interactions humans have with web browsers. Any device with an XBee radio can send a web URL to the XIG and receive back the contents of that web page. All the tricky technical aspects of web connections are all handled for you behind the scenes. This simple service gives your prototype or device a simple yet completely flexible pathway to any web service that you can imagine, including posting sensor values, scraping Facebook or commanding your robotic kitten army.

To use the gateway you need to:

  1. Configure your Series 2 radio as a ZB firmware Router or End-Device. Series 1 just use the latest firmware.
  2. Switch the PAN to AAAA: ATIDAAAA
  3. For best results, set your radio to 115200 baud: ATBD7 
  4. 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:


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:


…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:[email protected]/path retrieves a URL using username and password
  • https://username:[email protected]/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: