Published using Google Docs
7/08/2017
Updated automatically every 5 minutes

Checking how analog voltages on digital input pins are read

Tina Zhu 7/8/2017

To make that a future setup would work for some project, this week we wanted to check whether an analog voltage could be interpreted ‘correctly’ by a digital input pin without the microprocessor being damaged or destroyed. This would definitely vary per chip/manufacturer, but we wanted a quick test to see whether peak-to-peak AC voltage, at the voltage interpreted as a digital high, would actually be seen as high. Most MCU spec sheets seem to recommend not giving the input pins less than -0.2V, so we wanted to check whether lower voltages will actually break one. Most GPIO pins have Schottky diodes around them so that negative voltage/too positive voltage would be accounted for.

We picked an Arduino Uno with I think an Atmega128 to test this, because they tend to be more resilient. A digital input on the Uno’s chip has 100MOhms of impedance to keep the Uno safe, in case too much current is drawn, whereas other less resilient chips have ~5MOhms.

Anyway, we loaded a quick sketch to read a test pin, and write out its High or Low state to another pin. In short, it worked and nothing broke. At 24MHz, 2.5Vpeak to peak, for -1.25V to 1.25V, seemed to be sometimes interpreted as a logic high without any issues. I assumed that the Arduino would start smoking when given -1.25V, which would have been bad news for that other future project. Somehow, nothing broke -- we assume that the Uno’s chip’s input impedance kept that reverse current low enough to not fry anything, plus the current went through one of those diodes instead of the rest of the logic circuits.

For some reason this would only work at 24MHz, perhaps the UNO board had some resonance at that frequency? Results seemed pretty iffy at lower voltages than 2.5V AC, it would sometimes work, sometimes not due to a lot of EMI interference, which ranged from 5mV to 100mV. Also, this was a quick test to make sure future development would have no chance of breaking the board, so I think we pretty much covered our bases that AC voltage doesn’t kill the Atmega328 and gets read as high at around 1.25V. Results may not be super scientific (our sampling frequency was well under 24MHz, honestly) but it proves the points we were trying to make. Also, my mentor pointed out that the chip could still have residual damage (to the diodes, etc.) so it would break later / have a shorter lifetime, which is probably true.

At any rate, the Atmel chips that Arduinos use seem pretty resilient, so later on, we’ll probably do future experimentation on them.