NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Basic Electronics » 17 super bright white LEDs at the same time...SAFE?!
February 18, 2012 by ThomasH |
Hello all! I've been thinking of creating a lamp (with some fancy but not yet determined features to make use of the microcontroller) using some super bright white LEDs I recently bought. What I've done so far is to hook up 17 of the LEDs to my microcontroller (1 LED per pin on the microcontroller). I've then written some very simple code to turn them all on at once. It works and all the LEDs are on at the same time creating a decent amount of light. However, my question is: is it safe to have the microcontroller power all 17 LEDs at once for a long time? (assume over 1 hour). The datasheet for these LEDs:
Your help would be very much appreciated! Especially if it helps me avoid blowing myself up or frying my microcontroller! Thanks! Cheers, Tom. |
---|---|
February 18, 2012 by ThomasH |
By the way...I forgot to add that when I leave it on for a minute or so, the voltage regulator feels quite hot! Also, I have another related question: When I measure the voltage from one pin to ground when a LED is plugged in, it reads 3.2V. However, when I remove the LED and read the voltage from the same pin to ground, it reads 3.8V. It would be great if someone could explain this to me! :) Thank you in advance! Cheers, Tom. |
February 18, 2012 by Rick_S |
From the Datasheet: 1st, I hope you have current limiting resistors on each of your LED's. If not, that would be a start. To calculate the resistor needed, subtract your LED forwared voltage (3.3 in this case) from your source voltage (5V) then divide by your desired current through (20ma MAX) 5-3.3=1.7/.02=85. So an 85Ω resistor would be ideal... Since that isn't a standard value, I'd go with either a 91Ω or 100Ω. If you want less current flow, just re-calculate with a different current value then change the resistor accordingly. You would have to do the math to determine if you are sinking/sourcing too much through your microcontroller. If your are unfamiliar with the terms sink/source, sink would be when the microcontroller is connected to the negative side of the LED (it sinks it to ground to turn it on). Source would have the positive side of the LED connected and the microcontroller provides the power 'source' to turn on the LED. If you want to be safe, one way would be to provide a separate power supply for your LED's. Wire them in series. Determine the voltage required to drive them and how much power is needed when choosing the supply. Get a MOSFET capable of handling the power requirements, and drive the MOSFET with the microcontroller via a PWM output. Then to brighten or dim the LED's, just adjust the duty of the PWM. Rick |
February 18, 2012 by ThomasH |
Hi Rick, Thanks for the information! When I have only 1 LED connected to my microcontroller withOUT a resistor, between 30mA and 6.5mA flows through the LED depending on which pin I connect the LED to. Why do the amps vary so much? Also, when I connect all 17 of the LEDs, the amount of current which flows through them varies from 0.6mA to 17mA. Again, why does it vary depending on the pin? Thanks again. Cheers, Tom |
February 18, 2012 by Rick_S |
I don't know why you'd see the variance. You may be overloading some of the ports and that may have something to do with it. When connecting directly to the mcu, the LED will attempt to draw as much current as it can. The only restriction then is the circuitry inside the micro. Without limiting resistors, you will overload the mcu and cause damage over time. I wouldn't attempt to use an LED on the micro w/o a resistor unless the LED is being driven by PWM. |
Please log in to post a reply.
Did you know that the microcontroller's crystal oscillator can be used to keep accurate time? Learn more...
|