Electronic – How to choose a switch

mosfetswitchestransistors

There seem to be about 4 major flavors of transistors, and then there are NPN/PNP versions. There are also relays, SCRs, and TRIACs.

When I need an microcontroller-controlled switch, what rules of thumb should guide me in choosing? Are there a few common ones that people like to keep around for use when there are no particular high-performance specs?

I'd like to learn the general rules so I don't end up googling 37 variants of the same question.

For a concrete example, the application I am choosing for right now involves driving a 5 V, 160 mA (80 mA average at 50% duty cycle), 3.1 kHz buzzer with an output from a 3.3V MCU that can sink 8 mA or source 4 mA.

Best Answer

Bipolar transistors and FETs work about the same on the output side when you are using them as switches in low power applications like you mentioned. Both come in two flavors to make either high side or low side switches. The NPN bipolar and N channel FET are the low side switches, and the PNP bipolar and P channel FET are the high side switches.

The difference between bipolar and FET is mostly how they are turned on and off. Bipolars are turned on by running some current thru the base. This allows a much greater current to flow thru the collector. The ratio of the possible collector current to base current is the gain of the transistor. FETs are controlled by voltage instead of current. A basic N channel MOSFET might require 12-15 volts on the gate to be fully on, with 0V fully off. There are things called "logic level" FETs that can switch between on and off well enough to be driven directly by 3.3V or 5V logic outputs.

I'm going to disagree with Starblue and say that for very simple switching applications for hobby use, get a handful of good logic level FETs like the IRLML2502. They will cost of 10s of cents each, but are very fogiving as long as everything is limited to 20V. I would certainly not start with that for a volume design done by a professional, but if you just want to get started with one answer that serves the most needs, this is a good first part to get used to.

Once you're ready to experiment with bipolars get 100 each of 2N4401 and 2N4403. They are dirt cheap, widely available, and all around pretty robust for their size. They would also be fine for switching 200mA loads, but you need to know a little more to use them well. You can't just connect them directly to a microcontroller ouput in a switching application.