Go Down

Topic: Driving 6 IR LEDs using a transistor (Read 15670 times) previous topic - next topic

adrian_h

I wonder, instead of doing this stuff using a transistor or MOSFET, I see that from this page:  http://playground.arduino.cc/Main/ArduinoPinCurrentLimitations, I could go up to a max of 40mA per pin for transient current draw so long as I do not exceed a total of 150mA on the banks shown.

Given that could I not wire this up like this?

Code: [Select]
pin 10 ----|>|--|>|--'\/\,-----+
                                |
pin 11 ----|>|--|>|--'\/\,-----+
                                |
pin 12 ----|>|--|>|--'\/\,-----+
                                |
                               _|_
                                _
                                .
E=5V
I=40mA
R=(5/.04)/3=41


Then the pins for that bank would only be pulling at most 120mA.

Comments?

Hippynerd




I used 2n2222 in my transistor cube a couple months ago, and wasnt able to get much help,...

I tried calculating things out, but I couldnt figure out what the gain should be, so I made many calculations, then I tried stuff, but a little experimenting, and measuring solved my problem quickly.


If you're truly of a mind to accept help and commited to learning then I can set you right quickly.


Sure. I think this is where I asked about HFE.
http://arduino.cc/forum/index.php/topic,129431.msg1101355.html#msg1101355

I'd rather not pollute this thread with my stuff.
https://sites.google.com/site/rgbledcubes

dc42



59 ohms is too low for Rb, you'll overload the Arduino output pin. Don't go below 100 ohms.

Can you post a photo of your setup?

Sure I can, not sure what you'd get from them  though.


What I get from them is that your wiring is not  as you described it. Here are some problems I can see:

- You have a red wire connected between +5V of the Arduino to the bus strip marked "+" on the breadboard. But you have nothing else connected to that bus strip.

- You have a green wire connected between Vin of the Arduino and the LEDs. If you are powering the whole system via USB, you should not be taking power from Vin, you should be taking the power to the LEDs from the +5V pin instead.

- You have the PN2222A transistor wired back-to-front. If you look at the datasheet http://www.fairchildsemi.com/ds/PN/PN2222A.pdf you will see that you have the emitter connected to the LED series resistors via an orange wire, and the collector connected to ground via a green wire.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

runaway_pancake


Um, why are you saying phooey?  I'm not sure what you are trying to tell me here.


Given the example that I cited I'm "saying phooey" to all this "Vce" junk (1V, 2V? Oh, my Aunt Fanny!) as well as the "magic mosfets" advocacy.

Way back at Reply #29 I asked you about the orientation of your transistor and you just keep looking for some easy way out.

David will take care of you.
As for me, I'm not going to plough the sea.


"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

mjkzz



Um, why are you saying phooey?  I'm not sure what you are trying to tell me here.


Given the example that I cited I'm "saying phooey" to all this "Vce" junk (1V, 2V? Oh, my Aunt Fanny!) as well as the "magic mosfets" advocacy.

Way back at Reply #29 I asked you about the orientation of your transistor and you just keep looking for some easy way out.

David will take care of you.
As for me, I'm not going to plough the sea.





Or so it was user error . . . I don't have 2N2222 so I could not build one :-)

For a while, I have doubted all the people who suggested 2N2222 to drive LEDs, phew :-). Nice work and thanks for actually doing it, thumbs up!!!

Well, MOSFET has its advantages -- it draws little current to turn it on and no Ib, Vce mess.
www.mjkzz.com
www.pylin.com

mjkzz


Oh, phooey.

