Go Down

Topic: [SOLVED] High Current through NPN transistor to Arduino Nano Ground and I/O pin (Read 1 time) previous topic - next topic

brokenAvocado

Jan 22, 2016, 02:28 am Last Edit: Jan 22, 2016, 09:31 pm by brokenAvocado Reason: FIXED
Hi everyone (also welcome back to the people who previously know the last post ;))

I've been working on a infrared comms board for my arduino robots (making more than one to work together) Focusing on the infrared comms part, there are two parts, the infrared phototransistors and the emitters, eight of both on that one board. The infrared phototransistors work fine, however, I'm concerned about the infrared emitters and amount of current they're blasting through. The product I'm using for the phototransistors and emitters are: https://www.sparkfun.com/products/241 There is an attachment below for the schematics for the whole thing. Anyways, the schematics reads that for each emitter there is a resistor. Each resistor value is 180 ohms, the voltage passing through is about 5 volts, and current is about 360 milliamps. As you can see, at the bottom of all the emitters is a NPN transistor. The one i'm using is: https://www.adafruit.com/datasheets/PN2222A.pdf. I have just read articles on saturation voltage and how there needs to be the right voltage for the base to be saturated and fully transfer current from the collector to emitter, literally turning the gate on and off. The schematics shows that there is a resistor at the base of the transistor, and I presume current is also coming through the base up to the I/O pin on my arduino. Also looking at this graph, its says something else, but the resistance needs to be correct for the transistor to be properly saturated.

Using ohms law, calculating resistance is easy as doing R=V/I. Then it is R=5/0.36, which gives me a resistance value of 13 ohms. To me, this does not look right, at all. 13 ohms to bring down 360 volts seems, off. Now, obviously, this isn't the way to used ohms law, because all this is is calculating the current resistance with the parameters given. My question is how to find the resistance for a current that you are aware of, and want to bring down that current to something that the arduino can handle, which is 40 ohms for the I/O pins and 200 ma for the ground pin.

Another issue is besides trying to saturate the base pin, why isn't there a resistor on gnd? is it because the current coming through the base to emitter will decrease if there is a resistor on base? I'm still following diagrams like the one below in the attachments, and the schematics.

Anyways, the biggest issue is limitting current for the transistor to supplement the transistor, and not blow up my arduino by overloading the gnd and I/O pins. I tried testing this on a breadboard with an extra arduino on hand, have a dysfunctional GND and I/O pin on the arduino, and the transistor does get hot, a little, before I turned the whole system down.

Sorry for bothering everyone again. I tried googling, and I think I need more help because I don't understand how the transistors work. Sorry if I'm being unintelligent and not using enough google.
Electronics Hobbyist, Robotics, RC Cars, Novice Programmer in C++/Javascript (More to come).

larryd

The transistor has a gain (DC HFE).
5v - .7vbe = voltage across the base resistance.
HFE for 2N2222 = ~40 for IC 500ma
base current needed for IC 500ma is 500/40=12.5ma

Rbase = (5-.7)/.0125=344 ohms, use 330 ohms

.
No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

Wawa

You could halve your LED current problems by using strings of "two IR emitters and one resistor".
Each IR LED drops ~1.4volt@40mA, so two IR LEDs in series drop 2.8volt.
A fully saturated 2N2222 drops 0.4volt.
The LED current limiting resistor should drop the remaining 1.8volt. Use 47ohm.
Now you have only four strings that use ~40mA each = 160mA total.
You need 1/20 to 1/10 base current, so 8 to 16mA. Use a 470ohm base resistor.
Leo..

dwightthinker

I'm curious about the numbers 5V, 180 ohms and 360ma.
I'm also curious about 200ma on a arduino output pin.
These seem like a number of number pulled out of a hat and
not related to what they are connected to.
Dwight

CrossRoads

200mA is the current limit on a VCC or GND pin. So a Nano with 2 VCC pins can support 400mA.
However one must honor the per port current limits for sinking & sourcing current, see the notes after the Table 30-1.

The other numbers: 5V, that's typical supply voltage, used in logic circuits for a loooong time. USB outputs 5V as well. (5V +/- 5%, so 4.75V to 5.25V)
180 ohm, if you had a red LED, its Vf is about 2.2V. So a 180 ohm current limit resistor will allow about 15mA:
(5V - 2.2V)/180 ohm = 15.5mA, nice safe amount for an IO pin and driving an LED brightly.
360mA: 18 LED at 20mA each = 360mA. 60mA more than the IO pins should be supporting. See the notes, which discuss 300mA total max.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

brokenAvocado

Thank you LarryD and Wawa. Couldn't have done the calculations myself. Now I just got to learn the calculations my self. Thank you for calculating this.

Thank you CrossRoads for helping with Dwight. I wasn't online at the time to answer his question. Thank you.

Well just one question, is there only a resistor for the base? I thought there was current flowing to the emitter as well, which is over the threshold of the arduino ground pin.

Or is the current flowing from the base to the emitter and thus getting limited by the resistor.
Electronics Hobbyist, Robotics, RC Cars, Novice Programmer in C++/Javascript (More to come).

