Pages: [1] 2   Go Down
Author Topic: Dimming 1w leds with transistor and walwart issues  (Read 2336 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 121
Posts: 4598
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

No, I don't answer questions sent in private messages...

Cape Town South Africa
Online Online
Edison Member
*
Karma: 19
Posts: 1189
A newbie with loads of posts, and still so much to learn !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Is this 3v LED ok on 5v ?
Logged

With my mobile phone I can call people and talk to them -  how smart can you get ?

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!

Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 121
Posts: 4598
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

No, I don't answer questions sent in private messages...

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 121
Posts: 4598
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try a smaller resistor on the transistor base, maybe 330 or 220 ohms. 1K might be too high to fully open the transistor.
Logged

No, I don't answer questions sent in private messages...

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 121
Posts: 4598
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: December 08, 2012, 09:03:20 am by fungus » Logged

No, I don't answer questions sent in private messages...

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 121
Posts: 4598
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Water cooling!

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

Logged

No, I don't answer questions sent in private messages...

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Atlanta
Offline Offline
Full Member
***
Karma: 4
Posts: 128
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1] 2   Go Up
Jump to: