Hello,
I want to use Arduino to drive 10 parallel LED's with only two pins, I also want to be able to dim the leds, could you please suggest an circuit for it?
I also want to be able to dim the LEDS
Hello,
I want to use Arduino to drive 10 parallel LED's with only two pins, I also want to be able to dim the leds, could you please suggest an circuit for it?
I also want to be able to dim the LEDS
Run each with their own resistor, via a logic level mosfet direct from a battery large enough for the load.
First, I'm sure you're aware that its always best to drive loads (even small loads like LEDs) with some kind of driver circuit. For something like this, a simple NPN transistor (a 2N2222 will do fine to power 12 LEDs), with its emitter tied to GND and the base tied to you're Arduino output pin through a resitor (anything over 1K will be fine). Then, you place your load between whatever positive voltage is powering your project and the transistor's collector, this time with a current limiting resistor appropriate for the LED.
Second, "dimming" is best accomplished using the PWM (pulse width modulation) outputs, with appropriate calls (analogWrite(pwmPin, dutyCycle); )to alter the duty cycle. (ignore the confusing fact that the call is "analog" write...).
Third, powering multiple LEDs is parallel is not the best idea. Granted it might seem to offer the lowest voltage option, but the truth is that even minor differences between LEDs can cause annoying differences in brightness when they are all wired directly in parallel. It is possible to get a good result, however, if each LED has its own current limit resistor. THEN you can take the combination of all your LEDs, each in series with its own resistor, and wire those combinations in parallel.
PeterPan321:
...a simple NPN transistor (a 2N2222 will do fine to power 12 LEDs), with its emitter tied to GND and the base tied to you're Arduino output pin through a resitor (anything over 1K will be fine)...
Careful there. A 2N2222 needs 5-10% of the collector current in the base to keep it saturated (collector voltage <= base voltage).
12 LEDs could mean 12*20mA = 240mA. That needs 12-24mA base current.
"anything over 1k" (<=4.3mA) won't be fine. 220-330ohm would be better.
A not fully saturated transistor has a higher C/E voltage drop across when 'on'.
A >=1k base resistor could mean 1-1.5volt C/E voltage = 240-360mW dissipation.
That could make the 2N2222 sizzling hot, and eventually pop its top.
OP hasn't given us much information about the LEDs. Could be <20mA signal LEDs with a Vf of 2volt or 3.5volt, or 3watt power LEDs. The Arduino could be running on 5volt or 3.3volt. Advice is as good as the information given.
Leo..
With the "only 2 pins" requirement, an I2C expander like the MCP23017 (16 I/O lines) would do the trick. You would not use PWM to dim them, though.
Wawa:
Careful there. A 2N2222 needs 5-10% of the collector current in the base to keep it saturated (collector voltage <= base voltage).
12 LEDs could mean 12*20mA = 240mA. That needs 12-24mA base current.
"anything over 1k" (<=4.3mA) won't be fine. 220-330ohm would be better.
You're absolutely right, and the OP should take note. ]I'm so used to both looking for low current LED, and trying to under power them when I can get away with it. This is also getting up to the kind of control current I'd probably avoid trying to pull out of the MCU, even if it technically within spec. This might require a Darlington, which ist really just wasting the power more safely. Maybe even better, a low power transistor driving a MOSFET like this would be a safer bet...
(deleted)