Newbie question about transistors

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
KB6WIJ
 
Posts: 20
Joined: Fri Mar 06, 2015 8:58 pm

Newbie question about transistors

Post by KB6WIJ »

I'm a 59-year-old adolescent teaching myself about electronics, so please bear with my questions. :)

I understand that a transistor can be used as a switch (to turn a motor on and off, for example). I have a question that I haven't been able to answer so far. Do the voltages at the base and the collector have to be equal, or can a transistor act like a relay? Can a Raspberry Pi and a transistor control a 12-volt motor, or is a relay or motor controller necessary?

A comprehensive answer involving transistor theory would probably go right over my head, so a "yes-or-no" sort of response is fine with me. :)

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Newbie question about transistors

Post by zener »

This is a classic Adafruit Mike question and if you search around you will find some of his posts which condense an entire college level lecture into one post. You could save time and money on your education.

But you just want simple answers and that is my specialty!
KB6WIJ wrote:I understand that a transistor can be used as a switch (to turn a motor on and off, for example).
True
KB6WIJ wrote:Do the voltages at the base and the collector have to be equal
Hmmm... No. When the transistor is off they are very different since the transistor is acting essentially like an open circuit. Ideally when the transistor is on they will be the same, but this not being an ideal world they will be a little different. But the goal is for the transistor to act like a short when it is on, at least when you are doing on/off switching. You can also use transistors in a "partially on" or linear range for certain applications.
KB6WIJ wrote:or can a transistor act like a relay?
Yes with some fine print. The fine print is that a relay contact is a mechanical switch and doesn't care about polarity or the relationship between the voltages on the contacts and the voltages on the coil. The transistor usually DOES care. This is why there are different flavors of transistors such as NPN, PNP, N channel, P channel.
KB6WIJ wrote:Can a Raspberry Pi and a transistor control a 12-volt motor
Yep
KB6WIJ wrote:or is a relay or motor controller necessary?
No. But those are built specifically for that job so are sometimes a better option. Can you build a cabinet out of wood? Yes. Can you buy a cabinet at IKEA and use it today? Yes, if you are handy with small Allen wrenches...

User avatar
KB6WIJ
 
Posts: 20
Joined: Fri Mar 06, 2015 8:58 pm

Re: Newbie question about transistors

Post by KB6WIJ »

Thanks, zener! I'm sure a motor controller is a better choice except for very simple applications (like I never want to rewind). Actually, I was curious for several reasons... such as could I use a transistor to actuate a relay so that I could send Morse code with the horn in my truck. Did I mention that I'm fairly adolescent? :)

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Newbie question about transistors

Post by adafruit_support_mike »

One of the main reasons I studied electronics was to scratch the "okay, how do transistors actually work?" itch.
KB6WIJ wrote:Do the voltages at the base and the collector have to be equal, or can a transistor act like a relay?
Taking an NPN transistor as a example, the voltage at the collector can be anywhere between VCC and about 0.2v higher than the emitter voltage. A PNP works the same way, but the collector ranges from about 0.2v below the emitter voltage to GND.

The offset is a basic principle of electronics: the voltage at the input side has to be higher than the voltage at the output side for current to flow.

The collector voltage can fall below the base voltage (the current is going to the emitter, which is still lower), but when the collector voltage falls below the base voltage, current does start to flow from the base to the collector. It isn't much.. about 1/1000th of the current that flows from the collector to the base.. but it can cause trouble if you're using the transistor as an analog amplifier.

When the collector voltage falls more than about 0.4v below the base voltage, the transistor reaches a state called 'saturation' where adding more base current doesn't help much.

It's easier to understand transistors if you connect resistors to the base, emitter, and collector so you can see what the current is doing. Under that arrangement, the simplest rules of behavior for an NPN are:

1) The emitter voltage will be about 0.65v below the base voltage.

2) The current coming out the emitter will be whatever it takes to make rule #1 work.

3) About 99% of the current coming out the emitter will come from the collector. The remaining 1% will come from the base.

As to why the 99:1 ratio exists, I like to think of it in terms of parachuting sheep: http://forums.adafruit.com/viewtopic.ph ... 69#p355392
KB6WIJ wrote:Can a Raspberry Pi and a transistor control a 12-volt motor, or is a relay or motor controller necessary?
A simple transistor can do it, but a RasPi's GPIO pins can only deliver about 8mA. The 99:1 thing limits the maximum collector current from such an arrangement to about 800mA (he said, handwaving the 1% error away).

For more current, you'd want to use one transistor to control another one's base, in what's called a Darlington connection. 1mA of current into the first transistor's base sends 99mA into the second transistor's base, which allows about 10A to flow through the second transistor's collector. In practice the base current to the first transistor will be much smaller. The bad news is that the "collector can only fall about 0.4v below the base" thing applies to the input transistor. A Darlington's collector can only come within about 1v of GND.

User avatar
KB6WIJ
 
Posts: 20
Joined: Fri Mar 06, 2015 8:58 pm

Re: Newbie question about transistors

Post by KB6WIJ »

adafruit_support_mike wrote:One of the main reasons I studied electronics was to scratch the "okay, how do transistors actually work?" itch.
Same here, but I have a LOT to learn. :)

It sounds as though a motor controller is the best way to solve my motor issues, and a relay (perhaps solid state) would be the best solution for my Morse code auto horn. I was curious about this because nothing I've read indicated that my idea would work, but nothing I've read said it wouldn't, either.

I really love learning new things! Thanks, Mike!

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”