Pages: [1]   Go Down
Author Topic: Simple Transistor Question  (Read 709 times)
0 Members and 1 Guest are viewing this topic.
New Zealand
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello fellow peeps!


When i use -> digital(pin, HIGH) for the base pin on my little transistor (2N3904) i get everything working.
But if i use the 5v pin from Ardunio it doesn't..


What basic principle am i missing here?

/slightly confused
Logged

SW Scotland
Offline Offline
Edison Member
*
Karma: 17
Posts: 1400
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you have a base current limiting resistor (say 4k7) in the transistor base connection.  If not then the base junction is causing a (almost) dead short across the supply line.  Why would you want to connect the base to the 5volt line ?
Logged

Hamburg, Germany
Offline Offline
Sr. Member
****
Karma: 6
Posts: 291
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

in fact you almost always need a base resistor. for the common npn-transistors like 2n3904 or bc547 etc. it's quite easy to calculate if you want to use the transistor as a switch:

Rbase = Uvcc-Ube/ Ibase => Rbase = (5 volt-0,7volt)/0,002A = 2150 ohms.

So if you want to drive the transistors base with 2 mA you need a resistor to the base of about 2k2 ohms.

markbee
Logged


New Zealand
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the replies.

My basic newb thinking was that iirc, digitalwrite at high was = to 5v, so with some quick proof of concept testing i thought it should do the same thing.

Clearly i have much to learn. smiley-wink

Thanks.


Logged

Fort Lauderdale, FL
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6144
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
My basic newb thinking was that iirc, digitalwrite at high was = to 5v, so with some quick proof of concept testing i thought it should do the same thing.

The difference wasn't explicitly stated:  the I/O pin limited the current to the transistor, the 5V supply did not.  Neither is a good thing, because the I/O pins are not designed to be current limiters.  As already stated, you should always have a current limiting resistor connected to the base of the transistor (in cases where you are using it as a switch.)

With a current limiting resistor in series with the base, the I/O pin and 5V supply will work the same for turning on the transistor.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.c

New Zealand
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for that James.

Have used this transistor with another 9v circuit, running pwm with no resistor.

Duly noted, if using as a switch - need resistor. (With calc used above)

Used a 1R2 (instead of 2150 ohms) resistor for a test and it held it open and then faded out. So i think i need to do some googling to further my knowledge.

Thanks for the help.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 631
Posts: 34506
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Used a 1R2 (instead of 2150 ohms)
In this context a 1R2 resistor is just like no resistor at all. Unless you mean a 1K2.
Logged

Pages: [1]   Go Up
Jump to: