3

I was doing some Ohm's Law calculations to calculate the voltage output from a 2-resistor voltage divider, the input will be with a maximum of 12 volts, I want the ATMega328 to measure that voltage, so I simply thought of putting two resistors in series with values of 330 ohms and 220 ohms like this:

schematic

simulate this circuit – Schematic created using CircuitLab

Theoretically on paper the maximum voltage outputting from the node going to the ATMega328 is ~4.8V, but I want a special safety feature, I want to put in mind that at anytime the ground connection can be hung open (to simulate a lose breadboard connection, bad soldering joint etc...) now based upon my understanding if there is no ground connection, the voltage going to the Arduino will be 12V which is a killer, as after looking on the ATMMega328 datasheet it states that

28.1 Absolute Maximum Ratings. Voltage on any pin except RESET with respect to ground => VCC + 0.5

The current will be limited by the 330ohm resistor to only 36mA which I think is a lot, I thought of doubling the resistors values to 330000 and 220000 by that the current will be limited to only 36uA. Again based upon my understanding there is still 12V going to the Arduino but wouldn't it directly drop if the ground connection was cut off ? That's why I ask what is the maximum input power to an Arduino?

2

This is actually a special case that is undocumented, and in fact not as simple as you would at first think.

The input port itself is not actually what is in question here. Instead every IO pin on the Arduino, be it set to INPUT or OUTPUT, has a set of ESD protection diodes on them. These look like this:

schematic

simulate this circuit – Schematic created using CircuitLab

The "IO MODULE" when in INPUT mode can pretty much be ignored, since it is a very high impedance. Just like a (roughly) 10MΩ resistor to ground. Very very little current will flow that way.

D2 is also reverse biased so that direction can be ignored.

So the current will want to flow through D1 to the VCC rail (+5V). The diodes have approximately a 600mV forward voltage (which is where the VCC + 0.5 comes from).

So we can recalculate, given those parameters, what the current flowing through the diode will be to the 5V rail:

  • Voltage difference = 12V - 5V - 0.5V = 6.5V
  • Current = V/R = 6.5/330 = 19.7mA

The recommended maximum (from what I can gather) is only 1mA. You have 20x that.

So you will need at least 20x higher resistances. 10kΩ in the upper half and 6.8kΩ in the bottom half. That will give you 4.85V on the output at 12V and limit you to 0.65mA in a failure situation.

It also gives you an output impedance of a little over 4kΩ which is below the recommended maximum of 10kΩ for the ADC input.

You can further protect your input by adding a 5V zener diode and small series resistor on the ADC pin so if the voltage goes above 5V it clamps it and protects the pin.

schematic

simulate this circuit

4
  • The current will want to flow through D1 to the 5V rail? What? The voltage to be sampled needs to be between 0 and VCC (5V). If it's lower than 5V, won't D1 be reverse-biased and the potential will be applied to the ADC (which is a capacitor, if I remember correctly)
    – Duncan C
    Jun 23 '20 at 17:38
  • I thought that as long as you stayed within your voltage limits, the ADC was a capacitive input?
    – Duncan C
    Jun 23 '20 at 17:39
  • Oh, I see. I read the OPs question more carefully. He's looking to avoid destroying the input if the ground side of his voltage divider is left open and he pumps 12V into the pin. Yeah, wouldn't a 5V zener diode we the way to go?
    – Duncan C
    Jun 23 '20 at 17:42
  • @DuncanC Belt and braces. Keep the current < 1mA and add the zener. If one fails the other protects.
    – Majenko
    Jun 23 '20 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.