Go Down

Topic: Dimming 1w leds with transistor and walwart issues (Read 3317 times) previous topic - next topic

nkd5025

Hello Everyone,

I am trying to dim a 1w led (3v 350ma max) with a pwm signal from the arduino.  I have a simple circuit using a 1k resistor on the base pin of a 2n2222 NPN transistor with the emitter connected to ground on the arduino and the collector to the negative terminal of the led.  The positive led terminal than goes to 5v on arduino.

This circuit works perfectly fine and I am able to get it to dim correctly, however, I need to run the leds from a separate 5v power supply (walwart) while still controlling the base pin with the arduino.  For some reason every time I replace the ground and 5v from the arduino with the ones from the walwart, the led will not light while using the arduino pin to control the base.  If I connect the base to the positive terminal of the walwart the led will turn on.

I do not have a great understanding of circuit design as of yet and feel like I am missing something small so any help would be greatly appreciated!

fungus

It's essential to connect together the ground from the Arduino and the wall wart.

Voltages are only relative to their "ground". If the grounds aren't the same then the +5V in each part of the circuit might not be the same.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Boffin1


nkd5025

Fungus,

Thank you very much it is working perfectly now!
I'm glad I learned that, it makes a lot of sense!


I am mainly testing this with two double A batteries as its closer to 3v, but at first I was using the 5v walwart with a 10ohm resistor and it seemed to be okay for the short tests I was doing.  I will be buying a 3 volt walwart to run them as together they will take upwards of 1.4 amps.

This is ultimately for moon light control for a reef tank.  I was planning on having four 1w leds wired in parallel each individually dimmable to simulate to lunar phases and cloud cover.
I am also wondering, would it be better to run the leds off of a 3volt walwart or to get a 3.3volt voltage regulator to convert a 5v supply?  I am guessing the voltage regulator would be a lot more stable, yes?

I appreciate your help, I still have a lot of learning to do on the hardware side!


fungus

OK, next thing to learn is that LEDs don't work well if you try to control their voltage, they work much better if you control their current. If your LEDs need 350mA then you need a special "constant current" circuit that allows that many amps to pass.

The reason is that LEDs don't have a constant resistance, their resistance varies with voltage. Even tiny errors in voltage can lead to big errors in current, enough to damage the LED. Every LED is slightly different and needs a slightly different voltage so the only way to avoid those errors is to control the current.

You can get a special "led driver" for this or look for examples in these forums.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

nkd5025

fungus,

I did know this already and have a constant current driver that will supply voltage to one or all of the leds, that was actually the first ting I tried to dim them with before the 5v source.  Since it didn't work as I did not provide the common ground I just assumed that the constant current driver just pumped out more current to compensate for the dimming and keep the led at its max.

I just hook up the circuit with the constant current driver and it is all working as it should, thank you very much!
If you know of  place off the top of your head, is their a website that provides basic electrical knowledge and covers a wide basis of topics?

Nick D.

nkd5025

I noticed that when I keep the led at 350mA, which I tested with a meter, the 2n2222 transistor gets very hot very quickly.  So since this is too much current for the npn's can I use a TIP120 Power Darlington Transistor from adafruit for the job?

fungus

Try a smaller resistor on the transistor base, maybe 330 or 220 ohms. 1K might be too high to fully open the transistor.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

nkd5025

with a 220 ohm it still get too hot to touch very quickly.

dhenry

Quote
the 2n2222 transistor gets very hot very quickly. 


That's the issue with a small device like that.

Quote
So since this is too much current for the npn's can I use a TIP120 Power Darlington Transistor from adafruit for the job?


It will help with cooling but not with power dissipation: the darlington will have considerably higher voltage drop than the 2n2222.

Quote
with a 220 ohm it still get too hot to touch very quickly.


That's fundamentally an issue with such a linear solution.

I would go with a larger npn (not a darlington), or a mosfet (irf510 for example), with a heatsink (or to put it in the tank).

fungus

#10
Dec 08, 2012, 02:38 pm Last Edit: Dec 08, 2012, 03:03 pm by fungus Reason: 1

with a 220 ohm it still get too hot to touch very quickly.


It might be OK...but to be sure you should probably use a bigger transistor with a heatsink.

What constant current circuit are you using? Maybe the PWM signal could connect to that and drive it directly.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

fungus


... with a heatsink (or to put it in the tank).


Water cooling!

PS: Water isn't anywhere near as conductive as most people think...

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

nkd5025

I don't know what the linking rules are here so hopefully this is alright.
http://www.rapidled.com/moonlight-driver-350ma/

Although it has a varying voltage for 1 to 4 leds.  So all four of my leds would be dimmed at the same time if the pwm signal connected to it.

so a power mosfet such as the IRF510 will work fine without heating up too much?

abrookfield

I've used the 3W and 10W version of these guys forever (direct arduino PWM drive)...   ebay #380519501055

All you need then is say a regular 19v laptop power supply for about $5 and you're golden.  
Personally, I use a butchered computer power supply and run strings of 3 at a time
www.reeftopper.com

dhenry

Quote
All you need then is say a regular 19v laptop power supply for about $5 and you're golden. 


Agreed. Never understood why anyone would pay for a sub-par power supply.

Go Up