The plan

A project log for oled earrings

Display falling tetris blocks on a oled screen made into an ear ring. It's powerded by a coin cell.

DanielDaniel 12/31/2017 at 15:510 Comments

This year I had a special gift for my girl. Earrings that feature an OLED screen with animations of her favorite arcade game, Tetris. The original idea was to have tetris blocks fall from the top of the screen to the bottom and stack up.

The display I had. It was cheap on amazon and had the right dimensions 128x32 pixels. Turned upright it approximates the tetris screen and has a good point of mass to dangle like earrings are supposed to.

The micro-controller was also easy to pick since there is only one small micro-controller I already worked with. The attiny85. This one I also had in abundance. November already had started so time was short. Not enough time to find and learn to use another candidate.

But the critical part was power. A coin cell is an obvious choice but heavy and bulky. Also there is the issue of producing waste. This was not an option since my girl would dislike a present that would burn through a coin-cell a day. Also there is the issue of the display requiring a minimum of 3.3V. Coin cells usually have 3.0 Volts. Fortunately there are rechargeable Lithium-Ion coin-cells with a voltage of 3.7V. This completely solves the waste and voltage problem at the same time. However the sizes to choose from are very limited. The target wear time is 10 hours. A full work day. With the smallest battery the LIR2016 @ 12 mAh that would result in a current budget of 0.6 mA to not deep discharge the battery. Very optimistic looking back. However there was always the way to go to a LIR2032. It fits in the same battery holder.

Fast forward a few weeks the code worked fine on an arduino clone board which I used for prototyping. Measuring the animation foiled my plans to have a stacking animation. The display alone required 1.8 mA of current at 3.7V. The ATTiny85 would also require 1mA when i kept it running to calculate the falling and interaction of blocks. This means I had to use the biggest Lithium battery available the LIR2032 with 40mAh. And it still wouldn't be enough. The power budget for that battery is 2mA of continuous current. The micro-controller has to be in deep sleep as long as possible.

Turns out the SSD1306 has a auto scrolling feature. This comes in handy. That way the micro-controller isn't required during runtime at all. It only has to do the initial setup of the screen and start the scrolling animation.

In December I ported the software to the ATTiny85. Never did I2C on that platform but how hard can it be? Well, turns out the universal serial interface of the ATTiny85 has next to no features. This cannot be a strait port by renaming a few registers. With the deadline looming I decided on soft I2C. It didn't have to be efficient to set up the display and go to deep sleep.