Diodes & Transistors basics
Autor: fumo | Publicado: 2011-03-08T01:06:00-08:00

Today we are going to cover a bit of diodes and transistors. You can check these videos from Collin Cunningham:
Diodes:&nbsp;http://www.youtube.com/watch?v=AqzYsuTRVRc
LEDs:&nbsp;http://www.youtube.com/watch?v=P3PDLsJQcGI
Transistors:&nbsp;http://www.youtube.com/watch?v=-td7YT-Pums
As Collin says, transistors can be used as amplifiers or switches. In this tutorial we will only cover switches...maybe we cover op-amps in the future, so you can amplify signals more precisely.
This is a nice tutorial about diodes:&nbsp;http://www.sparkfun.com/tutorials/212
I didn't read much about analog electronics (pretty much because I never had to use it at my projects) and that's why this parts of my posts are a bit small.
So you can check Collin's video for history of diodes, leds and transistors if you want to... I'm just going to talk about what you will probably use them for.
I didn't know diodes where so useful... but after reading this sparkfun tutorial I liked them a lot. Pretty much everyone that already built something with electronics has worked with LEDs. But I believe a lot of them didn't use it as a diode... just a light source.
So diodes "block" current flow in one direction and "allow" it on the other direction... so diodes are used a lot in power supplies. A normal diode has a voltage drop value around 0.7v... that means if you connect it in a 9v signal, it will be around 8.3v at the output. I believe the most common use for diodes in power supplies are the rectifiers. Like this one:&nbsp;

So you connect "~" to a AC source and you get a DC source from "+" and "-" terminals... but why that? Look at this picture:&nbsp;

So you see this "A" and "B" labels at the bridge rectifier inputs... so when current is positive the current go trough "B" and follows the red mark to the circuit and gets back to the rectifier following again the red path and going away trough "A". When the current is negative, it goes trough "A" and follows the blue path, and after passing the circuit it gets back to the rectifier going away trough "B" following again the blue path. The diodes won't allow the current go from "A" to "B" or "B" to "A" if it doesn't pass the circuit first. So in your circuit you get a wave like that one near "RL" from the AC wave that was the input of the circuit at the left of the bridge rectifier.&nbsp;
So, that's cool. Again, LEDs can be used in some applications, not all of them. If not well designed, the LED can fry out. LEDs come in all kinds and colors... there are even infrared LEDs (IR LEDs) which is the one you probably have in any TV/Stereo/etc&nbsp;remote controller. (You can see it if you get a camera on it and press any button of it).
LEDs may also be combined in custom displays, like these ones:
So you can see here a RGB LED cube, blue LED bargraph, and RGB LED matrix.

And a RGB LED strip, RGB LED 7 segment display, and a high power LED. (These guys get like 20W or higher, so they have these heat sinks on them)
Look at these videos:
LED globe&nbsp;here.
LED propeller clock&nbsp;here.
So there a lot of applications where you use LEDs. You need to learn about how to get them working when you want to use it at your project. I'll talk about a few of them in the future (I believe).
There are also the zener diodes, which "allow" negative current flow in "one specific voltage". This can be useful if you have a 5v circuit connected to a 3.3v circuit. So you can have a schematic like this:

So instead of a 5v signal, the 3.3v circuit is going to "see" a 3.3v signal. There are all sorts of values for the zener diode... so you can find the right one for your application.
A&nbsp;Schottky diode is useful when you want to protect your circuit and avoid voltage drops. While a common diode has a voltage drop of 0.7V, a schottky diode has a 0.15 - 0.45 voltage drop.
Enough of diodes. So transistors are great too. As I said before, I will not talk about how to use them in an amplifying configuration... just because I don't know how to do it. I never searched for it, and actually never needed to amplify a signal before. But the switch configuration is very useful, and really easy. Take a look at this schematic:


So this schematic is basically turning on a LED using NPN transistor or PNP transistor. These resistors limit the current for the transistors and for the LEDs. The transistors are working as switches... the NPN one will let current pass through the arrow direction if there is enough current at the base, while the PNP will "allow it" when there is no current... and that's why you see the PNP switch is closed and the NPN is open.&nbsp;
These schematics are not very useful, but it's just to show how the transistors will work in a switch configuration. Also there could be anything at the base, like a microcontroller output pin, that would give 0v or 5v signal, so it was possible to turn on and off the LED. And the LED could be a motor or something like that.
Speaking of motors, there is a very popular circuit to handle dc motors... the H-bridge. Look at this:

The way a dc motor works is that if you connect it to positive current it will turn one way, if you connect it to negative current, it will turn the other way... so in order to control it we need to change the two terminals of the motor so we can set the proper orientation. In order to make current flow from left to right of the motor's terminals we need to close "transistor one" and "transistor three" and open the others, so current will come from "POWER +" trough "transistor one" and will pass through the motor and go away trough "transistor three" to "POWER -". If we want it to turn the opposite way, we close "transistor four" and "transistor two" and open the others.
So that's not that difficult to understand... and it's very useful. When choosing the transistor for your project, you need to look at its datasheet.&nbsp;
Datasheet is like a "manual" which contains like all the info about a component. You can find datasheets on the internet and googling the component's name.
For example, if you dealing with motors, you will need some high current transistors, so you need to check the datasheets to find out what is the max current of each of the models available. If you have proteus you can use it to find out info about components. If you go to add a component, and you find the component you want, there is some info on the screen that can be what you searching for. Like in this picture:

So you can see that the values at "Description" can be handy to choose a component for you project, and you don't need to see a lot of datasheets to find a nice one for your application. You can search by the contents of description, so you can search for 5A transistors, it will give you all 5A transistors on the proteus library. You can check if they are available in an online electronic components store like&nbsp;digikey,&nbsp;sparkfun, etc.
Also, it's good to search on sites like&nbsp;sparkfun&nbsp;and see the components available to see the models they sell, so you do not spend so much time search. For example if I need a common NPN transistor for low power applications, I can see sparkfun sells 2 of it, so I can choose any of them, and get my order.
Sparkfun doesn't sell high current transistors... so for this kind of specific analog circuits you probably will need to go to&nbsp;digikey&nbsp;or ebay. It's easy to find things on ebay... you may prefer that than digikey.
So, I believe it's all for this time. You can try checking more about transistors and diodes and anything I talked about already on the web.
Next time I'll talk about an integrated circuit and logic ports.
Cya