LED ring

A charlieplexed 20 LED blinker with ATTiny45. Space efficient daisychained LED placing with shared anode/cathode soldering pads.

Similar projects worth following
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.

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 :-).


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" :-).

Gerber files for the PCB

Zip Archive - 21.18 kB - 12/28/2017 at 22:05


  • 1 × ATTiny45 Microprocessors, Microcontrollers, DSPs / ARM, RISC-Based Microcontrollers
  • 20 × LEDs SMD 0805 Red Super bright Red
  • 1 × PCB "perfect purple PCB" from a maker friendly PCP service
  • 1 × Coin Cell Holder CR2032 3V Cell Coin Battery Socket Holder Case CE6
  • 1 × push button Taktile Push Button Switch federnd Lockless SMD 2-Pin 4pin

View all 6 components

View all 4 project logs

Enjoy this project?



Avi Cohen wrote 09/28/2019 at 16:12 point

Hi, are the Kicad files open to the public ?

  Are you sure? yes | no

Jens Hauke wrote 09/28/2019 at 17:06 point

  Are you sure? yes | no

Avi Cohen wrote 09/28/2019 at 20:04 point

Thank you, this is great

  Are you sure? yes | no

Philip Hart wrote 01/29/2018 at 17:26 point

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) ?

  Are you sure? yes | no

Jens Hauke wrote 01/29/2018 at 20:23 point

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?).

  Are you sure? yes | no

Philip Hart wrote 01/29/2018 at 21:02 point

Hi Jens, many thanks for getting back to me so rapidly. No worries about not having a BOM; I was just being lazy ;-)

  Are you sure? yes | no

Philip Hart wrote 01/30/2018 at 08:44 point

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).

  Are you sure? yes | no

Jens Hauke wrote 01/30/2018 at 09:36 point

Coin Cell holder: (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.

  Are you sure? yes | no

Philip Hart wrote 01/30/2018 at 15:13 point

OK, that explains why I can't find a horizontal one! Many thanks for your help.

  Are you sure? yes | no

oshpark wrote 01/06/2018 at 05:08 point

Great project!

  Are you sure? yes | no

Seth Hunter wrote 01/05/2018 at 01:57 point

very nice design - I learned something new today. :) 

  Are you sure? yes | no

WestfW wrote 01/04/2018 at 09:09 point

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!

  Are you sure? yes | no

w4ilun wrote 12/30/2017 at 20:36 point

This reminds me of the "brain reader" thingy on Black Mirror :)

  Are you sure? yes | no

Bastiaan wrote 12/31/2017 at 00:08 point

Now I kinda want to build one of those ... (what's up with comment formatting lately)

  Are you sure? yes | no

w4ilun wrote 12/31/2017 at 06:44 point

Looking into using a smaller mcu with 0201 LEDs, seems hard to find a suitable coin cell size

  Are you sure? yes | no

Jens Hauke wrote 12/31/2017 at 12:07 point

Any suggestion for a smaller MCU with 6 IO's to drive 6*5=30 LEDs for the brain reader? Maybe a super cap is a small alternative to a coin cells.

  Are you sure? yes | no

rafununu wrote 12/29/2017 at 12:35 point

You simply forgot the current limitation which is here assumed by the controller outputs. But the wiring is interesting, this charliplex indeed.

  Are you sure? yes | no

Jens Hauke wrote 12/29/2017 at 15:04 point

Yes, "forgot" by intention ;-). Indeed, it is charliplex with an uncommon wiring pattern. The current limiting issue is well discussed here:

  Are you sure? yes | no

Does this project spark your interest?

Become a member to follow this project and never miss any updates