Sunday, 30 September 2012

How do you use NPN Transistors

After doing a post on how to use Field Effect Transistors I suppose I should really do a post on Bipolar transistors (BJTs) and how they are used.  I'm keeping things very simple....I have seen a fair few of these tutorials in my time and I thought I would add my efforts to the mix.  This post concentrates on NPN transistors.  I'll talk about PNP transistors in the next post.

So what are Base Junction Transistors?  These are the original and best semi-conductors ever (in my opinion).  They were invented in 1947 by a team at Bell Labs....Here is the wikipedia entry -

http://en.wikipedia.org/wiki/Transistor#History

So BJTs are three terminal devices made up of three pieces of semi-conductor material - a type of silicon with less electrons and therefore more positive (P-Type) and a type of silicon with more electrons (N-type).  There are two main groups of transistor - NPN and PNP.  NPN transistors are made up of a layer N-type material and then a layer of P-type material and then another layer of N-type material.  PNP transistors are the same only in reverse.

Check out the diagrams:


So.....what are transistors used for? Well they can be used for two things - amplifying current or as a semi-conductor switch.  They are used in literally thousands of electronic circuits.....They can be used for controlling devices, amplifying signals or turning on other parts of circuits...

So how does a transistor work?  I'm keeping this simple if people require more detail and the physics then check out the awesome sites below:

http://www.allaboutcircuits.com/vol_3/chpt_4/index.html

http://hyperphysics.phy-astr.gsu.edu/hbase/hframe.html

For NPN transistors greater than 0.7V is applied to the base terminal.  This allows current to flow from the collector to the emitter.  Check out the diagrams below:

When there is less than 0.7V applied to the base no current can flow between the collector and the emitter.

So...why does this matter?  Well when 0.7V is applied to the base of the NPN not only does it allow current flow (switching action) it also allows more current to flow (amplification).  Lets try and give an example, check out the circuit diagrams below:
NPN transistor circuit with Voltages 

NPN Transistor circuit with Currents
So we can see from the diagrams that the voltage applied to the base controls the amount of current that can flow from the collector to the emitter.  The two resistors on the left of the diagram are connected as a voltage divider to the base terminal.  This is to ensure that there was a voltage at the base of the transistor greater than 0.7V.  This is known as 'biasing' the transistor on. It means that the transistor will always be conducting between the collector and emitter.  The resistors at the collector and emitter were selected to control the amount of current 'gain' the circuit will have.  If we change those resistors we can vary the amount of gain or amplification that the circuit will have.

The current in the base terminal of a transistor is known as Ib or I base (I being the symbol for DC current and b for base).  The current in the collector of a transistor is known as Ic (DC current at the collector).  The amount of 'gain' the transistor has is based on it's internal resistance.  When the base is provided with 0.7V the resistance from the first semi-conductor junction is transferred to the other junction.  This is why transistors are sometimes known as transfer-resistors and then the name was shortened to transistor.  Anyway so we can see in the above circuit that when there is 8.438 * 10^-6A or 8.438 micro-amps on the base there is 2.554 * 10^-3A or 2.554mA flowing through transistor from the collector to the emitter.  

2.554*10^-3 A / 8.438*10^-6 A = 302.67

So that's an increase in current of 303.  This figure is known as the DC current gain or Hfe.  These are the terms used by manufacturers of transistor to explain to design engineers how a transistor will perform when connected in a circuit.  The physicists and mathematicians out among us will notice that there are no units for Hfe, that is because Amps divided by Amps cancels the units to be dimensionally correct.

If we look at the datasheet for the BC548 transistor we will see what the manufacturer (fairchild) states for the Hfe:


The datasheet shows a range for Hfe for the BC548 transistor.  That is because the amount of current gain will vary between versions and batches or transistors.  Not all batches manufactured will be the same and therefore the amount of gain will differ slightly but the transistors are tested when they are first made and will all be roughly within this range.  The datasheet reads for a BC548B transistor the Hfe will typically be between 200 and 450.  We calculated 303 - within specification then!

So what other parameters do we need to look at on the datasheet to use a transistor?  The list below is by no means complete but its enough to get started:

VCEO - Collector Emitter Voltage - Maximum Voltage you can place at the collector
VCBO - Base Collector Voltage - Maximum Voltage you can place at the base
VBEO - Emitter Base Voltage - Maximum Voltage you can place at the emitter

Ic - Collector Current - Maximum current you can cause to flow through the transistor from the supply

Pc - Power dissipation - Amount of power the transistor will dissipate when fully on

There are other figures and graphs on the datasheet which all provide information on how the transistor will behave when in use.  The stuff I'm normally interested in is VCEO as it tells me what supply voltage I can use; The VCBO is useful as it tells me how much signal I can apply to the base without damaging the transistor and Hfe because it tells me how much gain I can expect if I turn the transistor fully on.  The maximum temperature specification is also important.  

So how do you use an NPN transistor as a switch?

To use a transistor as a switch we need to first know what we are switching on and off.  For this example I'm going to show how to control when an LED turns on and off.  First of all we need to select a transistor - lets go with the BC548B as seen earlier.  It saves me having to provide another link!  Lets choose a supply voltage - 12V.  Lets then choose how bright we want the LED to be - select the LED current limiting resistor, for this example I've used a 1k resistor.  Then all we have to do is create the circuit - check out the diagrams below:

Left - NPN transistor OFF Right NPN Transistor ON

The supply attached to the to the base terminal is the symbol I use for a signal (variable) DC voltage source.  Every other symbol is standard.  

Basically, if you apply a positive voltage to the collector and the item to be switched and connect the 0V to the emitter and a voltage greater than 0.7V to the base the transistor will switch on.  I used 2.5V in the example above.  Here is a video showing the base voltage controlling whether the transistor is conducting (ON) or not conducting (OFF).  




So how do you use an NPN transistor as an Amplifier ?

Using the transistor as an amplifier is more complicated...a lot more complicated.  It all depends on what kind of amplifier is required.  There are many different types of amplifier and it's a subject for another post.  I am going to show a simple amplifier circuit - its called a class A amplifier and its used for amplifying a changing signal like an audio signal or an analogue sensor signal.  Lets set some parameters: Say we have an audio signal coming from a microphone that's at 0.5V.  In order to measure that signal or make it audible we are going to need to amplify it.  So lets set the gain of the amplifier to 6.  That means that the signal we expect to receive at the output of the amplifier is going to be around 3V (the input signal will be increased 6 times).  Lets set the load connected to the output to be 300 ohms. For this example lets use the BC548B again.  The circuit is shown below:
Class A Amplifier circuit using a BC548B with a gain of 6
Lets quickly explain the circuit.  R1 and R2 set the base of the transistor to On by setting the DC voltage applied to the base terminal to 1.6V, This can be verified using Ohms law and the voltage divider rule.  R3 and R4 set the gain of the amplifier.  The capacitors C1 and C3 are DC blocking capacitors which are present to stop the DC signal interfering with our AC input signal.  C2 is an emitter follower capacitor.  Its job is to improve the amplifier output (really a topic for another post!). V1 is the supply voltage and V2 is the simulated voltage signal from our microphone set at 0.5V.

Lets check out the simulation!


Well that's all for now folks.  I will upload some videos showing the actual circuits on a breadboard working in real life - Take care and have fun!