This project is submitted for

Description

This is a small blinky with 20 LEDs powered by one CR2032 coin cell
and with an ATTiny45 brain. The firmware is written in plain C and
compiled with the avr-gcc toolchain. The PCB is a two layer design made
with KiCad.

Details

Some time ago i was thinking of how to shrink LED blinkies even more. The first obvious step is to move from 3mm LEDs to SMD. But than there is still this tiny gap between the LEDs which likes to short-circuit with a solder bridge when soldering. Could we avoid this gap somehow? If we connect every anode to the cathode of the previous LED in an LED chain, could we still address every LED individually? Of cause, one GPIO per LED is not an option. It has to be something like charlieplexing. So i start sketching topologies.

With charlyplexing, every possible GPIO pin pair is used for two LEDs (with opposite polarity). e.g. in case of 2 pins (pin0 and pin1) one LED is connected with its anode to pin0 and cathode to pin1, the second LED with anode to pin1 and cathode to pin0. In short: LED1: 0-1, LED2: 1-0. With more IO pins, you have more pairs and can address more LEDs. With 3 IOs there are already 6 pairs: 0-1, 0-2, 1-0, 1-2, 2-0 and 2-1. In general, with n IOs you could build n*(n-1) pairs. So far, this is Charlieplexing.

As often, if you know how, it is simple. But it took some time to get to this point: We can connect this pairs like domino bricks to build a chain. Again, with 3 IOs we could create the chain: (0-1)(1-2)(2-0)(0-2)(2-1)(1-0) or short 0-1-2-0-2-1-0. The anode of one LED and the cathode of the next LED uses the same IO pin. Voila, they could be soldered on the same pad! For more IOs, it is a little harder to find the IO-pair sequence which builds every possible pair. But there always is one. I really like the simplicity of the resulting circuits and the easiness while soldering this LED daisy chains. Drop me a note, when you build the next beautiful blinky with this technique!

For the LED ring, i use 5 IOs from an ATTiny45 to enlighten 20 LEDs which is the maximal amount with 5 IOs: n*(n-1) = 5 * 4 = 20. The sequence used for this is: 0-1-2-3-4-0-2-4-1-3-0-3-1-4-2-0-4-3-2-1-0

Schematic diagram

You find the schematic for this sequence in the project gallery. I skipped current limiting resistors which are usually used in charlieplexed circuits and rely fully on the internal resistance of every IO pin. This might be out of spec, but i had never trouble with this when running from a 3V coin cell. I like minimalistic designs :-).

PCB

The PCB is designed in KiCad. KiCad is a great open source tool for PCB design, i can recommend to use! It even renders your toys in 3d with just a click.

I tried to build something, which looks very symmetric. The front has mainly horizontal traces, the back vertical ones. PB5, the reset pin, is connected to a small push button and not connected to any LED. In the default setup, the button resets/wake-up the tiny from power-down mode and show some animation. After a timeout of 2 minutes, it switches off by going into power-down mode again. In a different setup with the RSTDISBL fuse programmed, this is a weak IO pin and programmed for "power off" and "on" and "animation change". A small bootloader allow serial in circuit programming via PB5 - but this is a different project.

Power consumption

In active mode when running an animation with many LEDs switched on, i measure about 8-10mA. In power down mode (when switched off), my cheap multimeter shows 0.09µA - unsure, if i can trust this value. But the datasheet says, Power-down mode with WDT disabled and Vcc = 3V, Icc is max 2µA. The self-discharge of the coin cell is probably higher. If unused, it will probably last for many years. "If" :-).

Enjoy this project?

Discussions

Become a member

Hi Jens, I like this superb little project so much that I ordered - and have now received - a trio of boards from OSH Park :-) I am now about to order the components, but before I do, I wondered whether you have a BOM for the actual components from a particular supplier (eg - DigiKey, Farnell/Element 14, Mouser, etc) ?

Hi Philip. I'm sorry, but I have no BOM. All parts are collected over the past years and ordered from various eBay sellers. But any 0805 LED should do and the code would probably work the same on an SMD attiny85 (easier to get?).

Hi Jens, sorry to bother you again, but do you know where you got the coin cell holder from? I can't seem to find one like it :-( There seem to be similar ones for vertical mounting, but not for horizontal mounting (like yours).

Coin Cell holder: https://www.ebay.com/itm/172331994683 (Bend the connections downwards to make a horizontal from it. Enlarge the middle connection by soldering a small wire on it). Please share photos of your build with us! I would like to add them to the project log.

oh! I started out thinking "yawn; another charlieplexed LED thing." But with a closer look, I think your re-visualization of the charlie-plexed array is REALLY clever and useful. Especially since one tends to be forced into a (cathode[LED], anode[LED]) mapping regardless.The PCB layout you ended up with is SO much cleaner than what I came up with trying to do similar things!