Magnetometer VI: Working AVR Example

SONY DSCFinally, some progress on my AVR compass project. I’ve got a program that runs on the Adafruit Trinket and shows real compass headings, all in 3712 bytes. While it’s far from being a finished product, it’s a big step in the direction of one.

Below, I’ll give you the source code, talk about how recent compiler changes impact code size, tell you about a bug I fixed, and make a bunch of excuses for why this took so long.

MicroView: Lazy Fix

SONY DSCThe MicroView is a nifty little gadget with an ATmega328P microcontroller, an 64×48 OLED display driven by an SSD1306 controller, and an Arduino-compatible pinout. (The General Overview page at the Microview website has more useful information.)  It was produced as the result of a (very!) successful Kickstarter campaign.

Unfortunately, the nice folks at SparkFun had a teensy manufacturing complication. You can read their account of the details, but the TL;DR version is they shipped out something around 2000 MicroViews with no bootloader. It sounds like they’re making every effort to make things right, and shipping out a replacement to everyone with an affected unit. But in the meantime, they’ve got some instructions up if you want to try fixing the problem yourself. (Worst case, you won’t make it any more broken; Best case, you end up with two working MicroViews for the price of one.)

I got one of the “bad” MicroViews, and was able to revive it using the instructions. But I think I came up with an easier way to do one of the more difficult steps: connecting three wires to tiny vias inside the case. The punchline: use sewing needles (see picture above; click for larger version). Read on for more details.