Go Down

### Topic: Simple Transistor Question (Read 1 time)previous topic - next topic

#### aKiwi

##### May 28, 2011, 12:39 pm
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

#### jackrae

#1
##### May 28, 2011, 01:03 pm
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 ?

#### markbee

#2
##### May 28, 2011, 02:41 pm
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
XBee blog: http://lookmanowire.blogspot.com/

#### aKiwi

#3
##### May 29, 2011, 02:31 am
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.

Thanks.

#### James C4S

#4
##### May 29, 2011, 02:49 am
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.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

#### aKiwi

#5
##### May 29, 2011, 04:58 am
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.

#### Grumpy_Mike

#6
##### May 29, 2011, 05:41 am
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.

Go Up

Please enter a valid email to subscribe

### Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy