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 BNO055 sketch on the Uno. The "bunny" sketch on the uno published data over UART, which the Processing sketch reads in, rotating the 3D model based on the incoming orientation data.
- Processing 2.x
- Note that you can try later Processing versions like 3.0+ too. On some platforms Processing 2.2.1 has issues with supporting 3D acceleration (you might see 'NoClassDefFoundError: processing/awt/PGraphicsJava2D' errors). In those cases grab the later Processing 3.0+ release and use it instead of 2.x.
- Saito's OBJ Loader library for Processing (included as part of the Adafruit repo since Google Code is now 'End of Life').
- G4P GUI library for Processing (download the latest version here and copy the zip into the processing libraries folder along with the OBJ loader library above). Version 3.5.2 was used in this guide.
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?!
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_BNO055 library folder (ex.: 'libraries/Adafruit_BNO055'), and open 'examples/bunny/processing/cuberotate/cuberotate.pde'. You should see something like this in Processing:
Make sure that the "bunny" example sketch is running on the Uno, 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.
Before the rabbit will rotate you will need to click the : to the right of the serial port name. This will open a list of available serial ports, and you will need to click the appropriate serial port that your Arduino uses (check the Arduino IDE to see the port name if you're unsure). The chosen serial port should be remembered if you later run the sketch again.
As you rotate your breakout board, the rabbit should rotate to reflect the movement of the breakout in 3D-space, as seen in the video below
Also notice in the upper right corner of the dialog box at the top that the calibration of each sensor is displayed. It's important to calibrate the BNO055 sensor so that the most accurate readings are retrieved. Each sensor on the board has a separate calibration status from 0 (uncalibrated) up to 3 (fully calibrated). Check out the video and information from this guide for how to best calibrate the BNO055 sensor.