The max current I can flow with a 5V signal at the base
This statement is wrong on many levels.
The NP2222 works when current (ie. amps) goes through the base, not when a voltage is applied to it.
The transistor has a gain of 100 (or more) so you need to allow 6.5mA (or more) of current through the base. Normally you use a 330 Ohm resistor between the Arduino pin and transistor base for this sort of transistor. This allows enough current to fully turn on the transistor.
The max current I can flow with a 5V signal at the base
This statement is wrong on many levels.
The NP2222 works when current (ie. amps) goes through the base, not when a voltage is applied to it.
The transistor has a gain of 100 (or more) so you need to allow 6.5mA (or more) of current through the base. Normally you use a 330 Ohm resistor between the Arduino pin and transistor base for this sort of transistor. This allows enough current to fully turn on the transistor.
OK, so the transistor is (I see, its like a diode in that respect) a current device, and 6.5mA will completely close this one; thanks.
So, how much current or power can be controlled with this? I am illuminating several LED's and need to know if I'm pushing the limits of the transistor, or I'm OK. Any help there?
thanks, and I did mention I'm not an electronics guy, but I am a quick study XD
VCESat is the typical voltage when IB flows. in this case, if you souce 50mA into the basis, the voltage between C and E is assumed to be 1V. But you won't be able to get 50mA out off your Arduino. Additionally, you should have a resistor in series from Arduino to B.
The VCESat multiplied with the current IC is about the Power dissipation...
Maybe it's useful if you think about MOS transistors. They need (nearly) no current for control and have e very small RDSon wich means when the transistor is in on state there will be less voltage at the drain than at the collector of that old-fashioned 2N2222. And you don't need any resistor between Arduino and the gate electrode. Please see the image below.
Not the whole story. A transistor with a nominal gain of 100 would have
Ib = Ic/10 or so when used as a switch.
As a switch transistors have to be driven hard into saturation (otherwise the
collector voltage won't drop enough toward the emitter). Normally you'd
use 1/10th to 1/20th of the collector current in the base to get to hard saturation.
This is important as the device heat dissipation is the current times this
voltage (called "Vce(sat)").
Put 6.5mA into the base and you might get 650mA from the collector (or
not, gains vary from device to device and fall off at higher collector currents),
but Vce might only drop to 1.5V, so the device dissipates 0.65 x 1.5 ~= 1W,
which will fry the transistor.
Giving 50mA into the base you'd get good saturation, so Vce= 0.1 or so, therefore
power dissipation is only 65mW, no heatsinking needed.
However this is too high a base current to drive direct from an Arduino
pin, where the absolute upper limit is 40mA.
In practice you'd use a MOSFET, much easier to drive.
There are better transistors available too, my favorite is ZTX851
which can switch 2A with Vce(sat) = 0.1V with only 40 mA base current,
but can handle 20A pulses even! Its datasheet has a chart for saturation
voltage for Ib = Ic/50.
Darlington transistors have oodles of gain and will definitely saturate
nicely, but alas waste 1 to 1.5V due to the circuit arrangement - easy to
drive from low current, but usually need heatsinking.
So, if I don't want to spend to much on a (multiple) MOS for this project, and I am only looking to pass less than 200mA through any one group of led's, the 2P2222 'old fashioned' transistor will be OK, yes?
also, you mentioned voltage across the emitter/collector (transistor impedance?) I would then need to discount the 5V power in by that voltage to tune the resistors for the led's, yes?
Where is 650mA coming from?
Datasheet provided clearly shows Absolute Max as 600mA.
Further it shows that you need 50mA of base current to saturate to allow 500mA thru.
Yes, Voltage available to the LEDs will be 5V less the Vce-sat of up to 1V. If you look at the charts that complete the datasheet, there will be curves showing the voltage at different currents.
MOSFETs are better in that regard - a good low Rds MOSFET will be in the 10mOhm range (.01 ohm) and the voltage drop will be small - with 1A of current thr the MOSFET, the voltage will be V = IR = 1A * .01Ohm = .01V.
BulldogLowell:
So, if I don't want to spend to much on a (multiple) MOS for this project, and I am only looking to pass less than 200mA through any one group of led's, the 2P2222 'old fashioned' transistor will be OK, yes?
Yes.
Also a lot cheaper/smaller.
Use a 220 Ohm resistor between Arduino and transistor base, just to be sure you're saturating it.
PS: MOSFETs are 'old fashioned', too. It's just a different way to do it. MOSFETs have problems all of their own.
CrossRoads:
Yes, Voltage available to the LEDs will be 5V less the Vce-sat of up to 1V. If you look at the charts that complete the datasheet, there will be curves showing the voltage at different currents.
MOSFETs are better in that regard - a good low Rds MOSFET will be in the 10mOhm range (.01 ohm) and the voltage drop will be small - with 1A of current thr the MOSFET, the voltage will be V = IR = 1A * .01Ohm = .01V.
fungus:
BulldogLowell:
So, if I don't want to spend to much on a (multiple) MOS for this project, and I am only looking to pass less than 200mA through any one group of led's, the 2P2222 'old fashioned' transistor will be OK, yes?
Yes.
Also a lot cheaper/smaller.
Use a 220 Ohm resistor between Arduino and transistor base, just to be sure you're saturating it.
PS: MOSFETs are 'old fashioned', too. It's just a different way to do it. MOSFETs have problems all of their own.
Read this page: BJT H
Thanks for all the help @Crossroads and @fungus, I have the led's playing nicely and the transistor seems happy (cool).
Interesting to see the led light up a bit from just touching the shielded jumper before I attached it to the 220ohm resistor.
Interesting. I'll make sure that I keep that in mind as I build my project. Any transient 'stuff' on my board could cause a little led to shine. I'm curious, can I pot these transistors with silicone to keep away dust, etc? If I get it all working nicely, I'll want to keep it working.
**note from my handle I went to ULowell (when it wasn't called UMass Lowell and they were the politically incorrect Chiefs instead of the River Hawks).
Thanks again for your assistance, I'm sure I'll be back before I'm done.
Also, I have two Arduino boards talking and playing very nicely when I transmit a message via serial, but not so with an integer. I can always post in the right section of the forum.
I read as an int but I get it as a char? Is that a serial thing? also, cannot seem to get more than one char in a string that I send. I think I don't understand serial and possibly declaring the message[3] improperly...
this is working, but not as expected (but I'm OK with that).
int i;
int MessageLength;
int Message[3];
//
int pwmPin = 40; //PartlyCloudy
int pwmPin2 = 41; //PartlyCloudy
int pwmPin3 = 42; //OverCast
int pwmPin4 = 43; //Overcast
int pwmPin5 = 44; //Thunderstorms
int pwmPin6 = 45; //Thunderstorms
int pwmPin7 = 46; //Sunny
int pwmPin9 = 47; //Cloudy
int pwmPin10 = 48; //Cloudy
int pwmPin11 = 49; //Rain
int pwmPin12 = 50; //Rain
int pwmPin13 = 51; //Snow
int pwmPin14 = 52; //Snow
void setup()
{
Serial.begin(19200);
}
void loop()
{
if (Serial.read() == '
)
{
for (i=0;i<3; i++)
{
delay(1);
Message[i] = Serial.read();
delay(10);
Serial.print("read a: ");Serial.println(Message[i]);
if(Message[i] =='#');
{
break;
}
}
MessageLength = i;
delay(10);
Serial.print("the message was:");
for(i=0;i<MessageLength;i++)
delay(10);
{
Serial.print(Message[i]);
delay(10);
}
Serial.println("/");
switch (Message[i])
{
case 65://an "A" was sent
Serial.println("Sunny");
Sunny();
break;
case 66://a "B" was sent
Serial.println("Partly Cloudy");
PartlyCloudy();
break;
case 67://a "C" was sent
Serial.println("Cloudy");
Cloudy();
break;
case 68://a "D" was sent
Serial.println("ThunderStorms");
ThunderStorms();
break;
case 69://a "E" was sent
Serial.println("Rain");
Rain();
break;
case 70://a "F" was sent
Serial.println("Snow");
Snow();
break;
}
}
}
Need to use Serial.available before start reading bytes in:
if (Serial.available()>2){ // 3 bytes ready?
if (Serial.read() == "$"){ // start byte to get in sync
// read 2 more bytes, do whatever
}
// no $, wait for more data
}
I went to RPI, The Engineers. Let's Go Red! 1985 NCAA Mens Ice Hockey Champions, we won our intramural ice hockey championship the same season.