0
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ What do you mean by "control"? \$\endgroup\$ – Leon Heller Dec 16 '11 at 17:02
  • \$\begingroup\$ Do you mean to control each LED individually? \$\endgroup\$ – Farid-ur-Rahman Dec 16 '11 at 17:12
  • \$\begingroup\$ To be able to turn them on or off. There are only 2 wires coming off of the PCB so all or nothing \$\endgroup\$ – Bob Dec 16 '11 at 17:15
3
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the insight. I tried posting some pictures of the PCB as I can only see 6V with 6 LEDs, however I don't have enough rep yet to post pictures. The LEDs appear to just be the list 20 mA LEDs so a mosfet should do the trick. This brings me to my second question about external power source. I would like to remove any batteries from the equation. Would I need to have 2 power sources, 1 for the Arduino and a 2nd for the LEDs? \$\endgroup\$ – Bob Dec 16 '11 at 18:31
  • \$\begingroup\$ Again, you need to figure out what the current is. Measure the current drawn from the 6V battery when that is powering the LEDs. Then you can buy a off the shelf 6V power supply rated for at least that current. \$\endgroup\$ – Olin Lathrop Dec 16 '11 at 19:13
  • \$\begingroup\$ I have a 6V power supply. Can I just swap out the battery pack for the power supply or do I have to worry about a voltage regulator (or anything else) to plan for any irregularities in the power supply or does the power supply take care of this. The power supply is 500mA so should be able to handle 6 LEDs. \$\endgroup\$ – Bob Dec 17 '11 at 1:15

protected by Kortuk Apr 8 '13 at 3:08

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.