dwightthinker

I see what your worried about.
Yes, there is the sum of all the LEDs plus the current of the
base going through the emitter to ground.
The question is where is that current really going.
The chip has a limit of current through its ground pins but
that is current caused by the sum of the currents sinked through
the I/O and chips operational current.
The current from the LEDs/emitter is not involved.
If you are connecting the emitter to the board and some place
else connecting the power to the board, the current is crossing
the board but is not current through the chip, except some
possible stray current through the chips multiple ground pins.
If instead, you used the ground that was closer to the power
supply, none of the current would be in chip.
Back to the board, one might ask how much current can one
put through one of the connectors as I suspect the board
itself can handle more than an ampere without issues.
I would guess the pins could handle 1/2 ampere without
burning out.
Now lets look at things like ground bounce. All wire has both
some resistance and some inductance.
Turning on a large current quickly is going to cause some
ground bounce( noise ).
If enough, it can cause the uP to forget what it was doing.
Maybe, it would be better to connect the emitter lead to
the power supply rather than the lead on the board marked
ground.
OK, now where is the power for the LEDs coming from?
Are you using the 5V regulator on the board. That has
similar problems that the ground has. When the LEDs
are turned on, it can cause the regulator output to drop.
This can cause the up to lose what it was doing.
Why not use a separate regulator and not cause issues
with the regulator on the board.

OK, best practice:
Connect heavy ground loads at the power supply, not at the ground pin of the board.
Use a separate regulator for the heavy loads and not the boards regulator.

It might be a good idea to use a separate supply but
one has to be careful, one may not want to power the
load before the uP. These chips don't like to see power
through their I/O protection circuits before they powerup,
them selves.
This circuit shouldn't be an issue for the uP, as the transistor
will be blocking any such forced current to the uP.


brokenAvocado

If you are connecting the emitter to the board and some place
else connecting the power to the board, the current is crossing
the board but is not current through the chip, except some
possible stray current through the chips multiple ground pins.
If instead, you used the ground that was closer to the power
supply, none of the current would be in chip.
Using the GND pin closest to the VCC will help. ok. That GND pin near the VCC is not connected to the chip, but the other GND pin farthest away from VCC is? So is that why there are two GND pins?
Electronics Hobbyist, Robotics, RC Cars, Novice Programmer in C++/Javascript (More to come).

Grumpy_Mike

Quote
That GND pin near the VCC is not connected to the chip
Yes it is.

brokenAvocado

Yes it is.
oh
I checked the chip schematic
yep
So Dwight is telling me to put the gnd into the power source?
ok.
Electronics Hobbyist, Robotics, RC Cars, Novice Programmer in C++/Javascript (More to come).

dwightthinker

I'm saying, you have to look at the path of the current
flow.
Why would the current have significant flow from a pin next
to the power input to have significant current halfway across
the board.
On a board with a power plane, the current does spread
but it doesn't spread so much that there is significant current
on the far side of the board.
Looking at path on the board is like looking at parallel resistors.
If you draw a line between the contact point and the power
connection, you can assume that that path is the lowest
resistance.
If you draw an arc of say 2 times that length on the board,
the resistance of that arc will be twice as much as the straight
line. It would have half the current.
I know, I'm over simplifying here a little but the thing is the same.
The ground terminal at the far end of the 2650 board is almost
in line with the chip. Some of the current will flow under the chip.
some will even flow through the leads of the chip.
Still, most of the current will be distributed across the ground plane
and not cause significant current flow through the chips leads
unless the total current was vary high.
In your case, 360ma is not enough to worry about. If you are
worried, the closer to the power source the better.
Of course, the grounds are connected, that is the only way
to ensure the same relative voltage point as a reference for
all the parts.
Just being connected does no mean the current path is through
that part.
If the board and chip were made all of superconducting wire,
the current would distribute equally every where.
We are talking about real wire. It has real resistance, although
small. This makes non-uniform current flow with the least resistance
path having the most current flow.
I'm saying that if you are really worried about 360ma on the ground
of the board, connect it to the power supply external to the board.
It would be difficult for me to think that with even the most sensitive
meter at the chip, you would see any current from this load through
the chip.
If you used the ground plane of the board, you might be able to
detect a few micro-amperes of increase on one lead and a similar
decrease on some other.
For the most part, the current out of the emitter is not flowing
through the chip or the I/Os ( except the current of the base lead ).
I hope I'm not confusing you. I'm just saying, look at the ground
path and look at how the current from the load is distributed.
The optimal place to connect the ground of the heavy load
it at the power source.
This becomes less optimal as you go away from the power source.
In the case of 360ma, I'd not worry about it unless you were
wiring with 50 ga wire.
Dwight

brokenAvocado

This becomes less optimal as you go away from the power source.
In the case of 360ma, I'd not worry about it unless you were
wiring with 50 ga wire.
Dwight

Thank you Dwight. That part was kind of confusing to me, so thanks for explaining further.
Electronics Hobbyist, Robotics, RC Cars, Novice Programmer in C++/Javascript (More to come).

Go Up