I let people know on the Adafruit Discord that I was working on this guide and asked for questions. here are some of them.
How do I pick a transistor for the job?
The first thing to consider is the amount of current being controlled. If it's no more than a couple dozen mA (e.g. for a simple LED) then something like a 2N2222/2N3904 will be fine. For a higher current load like a LED strip or a solenoid, a Darlington pair like a TIP120 is a better choice. For high current control, consider using a FET to minimize the waste and heat.
How do I choose a bias resistor(s)?
Assuming you want to use the transistor as a switch, then you want the bias resistor to ensure that the transistor is saturated when the input is high.
For an example, the load you are controlling requires 200mA; that's the collector current Ic. Further let's use a typical transistor (such as a PN2222) that has a gain of ~100 at that collector current. Looking at the datasheet we see that the Base-Emitter Saturation Voltage (on page 2) is 0.6v. That will cause the transistor to saturate. If we control this with a 3.3v microcontroller then the bias resistor needs to have 3.3v - 0.6v = 2.7v across it. With an Ic of 200mA and a gain of 100, we have a base current Ib of Ic/gain = 200mA/100 = 2mA. This is within the range of a typical GPIO pin's current rating*. We will need a resistor of 2.7v/2mA = 2.7/0.002 = 1350 ohms. 1.2K ohms is a common value, and using a slightly lower bias resistor than the calculation indicates will result in a slightly higher base-emitter current and guarantee that the transistor is saturated when the input is high.
If you're not sure, or you don't want to do the math, a 1K resistor is a great place to start. Reduce it if you need more current. Increase the resistor ohms if you want less current.
How do I figure out how much heat will be generated?
Heat generated by a transistor is measured in watts (W) and is computed by multiplying the saturation voltage of the transistor (across the collector/emitter pins) by the collector-emitter current. The TIP120 used in the earlier example has a saturation voltage 2v when the current is 3A (and 4v when it's 5A). This information will be on the transistor's datasheet. So if we run 3A through it it will have a voltage drop of 2v. That's 6W of power being dissipated as heat.
In general, a TIP120 can disappate about 2W without a heatsink but it will get hot - so pick up a heat sink!
How do I figure out what heat sink I'll need (if any)?
Let's consider the TIP120 again. It's maximum working case temperature is 150C. Aiming to keep the temperature below 100C is a reasonable goal. That's well below the limit.
To choose a heatsink we also need to know the ambient temperature where the transistor will be operating. 50C is a reasonable guess if the circuit is enclosed with a moderate amount of circuitry. If it's lower there isn't a problem (it's easier to get rid of excess heat). The difference between the transistor case temperature we are aiming for and the ambient is 50C. Again, reusing the above examples, the transistor dissipates 6W. To choose a heatsink, we divide the temperature difference by the dissipated power: 50C/6W = 8.3 C/W. This number is called thermal resistance. A heatsink needs to be selected that has a thermal resistance of about 8.3 C/W.
Since we chose 100C target which is well below the worst case, we can play around a bit with the exact thermal resistance of the heatsink to work with size and supply. This will also give us more options.
For example, we can find a TO220 specific heatsink at Digikey with a thermal resistance of 9.0, yet is still rated for 6W at 50C:
* For example, a GPIO pin on the SAMD21 can provide up to 7mA.
These simple clip on heat-sinks will let you handle a few extra Watts, and are easy to use
Text editor powered by tinymce.