Introduction: Arduino Motion Shield
Hey everyone! A couple of days ago, I got my hands on Arduino.org's "9 Axes Motion Shield". In other words, this baby.
Now, this thing has somewhat complicated instructions, and needs you to install the Arduino.org IDE to be able to use the library, but instead of that, we'll be using codebender* instead, to get this thing working right away
So as it turns out, this shield is pretty awesome, and it can give you Acceleration, Magnetometer & Gyroscopic data on all three axes (X, Y, Z), but it can also calculate the Euler vector. This is essentially Roll, Pitch, and Heading, which is cool if you wanna visualize where your device is pointing, track movement, etc. But I don't want to get into too many details on this 'ible, so I'm just going to show how we can use this shield, program our Arduino, get some data, and visualize it.
*yes, this is my shameless plug, deal with it! And so: disclaimer, I'm the founder of codebender
Step 1: Program the Shield!
To make this as easy as possible, I've created a sample sketch, which includes all the necessary library files, and I've even embedded it here using codebender's embedding functionality.
It's a slightly modified version of Arduino.org's Accelerometer example, that just gets the values and prints them on the screen. I've removed some extra comments so that we get a nice clean output for visualization.
If you want to use the code on your own Arduino, just install codebender's browser plugin/app, if you haven't already. Then select your Board and Serial Port from the dropdown boxes, and click Run on Arduino. This will compile the code and program your Arduino board with it.
Step 2: Serial Monitor - Get Data
I've also embedded codebender's serial monitor here, so we can take a quick look at the data. Alternatively you can go to the codebender Serial Monitor page, or use your program of choice to connect to your Arduino, i.e. CoolTerm, Putty, etc.
Make sure to select 115200 as the Baudrate/Speed, since this is the speed our Arduino is programmed to talk to.
After connecting to your Arduino, you should start getting data soon, and it should look like the picture above.
Step 3: Visualize It!
In the interest of making this as simple as possible, I'm using Graphite, a small, experimental service by codebender that we just coded on a weekend as a cool idea. Because it's an experimental free-time project, it only works on Firefox, so keep that in mind if you try to use it.
Of course, you can use any kind of visualization tool that talks to a serial port. I'm not aware of any, but I'm sure there must be some Python library or whatnot. And at the end of the day, you can always gather the data from the Serial Monitor of your choice and copy-paste them to an Excel Spreadsheet (or similar).