As-Yet-Unnamed LED Microcontroller and Programmer

The sequel to a project from like two weeks ago

Similar projects worth following
The ATtiny20 WLCSP package is small enough to fit underneath a 5mm LED with a handful of other parts. I think I can make one that can be programmed (and re-programmed!) like any single-board microcontroller, AND give it a GPIO pin, while still making it look like an innocent LED.

In my last project, I used a 1.5mm ATtiny20 to make a 5mm LED that can run arbitrary patterns. It's a delight, and someone should put me in touch with Id Software so we can release a series of licensed Quake flicker LEDs.

In the feedback, two questions that repeatedly came up were (1) can the LED be reprogrammed? and (2) can the LED respond to inputs? The answer to both questions is no, it can't. Once that LED is freed from its programming board, the program can't be altered. And it's designed to drop-in replace a conventional LED, so an extra I/O pin was never going to happen. But I still had some other ideas....

By taking a 5mm through-hole RGB LED and carefully blowing up two of the colors, we can make a PCB with a similar form factor to the previous project, but now it has two extra legs to use for things. Breadboard tests have been super promising! So now it's time to figure out some tough questions:

  1. What to name this dingus? LEDuino is taken.
  2. How to explain the function, purpose, and design of the project? You can help by asking me questions, especially if something seems unclear.
  3. What to do about the fact that there needs to be a different PCB for each variant? If I want a programmable red LED, I need a different PCB than if I want a programmable blue LED. And if I have common-anode LEDs, or common-cathode LEDs, I'll need different PCBs for those too. This project is not 1 PCB, it's actually like 24 closely-related PCBs in a trenchcoat.
  4. The LED is reprogrammable, but it's not trivial! I have to make a special programming accessory, too. What features should that have? I don't know. It would be neat to make a lil' LED playground but I'm not clear on what I want it to do, yet.
  5. How to blow up the LEDs in a consistent fashion? They cannot be allowed to become a short. I'm astonished by how little info I can find on this particular flavor of magic smoke.
  6. Will it still work as a conventional LED, too? I suppose this is easy enough to test. As [cpldcpu] describes in this neat hack, there is a path for current to flow and possibly turn on the microcontroller even when the microcontroller's Vcc pin is left floating.

  • Overview so far

    Sam Ettinger03/01/2022 at 06:42 0 comments

    I am still cleaning up and preparing things for the git repo, please bear with me in the meantime. So in my last project, I fit an ATtiny20, a shunt IC, and a quartet of 0402 passives onto a disk tucked under a 5mm LED. It existed in parallel with the LED itself. I am fairly sure a similar approach will work here.

    A KiCad render of a small circular PCB under a 5mm RGB LED with 4 pins

    The 4 pads for the LED legs and the one flattened edge makes routing very interesting. There's the left side of the PCB, and the right side of the PCB, and space for just two traces (one on front, one on back) to connect them. I end up tying a lot of unused pins to each other, just so I can route through them more easily. The function of each LED leg changes depending on which parts of the LED are burnt-out or not.

    A monochrome LED with 4 pins

    I'll need more than two pins if I want to give the ATtiny20 some I/O and make it reprogrammable. 5mm RGB LEDs with 4 pins exist, and they are cheap. If I can blow up 2 of the 3 diodes, that effectively gives me a monochrome LED with four legs to connect to my microcontroller. I like this approach because the legs are securely set in the epoxy lens and should give the finished part some more strength. But it does mean taking existing RGB LEDs and destroying them in a rather specific way that doesn't always work.

    Open question #1: How to consistently destroy LEDs without shorting them

    To free up the extra legs, I need these diodes to fail and NOT short out. Is there a way to consistently do that? I have been breaking diodes by very briefly zapping them with a 9V battery and no current-limiting resistor. About 85% of the time, this makes the diode fail open, leaving a tiny brown smear in the lens (which I can live with) and a disconnected pin. But the rest of the time, the diode fails short, and any further attempts to zap it cause the ex-diode to glow red and eventually the lens pops. Can I get them to fail open more consistently? If I wanted to, could I get them to fail short more consistently? I found one other person asking similar questions on a well-known Australian electronics forum, and all the replies essentially said "Hey dummy, your diodes won't fail if you use them correctly." Very helpful.

    An animation of the procedure I took to blow open two of the three diodes in an RGB LED

    I don't have a large sample size yet, but I feel it's worth remarking that, so far, 0/7 red diodes have failed short, 1/7 green diodes have failed short, and 2/6 blue diodes have failed short.

    TPI programming with just 4 pins (while still enabling normal operation)

    This is a little silly, but bear with me. Normally the Tiny Programming Interface (TPI) requires 5 connections: 5V, 0V, RESET, CLOCK, and DATA. Programming starts when the RESET line is pulled down to 0V and ends when it goes back to 5V. But there's also high-voltage TPI (HVTPI), in which programming starts when the RESET line is pulled up to 12V. In this mode, the RESET mode should never ever drop below 5V, right? So we can get our 5V chip power from the RESET line!

    A schematic showing the 4-pin circuitry configuration for programming

    The 5.1V Zener diode is a compact way to get 5V to power the chip. It's worth remarking that a lot of LED datasheets list the absolute maximum reverse breakdown voltage as 5V or so, which would mean 12V on the LED cathode would cause damage. However, that is a very conservative estimate on the LED maker's part; out of all the LEDs I've tested, none have had a reverse breakdown under 30V, so I think we're good. Still, I think it's worth testing each time.

    When operating normally, and not in programming mode, these pins need to take different functions. If the LED cathode is at 0V, then we shouldn't directly connect anything to the LED anode, lest it overload the LED. We can still use a spare pin on the microcontroller to toggle the LED, however.

    A schematic showing the 4-pin circuitry configuration for normal operation

    To accommodate both of these functions, some Schottky diodes keep current flowing the right way without too much of a voltage drop:

    A schematic showing the LED circuit for both normal and programming operations

    A more formal schematic is below. But note that this is not a complete schematic! I suppose that's obvious from the scramble of wires on D1...

    ... Read more »

View project log

Enjoy this project?



Sylvain Davaine wrote 03/04/2022 at 17:09 point

Hello Sam,

In the vein of more pins, you may have a look at addressable through hole 5mm LEDs (search for ADA1938).
They have 4 pins like RGB LEDs too but you don't need to blow up any internal LEDs ;-)
You get to choose all the color you want and still free up 2 pins (the serial input and output)
The schematic will be simpler from the previous TL431 design which can free some space for a pad on which a programming jig could get you all the 5 TPI signals. If I'm not mistaken : power and gnd from the power pins of the LED. Clock and data from the other 2 pins that used to go to serial in and out and finally a pad on the PCB to get the reset signal.

This could also be combined with the power line hack from cpldcpu if in normal operation, you want to change the color or animations and the 2 pins are used.
Just a thought.
Anyway, great project with a lot of hack, I love it!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

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