To help you visualize the data, we've put together a basic Processing sketch that loads a 3D model (in the .obj file format) and renders it using the data generated by the AHRS sketch on the Uno. The ahsr sketch on the uno published data over UART, which the Processing sketch reads in, rotating the 3D model based on the incoming orientation data.
The OBJ library is required to load 3D models. It isn't strictly necessary and you could also render a boring cube in Processing, but why play with cubes when you have rabbits?!
Opening the Processing Sketch
The processing sketch to render the 3D model is contained in the sample folder as the ahrs sketch for the Uno.
With Processing open, navigate to you Adafruit_AHRS library folder (ex.: 'libraries/Adafruit_AHRS
'), and open 'processing/bunnyrotate/bunnyrotate.pde'.
You should see something like this in Processing:
Run the AHRS Sketch on the Uno
Make sure that the appropriate AHRS example sketch is running on the Uno (as described on the previous page), and that the Serial Monitor is closed
With the sample sketch running on the Uno, click the triangular 'play' icon in Processing to start the sketch.
You should see a rabbit similar to the following image:
A Note on Accuracy and Calibration
Note that the movement seen on the screen won't correlate exactly to the breakout since we are currently using uncalibrated sensor data
, specifically uncalibrated magnetometer data which will throw the heading off. The magnetometer is required to generate 360° data, and if you want to improve the accuracy of your orientation data we have a tutorial on calibrating the LSM303
, but this particular example starts with raw data for simplicity sake.