# STM32 ADC read methods for high voltages

I want to read input voltage from a solar array for my circuit. That's not a big deal if the voltage is up to 3.6V. The problem is that I am expecting maximum of 15V and obviously I won't be able to have connection for ADC reading. First solution that came to my mind is creating a voltage divider with buffer op-amp, zener diode and a capacitor filter. This might be an effective way, however, it will make the circuit extra dense and complex, considering I will also read some other voltages on the board. I am open for alternative methods and suggestions. Also, I can also use some IC recommendations, if there is such thing for this purpose. Thanks!

• What’s wrong with a R divider? Commented Mar 19, 2021 at 12:04
• the first thing that comes to mind is a simple resistor divider. Why would you need a buffer op-amp? As for the zener - zeners start conducting some way before their rated voltage, so when used in an analog circuit, it may cause errors as the voltage gets closer to the zener voltage. Clamp diodes to the rails are commonly used. Commented Mar 19, 2021 at 12:04

## 3 Answers

Using a voltage divider will bring noise and extra components for sure. But same conclusions stay for external ADC IC's too. Also, external ADC requires voltage reference which at least equals to voltage that is measured. In a conclusion, voltage divider is better for higher voltage measurements.

• There is nothing wrong with using a voltage divider -- its the simplest means to perform ADC when the pin's VREF/ max range/ absolute maximum rating is exceeded. You just have to take into consideration the maximum voltage that can be read by the ADC and the maximum expected voltage that you need to read in calculating the voltage divider network.
• Using a zener will skew and make your ADC readings not linear
• You might want to look into this post for multiple ADC readings: Connecting multiple signals to ADC

Just use a voltage divider. But what resistor values ?

The ADC samples its input voltage into a tiny internal capacitor, which pulls a bit of current from the source every time a conversion is done. So, you must check the documentation to select the proper resistor values for your divider (also this document contains lots of useful advice). You should also place a small ceramic capacitor (NP0 type) between the ADC input and ground, as a filter.