# Circuit for measuring voltage with ADC when it exceeds microcontroller limit (3.3V)

I have connected ADC to the microcontroller.

The maximum ADC voltage range of microcontroller is 3.3V.

• i want to measuring ADC input voltage in between 0V AND 3.3V

• So when ADC voltage is greater than 3.3V should it be grounded or blocked?

• Can anyone suggest a circuit?
• A circuit is needed here to clarify the question. I read this as the ADC is connected DIGITALLY to the processor; if so, then excessive voltage into the ADC will not damage the processor, but may damage the ADC. A shunt clamp (such as a TL431) on the ADC input should fix this. The same applies if it is the processor inbuilt ADC which is the subject of the question. – henros Feb 11 at 11:22
• Generally the datasheet specifies how much Vadc is allowed to differ from Vdd. You will get problems if the Vadc gets higher than Vdd. – Lundin Feb 11 at 12:30
• Why not just throw a 3.4V Zener diode on the pin? You wouldn't "ground" the voltage if it passed 3.3V, just clamp it to 3.3ishV. – Stiddily Feb 11 at 12:40
• @Stiddily Maybe because "roughly 3.4V" isn't a great voltage reference. Looking at standard zener, they don't have much in the way of voltage accuracy, and there's temperature coefficients. – Lundin Feb 11 at 12:58
• @Stiddily Same problem if it is just an ADC input. The solution posted with 2 BAV99 + current limiting resistor is enough for the sake of protecting the port. A zener on 3.4V might go active at ~3.2V or so and then it affects valid ADC reads. – Lundin Feb 11 at 13:27

The STM32F0 microcontrollers have the maximum value (4096 or 1024) in the ADC when the input voltage is 3.3V, but some pins support 5V as a protection medium. The ideal is to have an input circuit that reduces the voltage, following the example of a circuit for inputs from 0V up to 5V. Note that ADC_0 is the pin of the microcontroller.

• Is ADC_0 the ADC supply or an ADC channel? This looks like the latter, but I believe the OP is speaking of the former. – Lundin Feb 11 at 12:34
• At any rate, you probably don't want to slaughter your ADC resolution like this, by adding that voltage divider. With standard 1% resistors, you won't get anywhere near 1024 bit resolution. – Lundin Feb 11 at 12:36
• ADC_0 refers to analog input. I have always used this circuit because I do not need much precision in the circuit. But could you tell me a better way to do this without losing resolution? – Eduardo Cardoso Feb 11 at 12:41
• For high resolution you would use a voltage reference IC for the ADC Vref, which is essentially a LDO with high precision. And then use high resolution resistors 0.1% or so, depending on the requirements. – Lundin Feb 11 at 12:49
• This can be okay for monitoring a line power source, but is problematic for a battery one, which is often what people try to track with an MCU. That voltage divider with an impedance of only 14.7K will draw a fair amount of current from the battery if the device is supposed to sleep when not in active use - 224 uA is a lot compared to typical MCU deep sleep power. Just your metering thing would drain a set of AA's in about a year, even if the product itself never does any useful work. – Chris Stratton Feb 11 at 16:26