Here it is -
I have just set up this "very" circuit using a PN2222.  (It's the same.)
In place of the LEDs etc I am simply using 50?. 
For the base resistor I have 470?.
It's doing the 100mA (nom.) nicely:
4.8V across the collector resistor (4.8V / 50? = 96mA) and there is a whopping 200mV V_ce. 


OK, so you did not actually use two LEDs which drops voltage by 2.5V. With two LEDs, the total voltage on the resistor and transistor is Vce+Vr = 4.5 - 2.5 = 2.0V (according to OP's claim)

I just downloaded datasheet for PN2222A and your 200mV Vce at 100ma Ic seems reasonable. The 1.0V Vce claimed by OP is too high and according to chart, it could only happen at 500mA. At 150mA, Vcesat should be around 0.3V according to datasheet.
www.mjkzz.com
www.pylin.com

adrian_h




59 ohms is too low for Rb, you'll overload the Arduino output pin. Don't go below 100 ohms.

Can you post a photo of your setup?

Sure I can, not sure what you'd get from them  though.


What I get from them is that your wiring is not  as you described it. Here are some problems I can see:

- You have a red wire connected between +5V of the Arduino to the bus strip marked "+" on the breadboard. But you have nothing else connected to that bus strip.


Oops, also had a blue wire on the -ve power bus, but these aren't important.  I removed some other circuits to make the main circuit clearer.


- You have a green wire connected between Vin of the Arduino and the LEDs. If you are powering the whole system via USB, you should not be taking power from Vin, you should be taking the power to the LEDs from the +5V pin instead.

Yes, this was also stated on this thread.  However, I'm still at a loss as to how I can plug in an external power supply while still maintaining communication with my PC through the serial interface.


- You have the PN2222A transistor wired back-to-front. If you look at the datasheet http://www.fairchildsemi.com/ds/PN/PN2222A.pdf you will see that you have the emitter connected to the LED series resistors via an orange wire, and the collector connected to ground via a green wire.

That's super useful, I had assumed that it was collector, base, emitter and not the other way around.  Strange that it still functioned though.  Would doing that have damaged the transistor?  It seems to work in either direction.  Still only getting 60mA but probably won't get higher without going to an external power source.

adrian_h



Um, why are you saying phooey?  I'm not sure what you are trying to tell me here.


Given the example that I cited I'm "saying phooey" to all this "Vce" junk (1V, 2V? Oh, my Aunt Fanny!) as well as the "magic mosfets" advocacy.

Way back at Reply #29 I asked you about the orientation of your transistor and you just keep looking for some easy way out.

David will take care of you.
As for me, I'm not going to plough the sea.




lol, sorry, I missed that.  There's a lot of info here. :)  Though, changing the orientation doesn't seem to have changed anything, I have updated my circuit wiring accordingly.

adrian_h


For a while, I have doubted all the people who suggested 2N2222 to drive LEDs, phew :-). Nice work and thanks for actually doing it, thumbs up!!!

Why would you think that that particular transistor could not drive an LED?  Isn't it just another switch after all?


Well, MOSFET has its advantages -- it draws little current to turn it on and no Ib, Vce mess.

Yup, just trying to make this as inexpensive as possible.  But it doesn't preclude that I won't go that route.

adrian_h

#54
Mar 30, 2013, 07:45 am Last Edit: Mar 30, 2013, 07:54 am by adrian_h Reason: 1

I just downloaded datasheet for PN2222A and your 200mV Vce at 100ma Ic seems reasonable. The 1.0V Vce claimed by OP is too high and according to chart, it could only happen at 500mA. At 150mA, Vcesat should be around 0.3V according to datasheet.

Sorry, I feign ignorance :).  I just got the info from here:  http://www.digikey.com/product-detail/en/PN2222ATFR/PN2222AD26ZCT-ND/459004

Looking at the datasheet (which I mostly do not understand) I don't see the info that states 0.3V at 150mA.

I really appreciate all the help you guys and gals are giving me BTW.  This is a very difficult but gratifying process (at least on my end), but not without its frustrations.

runaway_pancake


