Driving 6 IR LEDs using a transistor

mjkzz:
Again, if you used MOSFET type of device, you will not have this kind of problem.

What specs would I be looking at? And why would I be picking for those specs? (The last q is just so that I can be able to pick such things out for myself for later projects)

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

I wonder, instead of doing this stuff using a transistor or MOSFET, I see that from this page: Arduino Playground - 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?

 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?

Sure. I think this is where I asked about HFE.

I'd rather not pollute this thread with my stuff.

adrian_h:

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 Intelligent Power and Sensing Technologies | onsemi 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.

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.

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

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.

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.

dc42:

adrian_h:

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.

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.

dc42:

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

dc42:

  • You have the PN2222A transistor wired back-to-front. If you look at the datasheet Intelligent Power and Sensing Technologies | onsemi 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.

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

mjkzz:
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?

mjkzz:
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.

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.

mjkzz:
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.

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.

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.

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.

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 :slight_smile:

adrian_h:

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.

mjkzz:
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

adrian_h:
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 --
IR Led - #21 by runaway_pancake - LEDs and Multiplexing - Arduino Forum

Well, the luck is that a non-linear device in this case behaved (or did it?) like your replacement resistor in that particular circuit, you might not be lucky to get the same result . . .

One example is, if the supply voltage is 3.3V and OP uses 3 three LEDs in series, your simulating circuit would still work, but OP's circuit won't if each LED has 1.25 forward voltage because there is not enough voltage to turn the LEDs on. Do you see what I am getting at? Of course, you could probably argue that you would use a different simulation circuit.

My point is, in general, it is not a good idea to use a linear device to simulate a non-linear device.

It was and is valid within the "parameters" set forth, namely the 5V (USB)thing.

If somebody then decides to up and use 3V, or 30V, or the house wiring, what has that to do with me?

I knew you are going to say this. :slight_smile: Cheers.