Electrons: Trying to understand transistors
And introducing the 2N3905 - ten from eBay for 99p
So this little metal and plastic tripod is the basic building block of all modern electronics, either appearing on its own, as it does above, or in myriads printed on a modern chip.
They are a switch, I'm told, and though I have replicated circuits with them in before, I've never really been able to understand what they do and how to use them.
Most electronic courses go straight into the how they work, which I’m determined not to do, but I am going to need to start with a couple of diagrams.
So from what I have worked out, transistors have two flavours: NPN and PNP. Their symbols on a circuit are as above. I never realised that the symbol changed based on their flavour. Their flavours are short for "Negative-Positive-Negative" and "Positive-Negative-Positive" and generally I think that determines how you wire them up.
They also have magical names for each of their three connections, ones called Base, one the Collector, and the other the Emitter. Marked B,C and E on the drawing above.
I always thought that the Base was some kind of earth, or ground in the diagram, but I was wrong. Remembering that all the whole transistor is is a switch, I’ve adjusted my mental model of them to the following:
So this is what helped me to visualise how they work: imagining that the base is a push switch. If you apply something to the base, then the switch between the collector and the emitter turns on. This is an over-simplified view - but for this post it's what I’m going to try.
Ben Heck from YouTube explains that NPN transistors are used as below:
He explains the Load (the part of the circuit you want to activate with the switch) is placed between the positive rail and the collector, and when a voltage is applied to the base, current flows through the load to ground, making the load work: the motor spin or the led light...
PNPs are usually used when the load is put between the Collector and the ground rail. That makes sense - but I don’t really know why - and a colleague at work also told me that the only real reason why you would use a PNP over an NPN was the way you wanted to lay out your circuit. I don’t really want to go too deep into theory, so I'll explore that at another time.
Let's wire one of the little beasties up. I’ll start by just connecting the LED to the power rails via a resistor - on the board it looks like this:
You can plug this into the board as you want - but basically the red wire shows the power rail, into which I plug one lead of the resistor. The other lead goes into the same row as the long lead from the LED, and the other LED lead goes to ground - the blue wire - and on comes the LED as above. You’ll see I’ve also put the transistor in there as well - but it's not connected in yet.
So that proves that the LED works and the voltage/resistor combination is approximately correct.
So now I need to interrupt the path to earth with a switch - by wiring in the transistor. You can see its position in the picture below:
The 2N3905 is an NPN transistor, so I've moved the ground rail to the bottom row in the photo, which is also the bottom leg of the transistor (hopefully the Collector - but I’m not absolutely sure - could be the Emitter!) Then the top leg is connected to the lead of the LED that was connected to ground. As expected, the LED does not light - either I’ve messed up the circuit or the transistor is working - restricting current flow through the LED.
So now the final test. Using the white wire below I ground the middle lead of the transistor - this IS the Base - to the negative rail. And on comes the light.
If I remove the white wire, the light goes off - but if I use the wire to connect the Base to the positive rail, it also doesn’t light. So the transistor is successfully turning the light on and off.
This experiment is flawed in several ways - for instance I think I should probably have connected the base via a resistor to lower the current, and I didn’t check which is collector or emitter on the transistor, so the load may be in the wrong place - but it definitely demonstrates a transistor working, and I now understand them a little more.
20-Dec-2014 Add commentblog comments powered by Disqus Permanent Link