OK, so you did not actually use two LEDs which drops voltage by 2.5V. With two LEDs, the total voltage on the resistor and transistor is Vce+Vr = 4.5 - 2.5 = 2.0V (according to OP's claim)


The object was:

  • to verify 100 mA of collector current

  • to note/observe V_ce



Done.

Quote

Well, MOSFET has its advantages -- it draws little current to turn it on and no Ib, Vce mess.

There is no "mess", it's the simplest thing in the world, there's no doctoral thesis here.
Quote
Yup, just trying to make this as inexpensive as possible.  But it doesn't preclude that I won't go that route.

There's no magic bullet there either - you will still have to get the wiring right.
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

adrian_h

Well, thanks for all your help everyone.  Looks like it's just a matter of trial an error then.  Calculations are just too complex unless I try to use that SPICE simulator mjkzz talked about, which would be another project in itself.

One thing I've noticed though is that when I turn on the LEDs, it seems to do a number on the ADC unit.  I'll post that in another thread though.

Thanks again.

mjkzz

#57
Apr 03, 2013, 12:40 am Last Edit: Apr 03, 2013, 12:49 am by mjkzz Reason: 1


OK, so you did not actually use two LEDs which drops voltage by 2.5V. With two LEDs, the total voltage on the resistor and transistor is Vce+Vr = 4.5 - 2.5 = 2.0V (according to OP's claim)


The object was:

  • to verify 100 mA of collector current

  • to note/observe V_ce



Done.

Quote

Well, MOSFET has its advantages -- it draws little current to turn it on and no Ib, Vce mess.

There is no "mess", it's the simplest thing in the world, there's no doctoral thesis here.
Quote
Yup, just trying to make this as inexpensive as possible.  But it doesn't preclude that I won't go that route.

There's no magic bullet there either - you will still have to get the wiring right.


Yes, your objective is correct, however you are using a resistive load to simulate a non-resistive, non-linear load, LEDs, you get lucky to get same result.

I call it a mess when using a current based switch in digital circuit -- looking at your "simulation" cicrcuit, your base current is rather large for a digital pin.

Of course, calling it a mess is subjective :-)

www.mjkzz.com
www.pylin.com

mjkzz



I just downloaded datasheet for PN2222A and your 200mV Vce at 100ma Ic seems reasonable. The 1.0V Vce claimed by OP is too high and according to chart, it could only happen at 500mA. At 150mA, Vcesat should be around 0.3V according to datasheet.

Sorry, I feign ignorance :).  I just got the info from here:  http://www.digikey.com/product-detail/en/PN2222ATFR/PN2222AD26ZCT-ND/459004

Looking at the datasheet (which I mostly do not understand) I don't see the info that states 0.3V at 150mA.

I really appreciate all the help you guys and gals are giving me BTW.  This is a very difficult but gratifying process (at least on my end), but not without its frustrations.


I got the same datasheet, in about middle of the 2nd page, there are some numbers about Vcesat, please read it carefully.
www.mjkzz.com
www.pylin.com

runaway_pancake

#59
Apr 03, 2013, 02:17 am Last Edit: Apr 03, 2013, 02:23 am by Runaway Pancake Reason: 1


Yes, your objective is correct, however you are using a resistive load to simulate a non-resistive, non-linear load, LEDs, you get lucky to get same result.

I call it a mess when using a current based switch in digital circuit -- looking at your "simulation" cicrcuit, your base current is rather large for a digital pin.

What luck?  Current is current, the LEDs make for zero difference.
And the base current, approx 5mA, is well under-spec for a "digital pin" anyway that's sliced.
It's not unsound and it works.
Maybe it's "over-driven"; but that makes it "beta-proof" - no harm, no foul. Look what I have to work with here.  smiley-tired_grin  


Looks like it's just a matter of trial an error then.  
Calculations are just too complex unless I try to use that SPICE simulator mjkzz talked about, which would be another project in itself.

It's not "trial and error".
Just do what I've told you - and get the wires right.
I don't know how better I can make the point other than to have you send me the parts and do it for you.

> > > > This person managed to get with the programme --
http://arduino.cc/forum/index.php/topic,156059.msg1178571.html#msg1178571
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

Go Up