Resistor with a Transistor
I know how to wire up a BS2 Stamp to a·transistor to switch a load. But I was wondering if you should put a resistor between the Stamp pin and the base·of transistor to limit the current on the pin. Most of the the diagrams I have seen posted not have one. I have tried with and without, both work. Just wondering if the extra protection is needed?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······ Joe Fishback
-Robots are my friends-
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······ Joe Fishback
-Robots are my friends-
Comments
(as for will...89's comment -- it must be the answer to another question.)
In almost all cases, you need a resistor in series with the transistor base to limit the current. It protects both the BS2 and the transistor. The base-emitter junction is a silicon diode which will limit the voltage in to the transistor to about +0.7 volts which is also clampping the BS2 output to that level and will take excess currrent from the Stamp pin. This assumes an NPN transistor with the emitter connected to ground and the load in series with the collector with the other end of the load connected to an appropriate +voltage source. It still applies if you use a PNP transistor with Emitter connected to +5 volts and load between collector and ground. If you use either NPN or PNP transistors in an emitter follower (AKA common collector) configuration, then it is safe(r) to omit the base resistor. If you use an enhancement mode MOSFET transistor, such as a 2N7000, you can omit the resistor in series with the gate (input) but it is advisable to use a resistor (>=100k) from gate to source as a static protection device so when you remove the Stamp, the FET gate is not floating and easily zapped.
The resistor used in series with the base is typically from a few hundred ohms to a few 10s of K ohms. You need to know the DC beta (HFE) gain of the transistor and the required load current. High collector load currents and low gain transistors will require lower value resistors in order get enough base current to saturate (turn the transistor on hard which means the collector is pulled close to the emitter voltage). Hint: Ohms law applies.
Pulse width modulation (PWM), mentioned by "willthiswork", still requires a resistor in the base in order to limit the peak current. Think of PWM as a person trying to dim a light bulb by rapidly flipping the light switch on and off. When it is on, the full current flows (including possible overload current), and when it is off there is no current. On the aveage, the current and voltage is lower depending on the ratio of ON time to OFF time, but you can still have peaks that exceed component ratings. L and/or C filter elements are used as energy storage devices to remove the ripple created so that the light dosn't flicker or the power supply does not hum.
The filter works like the flywheel on a 1 cylinder engine.
Don't forget the protect diode across an relay coils or solonoid coils or you will lose the transistor!
Hope this helps.
Horace - N1HC
Check this application note that I put together... Even though it references a motor in the schematic, a Relay, Light bulb, etc. could just as easily be substituted.
Hope this helps: Don't get HOT choosing the wrong transistor
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 9/1/2006 5:27:09 AM GMT
Thanks again,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······ Joe Fishback
-Robots are my friends-