Using a WiFly to Network Air Quality Sensors

The Roving Networks WiFly RN-XV is a nice little device. For $35 at SparkFun you get a low-power 802.11b module with a real-time clock, analog and GPIO pins, basic DNS and HTTP literacy. It’s a perfectly capable wireless sensor node, just by itself. It even has a nifty UART trigger mode, where incoming serial input will send a basic GET request to your favorite URL with the payload tacked on.

After skimming through the WiFly RN-XV user manual, and mucking around for a few hours, I figured out how to make it function as a serial-to-HTTP bridge. Here’s how to configure it once you’re in command mode (send $$$ first):

Although the WiFly won’t form proper PUT requests, with the CSV content in the HTTP request body, I managed to rig up a Django instance to catch the GET requests, reshape them, and pass the result on to the Cosm API. The Dylos terminates each CSV string with a newline, which breaks the mechanism (the newline puts the “HTTP/1.0″ onto a line of its own). This makes it possible to easily WiFi-enable a Dylos, which transmits CSV strings over its serial port every 60 seconds or so.

Since the Shinyei PPD42NS doesn’t have an analog output, I still have to include the Arduino (to integrate the digital signal) for that to function. So, now that I’ve got the WiFly acting as a bridge, if I just pipe out the values once every 5 seconds or so on the Arduino’s UART, with the WiFly seated in the Wireless SD shield, the UART trigger on the WiFly functions perfectly!

Here’s the resulting feed: https://cosm.com/feeds/64464

The main benefit, I think, is that I don’t have to use any third-party Arduino libraries to communicate with the WiFly. It makes things simpler, and it saves space on the Arduino for other code. That said, I’m really looking forward to restock of the Hydrogen and Platinum at DIY Sandbox.

Update: This setup has been easy to repurpose for connecting other serial

Comments are closed.