This question already has an answer here:

I have 6 3x10 blocks of LEDs (3 blocks red, 3 blocks white), all controlled individually.

  r r r r r r r r r r
+ r r r r r r r r r r -
  r r r r r r r r r r

(wired in parallel)

I'm controlling the blocks of LEDs using an Arduino MKRZERO.

I'm able to make 1 LED shine very bright per every output pin on the Arduino. However, I cannot make an entire block of lights shine very bright. They're actually very dim.

The I/O pins on the Arduino can only handle 3.5 volts.

If I by-pass the Arduino, I'm able to make a block of lights shine very bright.

At most I will have 3 blocks (90 LEDs total) shining, and at least 1 block (30 LEDs); except when it's off where obviously there would be no LEDs on.

The blocks will flash, only being on for no more than 1 second.

Everything needs to be powered by a 12v car charger (cig lighter port).

Currently I have an adapter that plugs into the car charger, and coverts to USB. I then took a USB cable and wired it to a voltage step down that goes to the Arduino. From the Arduino pins I have wires going to the light blocks.

The lights I'm using are 5mm clear straw hat red and white. http://ledz.com/led.datasheet/412PWO4C.pdf http://ledz.com/led.datasheet/412MR2C.pdf

Multiplexing Where you can trick the brain into thinking all the lights are on. If I went this route, I would at most have 3 LEDs on at a time right? I've never seen this done with flashing blocks of LEDs, or this many... or really ever seen this.

Transistors To my understanding I can put 12 volts to all the lights, and use transistors connected to the Arduino that would act as a switch for each block of lights. One transistor per block of lights, right?

I'd like to go the easiest, and least expensive route.


marked as duplicate by Dmitry Grigoryev, ThreePhaseEel, Daniel Grillo, Autistic, uint128_t Jan 21 '17 at 19:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ What voltages could you have available for powering the LEDs? \$\endgroup\$ – Andrew Morton Jan 16 '17 at 19:04
  • \$\begingroup\$ The arduino site says the max voltage an IO pin can tolerate is 3.5v. Unless I'm misunderstanding this, I would say 3.5v is the max. I have a 5v source, that I'm stepping down to 3.5v. \$\endgroup\$ – Mr. JaWapa Jan 16 '17 at 19:13
  • \$\begingroup\$ When you have that many LEDs and your worry is about the max voltage rating of the IO pin of your microcontroller, then you're doing it wrong. You should have some sort of driver circuitry between the micro and your LEDs. \$\endgroup\$ – brhans Jan 16 '17 at 19:16
  • \$\begingroup\$ You are very likely going to need a separate power supply for the LEDs if you are using a small power supply for the Arduino. You can use a transistor as a switch for the LEDs - it uses a small current (from the Arduino) to drive a large current (flowing through the LEDs). Turning on multiple leds with arduino using transistor. \$\endgroup\$ – Andrew Morton Jan 16 '17 at 19:18
  • 1
    \$\begingroup\$ Come on man, "how do I light up LEDs" has been asked a HUNDRED times on this site. \$\endgroup\$ – Bryan Boettcher Jan 16 '17 at 20:39

Basically, what you need to do is have your LEDs in a parallel arrangement of series strings of LEDs. This will enable you to minimise the current (power dissipation = I2R) and take advantage of the maximum voltage availble to drive them.

Assume 14.4 V for a car outlet. Assume 18.5 mA for the current through an LED and a voltage drop of 2.0 V across a red LED (from the datasheet and avoiding the maximum value for the current thus giving a bit of leeway on the voltage). Assume 0.2 V VCE across the transistor (from its datasheet). Calculate the required resistance for three LEDs and the transistor in series. Round it up to the next-highest easily-available resistor value.


simulate this circuit – Schematic created using CircuitLab

Repeat the part of the circuit with the LEDs and resistor in parallel. Calculate the total current.

Find the maximum output current of an Arduino pin and calculate R3 so that that maximum current is not reached - at this point you may find that the transistor does not have enough gain (q.v.). Consider using a Darlington transistor. Further research might lead you to using a logic-level-compatible MOSFET.

Note that a 2N3904 has a maximum collector-emitter current of 200 mA, so it is not really suitable or this (too close for comfort and will need a heatsink). Uh-oh. Choose a suitable transistor, check the VCE and re-calculate the resistor value.

Calculate the power dissipated (I2R) in the resistor to select an appropriate one. Insufficient power dissipation capability in any of the components may turn your flashing light bar into a "this vehicle is on fire" alert.

Now do it all again for the white LEDs.

None of the values are guaranteed to be correct in this answer.

Next, wait for someone to point out any glaring errors I have made :)

  • \$\begingroup\$ I have all 30 LEDs in one block in parallel, no resistors. There doesn't seem to be any problems there. Should I change the way I have it? Also, using this set up, the current would be going through the transistor, not the IO pin on the board... right? \$\endgroup\$ – Mr. JaWapa Jan 16 '17 at 22:04
  • \$\begingroup\$ @JaWapa Yes, you should change it. Otherwise you are likely to destroy the LEDs and/or the Arduino. \$\endgroup\$ – Andrew Morton Jan 16 '17 at 22:09
  • \$\begingroup\$ I was messing with the lights here, and it looks like 2 lights with a 100ohm resistor do not shine very bright. +led- +led- resistor \$\endgroup\$ – Mr. JaWapa Jan 16 '17 at 22:16
  • \$\begingroup\$ @JaWapa It seems like you are replying too quickly to have fully comprehended what needs to be done. I suggest that you have a cup of tea and let your subconscious work on it for a little while :) \$\endgroup\$ – Andrew Morton Jan 16 '17 at 22:21
  • \$\begingroup\$ maybe so, this is kinda frustrating. \$\endgroup\$ – Mr. JaWapa Jan 16 '17 at 22:26

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