using arduino to power LED bank of 21 SMD white LED

Ive just started with an Arduino Uno R3 and completed the introductory projects that came with my starter kit. so I have this small bank of LEDs that were in a battery powered (2AA) case for your phone. I can light them up readily with either 2 AAs or a CR 2032 (coin) battery and thats neat but i wanted to have the LEDs fade up and down with either code or with a potentiometer. as I am strictly a beginner, but know that there has to be some resistors involved and i dont know where to start. I have a breadboard, resistors and all that, i just want to have some insight before i start melting stuff from being hamfisted. so can someone give some help with this probably idiotic idea?


If you havn't already, look at this Fade Tutorial

Don't connect your LED bank yet, just use a single LED for the tutorial.

Then you can use a transistor to control your LED bank in the same way the single LED was faded.
This might be useful: tutorials/transistors


i went ahead and did the fade tut and it worked, of course. i used a repurposed LED on a pretty neat PCB that had all the info i needed for polarity. so that was good. so I took that off the board and hooked up the LED bank and with baited breath i plugged in the power and waited for the thing to give up the ghost. To my surprise it started fading in and out like i wanted! so i goofed around with the millisecond variable and got it to pretty much breathe. i also got it to do the epileptic fit inducing strobe effect as well. but I am happy with the result, just kinda needed a push. I am repurposing LEDs and such from this team avengers repulsor toy, after which i will incorporate into the sculpture im building. next is getting the 3 RGBs lit up on a strip of PCB. theyre not addressable but i would like to get them to flicker like a candle. so im gonna give that a go. thank you for your help and if you have any good info on the last bit, it would be appreciated.

To my surprise it started fading in and out like i wanted!

Ace! well done :slight_smile:


I wonder what the starter kit taught you?

How much do you know about electricity, like volts, amps, ohms and Ohm's Law?
I learned Ohm's Law getting my Electricity Merit Badge in Scouts. It's not college material.

There's many sites that you can pick up understanding in basic electricity at least enough to read and follow along when terms like mA (current) are used, otherwise you're stuck until you do and more likely to burn parts up.

21 leds... how many will be on at any one instant? If you try to source too much current through the Arduino, it will die. The limit is 200mA and those resistors restrict how much current leaves the pins. 21 leds at 8mA each won't push or exceed the limit.

Grumpy_Mike here has an excellent web page on the care and feeding of leds.
If you get into hobby electronics, it can be a thing just in itself with Arduino as a way to use it. Well worth the learn.

I have no idea where you are with code. Are you able to read a sketch and follow how it should execute?

Bookmark these links below as references and pick up what you can as you can. You will get better for doing so.

Arduino Foundations -- links page

Arduino Language Reference

for the most part the kit has taught me the nuts and bolts of the arduino and how it works. I can read a sketch and am learning about how to program it little by little. I get sketches, wire up the stuff and play around with the variables to get the gist of how it affects the project. eventually, kicking and screaming ill write my own sketches. I am very excited to FINALLY get into this part of prototyping and I appreciate all the help that i get!

Then it was probably worth not just the money but the (worth more) time you put in.

One of my Arduino hobbies is learning pieces, different kinds of sensing and powering down to the make it go solids. Putting them together, I do sometimes as a demo here and there. I wrote code long enough that it's the easy part for me.

If you have no driving need to make a product right away I would suggest that you explore what's possible. You should find things that will change your whole idea of kewl.

An early one for many members here is the common simple contact button. Yeah they look simple but don't let that fool ya! Sparks cross the gap as the close and open, are a hair-width apart, and fast code will see many press and release events for a single press. That's called bouncing. So many people here have made their own software debounce routines it's kind of like a level-passage rite. The lessons gained in basic electrical and coding knowhow are worth more than a bling toy. Make the bling but when you do, make it really bling!

When you look on the web at all the amazing projects, see them as packages of elements. Recreating those should be goals in themselves. Build a toolkit and use it till you're comfortable and then making your own package will be much easier. Setting a goal that's a description with no clear path to reach is one way to end up with a kludge.

Accelerometers, 3D compasses, cap sensing, lots of other sensing, motors, servos, speakers, displays... yeah like they say, all that and more awaits. You could drop $50 on a PC game and get 100's of hours out of it but where can you take that except to the next game. The Arduino game is as open-ended as the real world.

What's your time worth? Is it worth making it worth more? There's a real goal!