When tackling with the very common need of toggling a current with an output from a microcontroller or similar chip, solutions have varied over time.
The oldest solution is to just use a BJT. This works reasonably well, but one has to verify that the gain is suitable for the use and requires the microcontroller to constantly drive the transistor when switched "on". The current may be neglible, or it may not.
The next solution is to use a MOSFET. Modern MOSFETs seem to switch nicely even with 3.3V voltages and have very low on resistances. Gain is no longer an issue, and no need to constantly drive the MOSFET but the microcontroller still has to drive the MOSFET when it is switching. These currents are sometimes pretty high, so the MOSFET needs to be selected carefully.
Then there are Analog Switches (bilateral switch) which require separate voltage inputs but which seem to offer even nicer characteristics: very fast switching speed, very low power usage, very low drive currents, very low on resistance, etc. And obviously having a SPDT switch is nice in some situations.
So, I am asking, what is the modern world ideal component for these sort of situations? Is analog switch the holy grail, or is there something even more suitable? Or are MOSFETs actually better if you just pick the right one?
The usage situations I am thinking of are just switching low voltage low current lines with no special requirements - the sort of solutions that would've gotten a 2N2222 transistor years back.
The wishes I would have for an ideal component:
- Supply voltage either 3.3V or 5V
- Input voltage suitable for LVTTL, TTL, CMOS inputs
- Low on-resistance (<1 ohm?)
- Fast switching times (<100 ns?)
- Bidirectional current flow (although usually not really necessary)
- Safe for the microcontroller (no back-current?)
- No need for high current operation, 100-200mA is probably fine.
- No need for high isolation, although it would be nice if the switched voltage could be 12V
- Cheap-ish, let's say sub-$1
- Small SMT package
In general, something that could be used to replace 2N2222 or say BSS138 in most simple situations.
To quote wikipedia on 2N7000 MOSFET:
The 2N7000 is a widely available and popular part, often recommended as useful and common components to have around for hobbyist use
The 2N7000 has been referred to as a "FETlington" and as an "absolutely ideal hacker part."
I guess what I am looking the analog switch equivalent of this, if such a thing still holds any benefit over just using something like that.