tl;dr: Can you help review my circuit and offer guidance on batteries, components, and approach? I have LEDs that are dimming unreliably on the breadboard prototype.
Backstory:
I bought a Kepler kit to work through some projects with my daughter and we've been enjoying ourselves. But after we successfully turned some LEDs on and off the first afternoon I mentioned that there are sewable boards and that we could sew some lights on her backpack and she got super excited. We planned out some letters with ~3-5 LEDs each and I went ahead and purchased a Lilypad and a bunch of the sewable LEDs (some name brand, some off brand from Amazon), conductive thread, etc.
I prototyped it on a Rasp Pi Pico W with a single LED per pin per letter and wrote code to flash them in fun patterns, leave them all on for a while, etc. I wrote the same stuff on the Lilypad USB Plus and it works with the LEDs on the integrated Protosnap Plus fine. She's excited!
But before unsnapping everything and starting to sew I did some more prototyping on a breadboard. At some point I realized that 5 LEDs x 4 letters is a lot of LEDs for the microcontroller. I don't think I fried anything, although there is a lingering smell of something that I'm sure everyone here is familiar with.
I realized we'll need some more power for the LEDs and not try to power 5 LEDs per GPIO pin when sometimes ~20 would be on simultaneously. I recalled some electronics from playing with this stuff a decade ago when she was a baby and remembered that a transistor could act as a switch. There's a few in the kit we bought so I stumbled through creating a circuit. ChatGPT helped. Or not. It works sort of.
Here's the diagram as I understand what I built, for one letter:
The LEDs are the Lilypad style ones with integrated resistors, so I think they need wired in parallel as I did. (Specifically I am prototyping with these off brand ones.)
Right now both power sources are a single CR2032 cell battery.
Right now I've wired up three GPIO pins to a single LED and resistor for the first three letters, and then the above circuit with 5 blue sewable LEDs on a fourth GPIO pin for the fourth letter. I blink them on one at a time and it seems to work. But then I blink them all together and after that I leave them all on. When they're all on the blue LEDs start to dim and then they go out, and then they don't work anymore — not broken, after I turn the power to the chip off and on again, they work again but fade as before.
My most general question is: Do you have any advice for this project?
More specific questions are:
- Is this general approach with external power for LEDs controlled by the GPIO to the base of a transistor as a switch feasible?
- Is there a better approach I should be taking instead?
- Do you have a recommendation for power supplies? My instinct is that a single CR2032 is enough to power the Lilypad, but that something else should power the arrays of LEDs.
- Is the LED dimming I'm observing on the breadboard likely to be from battery issues?
Thank you for any help and guidance you can provide!
Ian