A troublesome IMU, and a 7-segment LED

(Thanks to the new Excamera Labs part-time assembly person, we now have lots of stock of Gameduino3, Gameduino3 7" and TermDriver. They're all in the Excamera Store.)



This week I've been getting an IMU module from Sparkfun running. Part of the goal is to make some nice demos for the I2CDriver video, though I'm also considering it for some client projects. The sensor is a BNO080, which combines an accelerometer, compass and gyro with enough onboard compute to filter and combine these sensors and produce a continuous estimate of the orientation.
This image was deleted by MailChimp when they shut down TinyLetter.
Robotics people and 3D games programmers are familiar with the representing orientations as quaternions. In the case of the BNO080, it simply sends the orientation as a quaternion over I2C at whatever rate you like.

But actually getting the BNO080 set up and talking was quite difficult. The I2C stage was easy, because I2CDriver showed what was happening. But the chip uses a proprietary protocol on top of I2C, and it's not very well documented. (It has kind of documentation which is quite large, but still manages to not fully describe how the part works.) Fortunately Sparkfun have put out a driver that helped a lot - without it I'd be lost.

This morning the code finally started running, and I had a Python program that was printing out quaternions, and they even seemed to change as I tilted the IMU - Promising! Plugging in an OpenGL cube renderer (using PyOpenGL) to show the current orientation was a few more lines of code. Python really is fantastic glue.

This image was deleted by MailChimp when they shut down TinyLetter.
 

The second I2C project this week was a bit less ambitious, but more satisfying. The rewards for the I2CDriver will include a multitude of small I2C modules, each powered by a minimal microcontroller running as an I2C slave. I prototyped a PCB for these a few ago, and just this week was able to get the first module running. Here's the bare PCB, it's 18x18mm square.

This image was deleted by MailChimp when they shut down TinyLetter.
Populated with the microcontroller, the LED didsplay and headers, you get this: an I2C-controlled 2-digit 7-segment display. It's nice and bright, and the protocol is straightforward: it has register writes for a hex number, a decimal number, or a raw LED pattern.

This image was deleted by MailChimp when they shut down TinyLetter.
Plus it's dimmable in 256 smooth gamma-corrected steps:

This image was deleted by MailChimp when they shut down TinyLetter.
Writing the firmware was fun - it runs on the same 8-bit MCU that I used for SPIDriver, I2CDriver, and TermDriver and some other projects. This is a Silicon Labs EFM8, with the firmware written in the MyForth language. This model has 2K flash and 256 bytes of RAM, plenty for running the I2C protocol and driving a peripheral. In fact the firmware is about 500 bytes, with another 512 bytes for the gamma table for proper dimming.

If anyone has any ideas for any other features that might be interesting or useful, please reply and let me know. I'm working on the firmware-based I2C peripherals this week - this one plus: It's oddly satisfying making these things -- maybe it's because they're reusable modules. Abstracting the quite fiddly hookup of the display into clean I2C interface seems like a good investment.