Here's an AirCasting sensor device made by @tamberg for a city walkshop held with the Internet of Things Zürich Meetup. The device is built with Gadgeteer modular hardware and has an enclosure prototyped at MechArtLab and laser-cut at the FabLab Zürich. This Instructable shows how it was built, and documents an easy way to prototype and realize custom gadgets.
(Update: this project, including a see-through version, was featured at Maker Faire Rome 2013 as a part of the Internet of Things Zurich showcase.)
AirCasting is a citizen sensing project which originated in New York. The AirCasting Android app allows anyone to record and display geotagged environmental measurements on a cloud hosted map.
External AirCasting sensors can be connected to the app via Bluetooth. There is an official AirCasting Air Monitor sensor with Arduino hardware and a 3D printed enclosure. The alternative sensor device presented here was possible because the AirCasting app is open source and uses a simple and open protocol to receive measurements from external sensors.
Gadgeteer is an open convention to build modular hardware initiated by Microsoft Research, based on the open source NETMF framework and toolchain. Mainboards and modules are produced by a small ecosystem of manufacturers. Most modules are open source hardware. Besides being quite expensive, the modules are great for fast hardware prototyping.
So let's begin!
Step 1: Getting Hardware Modules, Enclosure Material and Tools
Be warned, the hardware cost of this project is rather high, starting at roughly $160. Prices hopefully come down once more manufacturers start providing modules. Luckily this hardware was available at our office (Disclosure: some of my colleagues are NETMF core contributors and produce Gadgeteer mainboards, though not the ones used here), but the main reason to chose it was that I believe such coarse grained, user level modular hardware is the future.
I had a FEZ Spider (http://www.ghielectronics.com/catalog/product/269, $119.95) laying around, but others are a lot cheaper, e.g. the FEZ Cerberus (http://www.ghielectronics.com/catalog/product/349, $29.95). Any Gadgeteer mainboard that has at least two A, one D, one U and two Y connectors is perfectly fine. The source code is available on Bitbucket.
The original device measures CO, NO2, temperature and humidity. There is a Gadgeteer module for GasSense compatible sensors (http://www.ghielectronics.com/catalog/product/393, $14.95). It comes with an MQ-3 alcohol sensor. I tried to get two better suited drop-in replacement sensors, namely an MQ-135 (http://www.futurlec.com/Gas_Sensors.shtml#MQ135, $6.90) and a CO sensor (http://www.futurlec.com/Gas_Sensors.shtml#COSENSOR, $6.90). Unfortunately, Futurelec could not deliver those yet (after a month). So I kept the MQ-3 as a placeholder and went for the GHI Temp & Humidity module (http://www.ghielectronics.com/catalog/product/344, $17.90) on the other side.
Bluetooth and the sensors require quite a lot of power, so I used the Liquidware Lithium Backpack (http://www.liquidware.com/shop/show/MBP/Lithium+Backpack, $47.36) as it's compact and includes charging circuitry. As far as I know there is no LiPo Gadgeteer module available, but it's easy to solder a non-Gadgeteer module to a breakout module (http://www.ghielectronics.com/catalog/product/405, $4.99) using three jumper wires. For the cardboard prototype a simple battery module was used, which is not needed for the laser-cut version (http://www.ghielectronics.com/catalog/product/394, $27.95).
To transfer measurement data from the device to the AirCasting app a Bluetooth module is required (http://www.ghielectronics.com/catalog/product/312, $39.95). And to initiate the Bluetooth pairing mode we need a button (http://www.ghielectronics.com/catalog/product/274, $4.95).
Note that the device does not include any memory (other than on the mainboard). Measurements are sent to the AirCasting app immediately, so there's no need to store anything.
You'll need cardboard for prototyping (optional) and 3mm MDF wood sheets for laser-cutting. The SKP and DXP files are on Thingiverse. The modules are mounted with M3 nuts and bolts (7 M3 x 10 mm and 8 M3 x 16 mm).
A cutter and a hot glue gun (for cardboard), a laser cutter (for MDF), a metal saw, a screwdriver and a soldering iron were used. Plus a computer running Windows to program the mainboard.
A Nexus S works fine, but any other Android phone with GPS and Bluetooth should do the job as well.
Step 2: Connecting, Programming and Testing the Modules
The code of the original Arduino-based AirCasting sensor is open source and well documented. There you can see that the sensor uses a simple format to send measurements to the AirCasting smart phone app over Bluetooth serial:
<Measurement value>;<Sensor package name>;<Sensor name>;<Type of measurement>;<Short type of measurement>;<Unit name>;<Unit symbol/abbreviation>;<T1>;<T2>;<T3>;<T4>;<T5>
e.g. for temperature, a string like "7;Gadgeteer;Gadgeteer Temperature;Temperature;C;degrees Celsius;C;0;10;15;20;25\n" is sent.
On Gadgeteer, using Bluetooth is not as easy as it could be. Mike Dodaro's post points out Eduardo Velloso's library. The library is great, but to make it work with a newer NETMF version (which some main-boards require) further tweaks are necessary.
Here's the Gadgeteer AirCasting source ZIP. Note that the project is named GadgeteerApp3 as I could not manage to rename it and didn't have the nerves to start from scratch. Also note that the Bluetooth module is not included in the wiring diagram. It should be connected to port no 11 on the main-board. If the project does not build you might have to add a reference to the above Bluetooth library and probably also to the Gadgeteer.Serial library.
In case you're new to Gadgeteer, follow e.g. http://www.netmf.com/gadgeteer/get-started.aspx to set up the required tools and get started.
Step 3: Prototyping the Enclosure With Cardboard
Here's how the device enclosure was prototyped with cardboard and a cutter (inspired by the Citizen Sensor). If you've got access to a laser cutter, you can skip this step and proceed with laser-cutting. If not, this might be a cheap way to get a somewhat acceptable enclosure. Use lots of hot glue.
Step 4: Laser-cutting the Enclosure
Using the cardboard prototype as a reference, the laser-cut enclosure was designed with Sketchup and iterated many times. Here are the final design files on Thingiverse. Files named _etching_ should be etched or cut with very low power. The (identical) top and bottom covers are bendable. Bending them e.g. around the edge of a table makes them easier to use, but be careful not to break them.
Step 5: Mounting the Modules
Check the cuts and etching on the base plate to see how the modules fit onto it. The battery goes to the opposite side. Inserting all the bolts in the right orientation and order can be a bit tricky. Open the file AirCasting_Gadgeteer_Assembly.skp in Sketchup to get an interactive version of the assembly drawing. The longer bolts are M3 x 16 mm, the shorter ones M3 x 10 mm. The Gadgeteer cables can be added after mounting, with two exceptions: the cable to the battery adapter has to be inserted into the square hole, and the button cable has to be plugged into the button module before mounting it, its connector going into the same square hole.
The two sensors are inserted vertically into the cutouts from the upper (etched) side. Take care not to break them. Once all the modules are in place, wire them (again) as shown in Step 2. Solder the three jumper wires to the battery adapter (5V, 3V3, GND) and connect them to the LiPo battery.
A little side note: MSR recently donated CC licensed 3D models of many Gadgeteer modules (see http://gadgeteer.codeplex.com/SourceControl/latest > Main > 3D Models > MSR). They come in a format called STEP which seems to require a commercial Sketchup extension. If you can convert STEP to SKP or STL, please consider converting and uploading them to Thingiverse. However, it's also quite easy to draw your own, as done here. Feel free to reuse the nuts and bolts, too.
Step 6: Assembling the Enclosure
First, mount the upper back panel. Use a M3 x 16mm bolt to trigger the button. It might be necessary to saw off a little bit of it.
Then the lower back panel. The laser-cut battery switch is guided by two bolts. Take care not to break the small battery switch. And yes, the USB port is not accessible once the panel is mounted. That's probably the main design flaw. On the other hand it's quite easy to remove the panel for charging.
Now, make sure the cables are packed flat, then add the top and bottom covers. Everything should gently snap in place. Glue is not needed. In contrary, it's a plus that you can open the device whenever someone asks what's inside.
Step 7: AirCasting in the Field
Install the AirCasting app on your Android phone. Switch on the device and press the Bluetooth pairing button to pair the device with your phone. Open the AirCasting app and go to Settings > External device, then select the paired device. You should now see additional values on the screen. To start a session, press the app's record icon.
Gather some friends, walk around in your city and collect data. Or strap it to your bike and use it every day. To get the data out of the app you can either share it at the end of the session (i.e. it's published to this map), or export it as a CSV file.
That's it. Thanks to the originators of AirCasting for the great platform, @dusjagr for the hot glue, Oli at FabLab Zürich, Andy who got me the LiPo, Cuno at Oberon for letting me use the Gadgeteer modules and of course you, for reading all this and spreading the word.