Accelerometers, which track movement through three-dimensional space, are incredibly handy devices: we've seen them used for everything from alarm-centric Arduino boards to skateboard controllers for virtual reality, and Intel even embedded one directly into the Curie module which powers the new Genuino 101 board. Knowing what it does and knowing how to interpret the data it gives you, though, are two different things - which is why we're thrilled to see Chris Holden's latest experiments over at Nerd Club.
During experiments into using physical objects to control electronic systems - "rotating a mug on a coaster as a crude volume control," Chris explains, "or selecting images from a TV listings guide to change channels" - Chris and his colleagues connected a cheap MMA8452 accelerometer to an Arduino and captured its output as it was rotated along one axis. Graphing this output made visualisation of exactly what the accelerometer is tracking far easier: spotting offset sine waves, Chris and his team quickly figured out what was going on. "The axes on the accelerometer are all off-set by 90 degrees. And in our graph, we can see two values consistently offset by 90 degrees. So as the x-axis value increases, the z-axis value decreases. When x is at it's maximum value, z is zero. And all the while, the y value consistently remains at zero."
While the 2D graph and a later 3D Sketchup graph help to visualise exactly what is happening to the values when the accelerometer moves, Chris admits that actually using the figures can be trickier. "Complex 3d maths, matrix transformations and sine/cosine calculations are quite a bit to ask of a lowly 8-bit microcontroller - they only just cope with floating point maths! But with this in mind, there's no reason why we couldn't create a series of look-up tables, to estimate the sine-wave curves of the axis and use these to estimate the rotation of our objects, in world space."
One device that gets called up a lot when playing with the objects-as-controllers-idea is the accelerometer. Having an object that you can rotate in 3d space is a pretty powerful controller concept, with loads of possibilities. But first, we had to understand what all the funny numbers meant.