The "oh crap" moment that results the instant you've realized that you've reversed the power connections to a board you're working on and let out all the magic smoke is never a good time!
There are a number of techniques to protect against these moments. Probably the most common technique is a forward-biased diode in series with the power connection. If the polarity is reversed, the diode blocks the current flow and no damage is done. The cost of doing this is the voltage drop of the diode which some applications won't tolerate.
If the voltage drop can be tolerated, an even better approach is to put a bridge rectifier in series with the power connection. The AC leads go to the power connector, the positive and negative leads to the appropriate connections to the circuit. The circuit will work no matter which way the power is connected, but the cost is 2x diode voltage drops.
A less common approach uses an in-line fuse in the power connection, followed by a reverse-biased diode across the power rails. If power is connected with the correct polarity, there's no impact on circuit operation (and no voltage drop); If polarity is reversed, the diode conducts and the fuse blows. The downside is of course replacing a blown fuse if a mistake is made.
I came across the circuits below, using a p-channel mosfet, a few years ago in a music group. Guitar-effects pedals tend to use a coaxial power connecter with a negative center terminal. Most wall-warts are center positive, so if the wrong power supply is used, the magic smoke is let out. These pedals are also intolerant of low supply voltage, so a series diode won't solve the problem. The technique uses a p-channel mosfet in a backwards configuration. When power of the correct polarity is applied, the mosfet body diode conducts from drain to source, which causes the mosfet to turn on. Instead of the diode voltage drop, the voltage drop is insignificant due to the low on resistance of the mosfet.
Two versions of the circuit are shown below. The circuit on the right is great for 5-volt powered circuits; all that's needed is the p-channel mosfet. I have been adding this to most of my micro boards as the cost is insignificant and the space required is tiny. For higher voltage circuits, a zener diode and resistor are added to protect the gate from overvoltage.
This technique is more widely known than when I first saw it, but people may not know of it. Simple, cheap and effective.
There are a number of techniques to protect against these moments. Probably the most common technique is a forward-biased diode in series with the power connection. If the polarity is reversed, the diode blocks the current flow and no damage is done. The cost of doing this is the voltage drop of the diode which some applications won't tolerate.
If the voltage drop can be tolerated, an even better approach is to put a bridge rectifier in series with the power connection. The AC leads go to the power connector, the positive and negative leads to the appropriate connections to the circuit. The circuit will work no matter which way the power is connected, but the cost is 2x diode voltage drops.
A less common approach uses an in-line fuse in the power connection, followed by a reverse-biased diode across the power rails. If power is connected with the correct polarity, there's no impact on circuit operation (and no voltage drop); If polarity is reversed, the diode conducts and the fuse blows. The downside is of course replacing a blown fuse if a mistake is made.
I came across the circuits below, using a p-channel mosfet, a few years ago in a music group. Guitar-effects pedals tend to use a coaxial power connecter with a negative center terminal. Most wall-warts are center positive, so if the wrong power supply is used, the magic smoke is let out. These pedals are also intolerant of low supply voltage, so a series diode won't solve the problem. The technique uses a p-channel mosfet in a backwards configuration. When power of the correct polarity is applied, the mosfet body diode conducts from drain to source, which causes the mosfet to turn on. Instead of the diode voltage drop, the voltage drop is insignificant due to the low on resistance of the mosfet.
Two versions of the circuit are shown below. The circuit on the right is great for 5-volt powered circuits; all that's needed is the p-channel mosfet. I have been adding this to most of my micro boards as the cost is insignificant and the space required is tiny. For higher voltage circuits, a zener diode and resistor are added to protect the gate from overvoltage.
This technique is more widely known than when I first saw it, but people may not know of it. Simple, cheap and effective.