Monday, January 21, 2013

Making a sensor node for journalism: picking components and 3D printing useful bits

Open-source microcontrollers can be very handy for journalists: they can fly a data-gathering drone and control a data-gathering sensor node, among other uses. Previously I wrote how sensor nodes could be useful in a journalism investigation. Now it's time to leave the theory behind, and actually prototype one of these sensor nodes.

Fortunately, these open-source microcontrollers are available in a cornucopia of prototype-friendly flavors. It would be nice to solder all of our components to a fancy printed circuit board eventually, but for now it’s paramount that we can move connections around to solve any problems that we might encounter.

For my drones, I use a variety of the Arduino open-source microcontroller that’s been specifically designed to fly unmanned aerial systems (UA, for short). They come hard-wired with barometric pressure sensors, accelerometers, magnetometers, and other goodies that make flying a drone possible. One could re-program that controller to serve as the brain of a sensor node, but that would be overkill and a poor application this specially-designed $300 controller.

Raspberry Pi is another versatile microcontroller. Resourceful hackers have programmed the Pi to read books to the blind, run a time-lapse camera dolly, and even orchestrate a pyrotechnics display. The Pi is faster than the Arduino and has more memory, along with a GPU, and HDMI and VGA outputs. Those accouterments might be useful in later iterations, but none of that is essential for a basic sensor node, so the Ardunio remains the microcontroller of choice.

An ATmega 328 integrated circuit, the same kind found in the Arduino Uno. This one has a decal affixed that marks the names of the various pins.

Arduino boards have been in development since 2005, and several official and dozens of third-party versions exist. But at the core of each Arduino is an Atmel AVR microcontroller chip, which operates between 8 and 84MHz, and have between 16 and 256kB of flash memory. The most popular, official Arduino board is the Uno, which has a 16MHz ATMega 328 equipped with 32kB of memory.

The Uno has all the space we need for this application. When it comes time to make a more permanent version of this node, the chip and supporting components can be purchased separate and soldered onto a PCB. The Uno is even stocked at Radio Shack nowadays, so anyone living near to a Radio Shack can pick up the home game (there is a slight markup, so be warned – convenience comes at a price).

The Arduino Uno makes it easy to quickly piece together a prototype of a sensor node. But eventually, this microcontroller needs to be mounted in some kind of semi-permanent housing to test how everything handles in the elements. It would also be nice to have something to keep the Uno from touching the ground, and potentially shorting out one or more of its exposed connections. It needs a mount.

Arduino Uno on the left, connected to a solderless breadboard, right, with jumper wires. The lightbulb-shaped component sticking out of the breadboard is an infrared (IR) LED. I had programed this Uno to operate a DSL camera remotely, using the IR LED.

That’s where 3D printing comes in. This is another prototyping technology that’s deservedly gotten a lot of press in recent years. The general idea behind 3D printing is that for many industrial applications, it’s very handy to make a cheap, but precise mock-up of your part, before you go through the expensive process of making a version out of more durable materials. In the 3D printing process, designers will make a 3D model of the part, and send it to a 3D printer. The printer feeds a long strand of plastic filament through an extruder, which melts and layers the plastic according to the original three-dimensional design. Several hours later, and you have a small, physical version of your digital design.

As these 3D printers have gotten less expensive, members of the DIY revolution have found many more uses for the technology. Frequently these “makers” aren’t trying to make prototypes, but instead are making useful items, like quadrotor frames and other drone parts. They tend to distribute these designs freely on the internet, which makes it easier for other folks to overcome 3D design and printing learning curve. This also fosters a community where people continually revise and improve upon previous designs.

There’s no need to re-invent the wheel when it comes to 3D printing certain parts. A mounting solution for the Arduino Uno is no exception. And lo, in the MakerBot Thingverse, there are several options when it comes to Arduino holders.

I chose a design by the user javacoderx, who in turn made some changes on a design by the user Darthwahl. I downloaded the .STL file and gave it a whirl on the CU Community Fab Lab’s !UP printer.

The printing process, which took about an hour, was documented on a GoPro Hero2 camera. The footage was sped up 32 times to create the video at the top of this post.

Overall, the design was tight fit, but ultimately worked for the application. With the help of some hook and loop, the Arduino can now easily be mounted on pretty much any surface. I first used it to for an Arduino application to remotely trigger a DSLR camera for long-exposure photography (attempted to capture a meteor shower on film – might make a post on that in the future).

With some of the hardware sorted out, the next challenge is to wire up and code a simple sensor node. More to come.