Simple Transistor Guide
Using transistors can be very frustrating if you don't know what you're doing. These are some basic steps I go through when I want to find one that will do the job and then wire it up. Hopefully this should be just enough information for you to switch things on and off.
There are many different configurations but I find these cover most things I want to do. The kinds of thing I use transistors for are PWM controlling LED lighting (dimmer switch) and activating relays to connect mains-powered devices.
All the information here relates to BJT transistors as they are the most common, the cheapest, and I have not yet found a use for types other than these.
NPN or PNP?
You'll have to choose one or the other. It depends on the signal that you will use to control it.
With NPN, when the signal at the base goes high the transistor turns on. I find this scenario fits in my brain the easiest when using a microcontroller to drive a higher load. Output 0/LOW and the transistor is off, Output 1/HIGH and the transistor in on.
With PNP, when the signal at the base goes low the transistor turns on. This is because to activate the transistor you drain the base to ground. If you have a signal that goes low when you want the transistor to activate then use this.
These are very simplistic schematics but generally work. NPN is my preferred choice.
With NPN connect the load that requires the power to the supply voltage (VCC) and the transistor emitter (E) connected to ground (GND).
With PNP the transistor emitter (E) is connected to the supply voltage (VCC) and the load is connected to ground (GND).
Choosing a part
The first place I look is on a site that has a good set of filters for the characteristics -- sites like Digikey or Mouser. You can also find a list of commonly used parts on Octopart. These are the main things I filter by:
- Type -- NPN or PNP as detailed above
- Power (Max) -- Multiply the voltage and current of your load - it must handle a higher wattage than this
- Current - Collector (Ic) (Max) -- The collector needs to handle more amps than your load requires
- Mounting/package type -- How do you want to mount it (SMD, through-hole, etc) or maybe you expect it to be in a certain case.
- Quantity -- You'll probably want to only see items that you can order 1 of at a time rather that 1000s.
After this I'll sort with the cheapest at the top and look through a few of the datasheets to check a few more specific ratings and characteristics.
These are the most important characteristics I look at when chosing a transistor.
Ptot total power dissipation -- If you have this value in the data sheet it will give you a general sense of whether it can handle the power requirements of your load without heating up too much and burning out. Sometimes the manufacturer will state different values for if you use different types of heatsink. In the case of surface-mount devices they will often show increased power dissipation for if you solder it to larger areas of copper on your PCB instead of the standard footprint.
VCEO Collector-Emitter Voltage --
IC Collector Current --
hFE DC current gain -- The amount that voltage at the base is multiplied by. This value varies depending on what voltage will be going from Collector to Emitter (VCE) and the current that will go through it (IC), measured at the collector. There will be graphs in the datasheet to show what happens at a wider set of scenarios than the table. For digital electronics (including PWM switching) the value doesn't matter very much as long as it's enough.
VBE base-emitter voltage -- The voltage required to turn it on.
Normally delivery is expensive through the big electronic component sites so when I have selected a few candidates I'll then search for them on eBay or AliExpress to order a small quanitity for prototyping.
Example parts I've used