# How many individual LEDs could Lilypad Control? (+ LED/resistor question)

Hi!

I just purchased a Lilypad kit that includes the Lilypad Arduino 328. I am trying to get my brother to do something creative with his fashion interests, so we're going to make some clothes with blinking lights!

Given the setup of this particular Arduino, would anyone know how many [u]individual[/u] LEDs we can control? I understand that you can have a set of lights in parallel and have them all turn on at once, but we want individual control.

Also, how do I know what size resistor to use with a particular LED? Not sure what LED to buy just yet, but given this arduino's setup i would assume i am working with... 5 volts per output? How does one know what kind of resistor to use with an LED?

Thank you for taking the time to read my question. Your help would be so GREATLY appreciated! -Sebastian

Without adding any extra hardware, you have 20 I/O lines.
Rx, TX (D0, D1), D2-D13, then A0-A5 (D14-D19).
Rx/Tx, you can use them but plan for a way to disconnect LEDs from them during programming.

“In the TQFP and QFN/MLF package, ADC7:6 serve as analog inputs to the A/D converter. These pins are powered from the analog supply and serve as 10-bit ADC channels.”
I suppose you could use them as slow digital inputs, add a 10K pullup resister, and short to ground for signal activation. Will return a high value (like >=900) for a 1, and a low value (like <=100) for a 0.

Resister value will depend on current flow in the LED (generally 20mA) and the LED forward voltage drop when current flows.
For an example, lets assume Vf of 2V.
Furher assume that you have output pin connected to resister connected to LED Anodel, Cathode to ground.
Voltage = Current * Resistance, or re-arranging
Resistance = Voltage/Current
Resister needed is then (5V-2V)/20mA = 150 ohm.
Power rating of the resister needs to me considered, Power = Voltage * Current, re-arranging with V=IR, P=IIR or VV/R also
so 20ma
20mA150 = 60mW
or 3V
3V/150 = 60mW (3V because there will be 2V across the LED in this example)

60mW is very little, so an 1/8W or 1/4W resister per LED will be plenty.

You can also pay more and find LEDs with built in current limit resistors. But where’s the fun in that?

www.superbrightleds.com has very bright LEDs in lots of colors. The viewing angle may be almost dead-on, lightly sanding the LED can diffuse that.

Thank you CrossRoads and KE7GKP for your advice! The examples were particularly helpful. Greatly appreciated!! XD