Go Down

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

fungus


I don't understand, shouldn't it be around 90mA?  I thought USB2 was supposed to give out 100mA.  Nobody is challenging my math, so I'm assuming that that is correct.  What is it that I'm missing?


USB is also supposed to give out 5V but you say it's only 4.5V. Something is very wrong there.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

adrian_h



I don't understand, shouldn't it be around 90mA?  I thought USB2 was supposed to give out 100mA.  Nobody is challenging my math, so I'm assuming that that is correct.  What is it that I'm missing?


USB is also supposed to give out 5V but you say it's only 4.5V. Something is very wrong there.


Hmmmm, did some voltage tests.  From the Arduino Uno I'm getting under no load (all wires were disconnected):

   Vin = 4.39V
   5V  = 4.90V
   3.3V= 3.28V

But the different USB sources that I'm using are giving about 5.0V (4.98 and 5.06).  I'm thinking that I may have damaged the power regulator by pulling too much current from a few of the digital out pins, except that shouldn't the Vin pin be closer to 5V then the 5V pin in that case?

runaway_pancake


...except that shouldn't the Vin pin be closer to 5V then the 5V pin in that case?


No, if you're using USB as a voltage source then "Vin" is of no use to you.
Don't you have a 9V battery that you could use here?
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

adrian_h



...except that shouldn't the Vin pin be closer to 5V then the 5V pin in that case?


No, if you're using USB as a voltage source then "Vin" is of no use to you.
Don't you have a 9V battery that you could use here?

So I can plug in a battery into the connector while plugged into the USB?  I asked that question, but the response sounded like I use either one or the other.

runaway_pancake

From my point of view - Right (mostly).
Disconnect Vin and plug into USB when you want to upload to the Arduino.
Once that's done, disconnect the USB and then plug in the Vin to see how it works.
Not a lot of work.
[Reasonable?]
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

adrian_h


From my point of view - Right (mostly).
Disconnect Vin and plug into USB when you want to upload to the Arduino.
Once that's done, disconnect the USB and then plug in the Vin to see how it works.
Not a lot of work.
[Reasonable?]

Hmmm, but then I can't see the serial stream. :(  Also at the moment I don't have the power connector or the battery box.

I've changed RB to 59 to push the Vbe to 0.9V (this was done by trial an error as I wasn't sure how to break the circuit apart to determine this resistor) and replaced the R0, R1 and R2 with 27s.  Now the current is at 60mA through the LED section of the circuit.  I was expecting 97.7mA. 

*sigh*  I thought I had it when mjkzz suggested subtracting 1V for the transistor as the calculations actually worked out that time to what I had gotten.

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

mjkzz



From my point of view - Right (mostly).
Disconnect Vin and plug into USB when you want to upload to the Arduino.
Once that's done, disconnect the USB and then plug in the Vin to see how it works.
Not a lot of work.
[Reasonable?]

Hmmm, but then I can't see the serial stream. :(  Also at the moment I don't have the power connector or the battery box.

I've changed RB to 59 to push the Vbe to 0.9V (this was done by trial an error as I wasn't sure how to break the circuit apart to determine this resistor) and replaced the R0, R1 and R2 with 27s.  Now the current is at 60mA through the LED section of the circuit.  I was expecting 97.7mA.  

*sigh*  I thought I had it when mjkzz suggested subtracting 1V for the transistor as the calculations actually worked out that time to what I had gotten.


Vce(sat) is not a fixed number, nor is it a linear relation between Vce, Ib and Ic, if I remember it, as Ic increases, Vce(sat) actually increase in some operating region, hence your lower measurement of 60mA.

The best way for you to experiment is to use SPICE simulation. Or you can measure Vce at different settings. When you plug in your Vce reading from your expriment and matches theoretcial calculation, it means that relationship between Ib, Ic and Vce is not linear (as confirmation). Please take a look at your datasheet, there must be some kind of chart regarding saturation, Ib, Ic, Vce, etc

Your Rb is too low and you could damage your pin.

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

mjkzz

For example, a popular N-Channel MOSFET BS170 can handle up to 0.2A easily when 5V is applied at the gate with Rds  less than 1.5 ohm. For your application, 1.5ohm * 0.1A = 0.15V voltage drop. There is basically no current for the gate, perfect for digital pins.

[edit] It also has TO-92 package, so easy for breadboarding.
www.mjkzz.com
www.pylin.com

runaway_pancake

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. 
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

Hippynerd

I just dealt with this sort of thing a couple months ago. I was trying to get an idea of how much current a cube was using, and when I measured stuff, I found that I had 4 different voltages from 4 different power sources, and all were under 5v.

I used 2n2222 in my transistor cube a couple months ago, and wasnt able to get much help, so I did a bunch of testing. The transistor cube needs between 0 and 240ma, and even the sot23 2n2222s are rated over 350ma, so thats what I used.

It turned out that I needed between 150 and 300 ohms to sink the full 240ma (actually, it was near 240). I ended up using 270 base resistors, because it allowed enough current for LEDs, and It kept the load on the arduino under 20ma (I think it was like 5ma with 270ohm).

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.

I also experimented with some tiny mosfets (a p, and an n), and they were a lot better, I think they drew a fraction of an ma. The mosfets are more expensive, but they seemed like a much better part in my basic testing.
https://sites.google.com/site/rgbledcubes

runaway_pancake



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.
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

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.

adrian_h


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)

adrian_h


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. 

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

Go Up