LED Lighting with Arduino Mega 2560

arduinoled

I have an LED lamp that I want to control with my Arduino. It has 6 bright white LEDs (on a PCB) connected to a 6v battery pack. These all appear to be running in series and connected directly to the battery pack with no resistors in sight anywhere which doesn't make a whole lot of sense to me because of the voltage drop between LEDs (assuming 3V) but it works and is bright. Only 2 wires come off the PCB.

My question is, how can I connect and control this with my Arduino Mega 2560. My understanding of the Arduino is that each pin can only output 40ma which is by far short of the required amount if each LED uses 20ma.

Do I have to connect an external power source? If so, how would I go about doing this and could I also power the Arduino with the same power source?

PS. I'm new at all this so please excuse any ignorance.

Best Answer

You definitely do not just have a 6V battery and 6 LEDs in series. Regardless of bad design or not, this just wouldn't work. Eash LED would only get 1V, which is well less than the 3V or so most white LEDs need to operate at reasonable brightness.

So let's forget how you think the board is wired and treat it like a black box. You say it seems to work correctly when the two wires coming off the board are connected to 6V. It would be good if you had actual specs on that or explained where you got this from, but for now let's assume this is the correct way to power the board.

In that case, what you are really asking is how to switch 6V with a microcontroller. Part of the answer will depend on how much current. Are these little 20 mA LEDs or high powered lighting LEDs? Either way, a low side N channel FET switch is probably the easiest way to interface this with a microcontroller output, but the choice of FET depends on the current. For example, I like the IRLML2502 since it can be directly driven from a logic output and has decent current capability and low Rdson for such a small part. It can handle over 3A at 70C ambient temperature. If your board draws 3A or less when 6V is applied to it, then that's all you need. If more, then you'll have to carefully chose a different FET and perhaps different drive method than simply connnecting the microcontroller output to the gate.