They are a very effective protection against over voltage and reverse polarity. Let's look at how diodes can be used as input protection.
In the last article, we looked at flyback diodes and how they can be used to protect circuits with inductive loads. Today, we will look at another kind of protection diodes: input protection diodes.
Imagine you want to use your Arduino Uno to build a voltmeter. You can easily do this by using one of its analog input. However, it would be horrible if a too high voltage or an accidental reverse voltage would destroy the whole Arduino. Input protection diodes can protect against this. Let's see how.
The circuit looks more complex than it is. In essence the connection to the analog pin A0
and GND
is routed through the protection circuit on the breadboard. The current is limited by a 10 kΩ resistor. Two diodes, one connected to the 5V
supply rail and one connected to GND
, provide the protection. Because of them, the circuit is safe even if one measures the voltage of a 9 V battery or accidentally swaps the leads.
Want to try it for yourself? You can use the code below.
How does the circuit work? Let's have a look at two different cases and how the diodes protect in them:
A0
to around 5.2 V.
A0
to around - 0.2 V.
Note, that the values above are for schottky diodes, for standard silicon diodes they are higher. The resistor plays a vital part in limiting the overall current. If its value is too small the diodes could overheat while they conduct.
So we now know how the protection circuit works, but what about the measurement results? Well, we can't expect the Arduino to measure voltages outside its measurement range. The measurement value will clip at 5 V in case of overvoltage and at 0 V in case of reverse polarity.
Diodes as input protection are very common. They are actually so common that they are integrated in most recent ICs. They help to protect them against electrostatic discharge (ESD), that otherwise could easily destroy a chip if you touch it. The ATmega328P used on the Arduino Uno has them as well (see datasheet). However, be careful the integrated protection diodes are much smaller than the external ones we used here. They only support a limited amount of current. In case of the Arduino Uno they can handle only 1 mA. You can typically find this value listed as 'injection current' in an ICs' datasheet.