Arduino Xbee/Ethernet Gateway
When building internet enabled devices my original choice was to provide network access with a hard wired ethernet cable. This proved to be problematic because of the need to have ethernet wire running to multiple placest and also because Arduino ethernet modules or ethernet serial devices are expensive.
My next step was to investigate choices for wireless to see if I could share a single expensive Ethernet sheild to multiple wireless devices in a less costly manner. Traditional wifi 802.11x devices proved to be even more expensive than the ethernet sheilds so I next decided to investigate more nontraditional protocols. Plain RF devices were fairly cheap, low power, plenty of distance and speed for what I needed. Xbee radios turned out to be my solution as they are half the price of an ethernet shield, transmit reliably, offer moderate speeds and long range (up to 2 miles!). With this in mind, I began to develop my gateway that would give local Xbees network access.
The gateway shown below has an Xbee radio, Lantronix Xport and Arduino with custom software to enable Xbee devices limited access to the local network. The gateway is able to accept incoming direct TCP connections, or accept out going HTTP get requests. Only one device may access the gateway at a single time, but multiple devices are addressable by name or commands may simply be broadcast to all attached devices. The gateway does not presently perform authentication of devices, so it is advised to make sure it cannot access any sensitive network resources.
The build was prototyped on a breadboard and the "final" board design was created on perfboard. A limited run of actual PCBs is intended for anyone interesting in purchasing one. Please contact me by email to have your name put on a request list. The estimated price is $10 a board, shipped to anywhere in the US.
- Arduino ATMEGA 328
- Lantronix XPort
- Xbee Series 2
- 5v Regulator
- 3v Regulator
- 9v Power Supply
- Barrel jack for power supply
Communicating with the gateway
The gateway understands a few basic commands. All completed commands need to be followed by 2 new line characters. Commands are send in the format of COMMANDCHARACTER PARAMETER DOUBLENEWLINE (only with no spaces).
- ? - Causes gateway to send a list of commands it can understand.
- H - 1 Parameter of the host name of the server you are conncting to. This is needed if your server hosts multiple domains.
- S - 1 Parameter of IP Adddress of the server you are connecting to.
- F - 1 Parameter of the file name with path that you want to retrieve.
- P - 1 Parameter with port number you wish to connect to.
- D - Gateway will print back it's loaded configuration for it's next connection
- R - Resets the gateway so it is ready to process a new request
- G - Retrieves a request with the loaded parameters and returns the results to the client
The Arduino software is posted below. It uses the NewSoftSerial library for one of the devices serial connections.
- Arduino Software
- NewSoftSerial Library