Our Biomaker Challenge: A XOD Library for the BNO055 Absolute Orientation Sensor by Matt Wayland
I'm an imaging specialist based in the Department of Zoology with a background in biology and bioinformatics. I have no formal training in any aspect of engineering, but I enjoy working on open hardware projects when the opportunity or need arises. I first heard about XOD at the 2018 Biomaker Fayre last autumn and was excited about its potential to enable people with limited or no coding experience to program microcontrollers. For more experienced users, it offers rapid prototyping of hardware.
Link to documentation: An XOD Library for the BNO055 Absolute Orientation Sensor on Hackster
Initial thoughts
The Winter Challenge was my first introduction to XOD, but I already had some familiarity with the Arduino Uno, having used one to build a laboratory automation robot. For my project I decided that the most helpful contribution I could make to the XOD community would be to add support for a new hardware device. Scanning through the list of supported hardware I saw that although XOD nodes were available for several inertial measurement units, such as accelerometers and gyroscopes, support for absolute orientation sensors was lacking. Absolute orientation sensors are very useful components for building open hardware; applications include augmented reality, navigation, gaming, personal fitness, biomechanics and context awareness.
Choice of sensor
There are a number of absolute orientation sensors on the market. I opted for the Bosch BNO055, because of its wide availability and ease of use. This device is a system in package (SiP) comprising a triaxial accelerometer, triaxial gyroscope, triaxial geomagnetic sensor and a 32-bit microcontroller. Embedded software takes care of the difficult task of fusing the sensor data to determine absolute orientation in Euler angles (yaw, pitch and roll) and quaternions. Crucially, Adafruit have simplified both the hardware and software interfaces to the BNO055 through creation of a breakout board and driver, respectively.
Getting started
My first task was to get familiar with XOD. Fortunately XOD has a very intuitive integrated development environment (IDE) which comes pre-loaded with excellent tutorials. I created a few simple patches to read and display data from the sensors provided in the biomaker starter kit. Before attempting to use the BNO055 with XOD, I tested Adafruit’s breakout board and software driver by compiling and running one of the example Arduino sketches using the Arduino IDE.
Challenges
Wrapping class-based Arduino libraries for inclusion in XOD requires some knowledge of C++. Fortunately the XOD development team have made the process very straightforward (interested readers should take a look at this guide), even for someone like myself, whose skill in C++ is rudimentary! The main challenge was to understand Adafruit’s driver library and to think about how its functionality should be presented to XOD users as nodes.
Future work
I’m very enthusiastic about the role XOD can play in open hardware development and education. I continue to be involved in the XOD community and have recently contributed libraries for another two hardware devices, an OLED screen and a CO2 sensor. I’m planning to create more libraries over the coming weeks to increase the range of devices available to the teams in the summer biomaker challenge.