# ADC voltage divider calculation issue

I want to measure the input voltage to my circuit. The input voltage is supposed to be anything between 0 to 36 V. The voltage divider is simply a R1 = 100 kΩ on top and R2 = 10 kΩ on the bottom. The ADC reference voltage of the controller is 3.3 V.

According to my calculation,

1. When I’m calculating the RAW value to the input voltage value by using the below formula, the calculated voltage value is not matching with the input voltage. There is tolerance. You can find the voltage values in the report below, highlighted in red.

1. The formula for converting the raw value to the input voltage value is:
2. When I’m calculating the raw value to the voltage divider value, there is no issue. Here the calculated value is matching with the measured value, highlighted in blue.
3. In the microcontroller datasheet, there is a mention of an internal series resistor which is connected internally; please refer the image below. ADC input connected to the ADC. So, the internal resistor of 6.9 kΩ is added.

1. Can you please let me know how I should add this internal resistor to the formula? Or is there any other issue in this circuit or our calculation?
• If the input voltage is 0V, according to your table, can you explain why the voltage after the voltage divider is 0.53V? Commented Aug 8, 2022 at 8:47
• Have you accounted for leakage in the protection diodes shown? Also, have you allowed sufficient acquisition time when sampling? Commented Aug 8, 2022 at 8:49
• That's rather a large voltage with no input. It's suspiciously close to what would be expected from the weak pullup current, which should be disabled on an analog input. Is it possible the input has been damaged in your experimentation? Commented Aug 8, 2022 at 8:53
• The easy solution would be to feed the 100k/10k signal into a voltage follower, and that output into the MCU ADC input. This way you don't have to take account of the various tolerances which significantly influences your ADC value. Commented Aug 8, 2022 at 9:25
• @Unimportant Thanks for the reply. Looks 0.53V during 0V at input causing the issue looks like. I tried removing D4 diode in the circuit, but Still, I'm getting 0.53V. Same circuit I have tried by connecting ADC input to CPU-i.MX6ULL (with D4 DNP). here I'm getting proper 0V when input voltage is 0V. What could be the reason for 0.53V? Commented Aug 8, 2022 at 12:30

I think there is a current feed out of the ADC input. It behaves not pure resistive, more like roughly estimated 51 kohm parallel to a constant current source of around 4.3 µA. This is typical for a chip internal pullup resistor built out of special semiconductor strutures. This pullup resistor must be disabled.

If this has been done already, another reason could be an ESD damage at the internal protection diode.

Edit:
After reading the MCU datasheet, I assume you use the ADC function inside the capacitive touch sensing feature of this MCU. This can indeed measure voltages, but has capacitor charging hardware around it.

Simply don't use it that way. Use the "normal" ADC interface instead.

• I have tried disabling the internal pull-up in the ADC pin. Still, the issue remains the same. Commented Aug 9, 2022 at 5:15
• @Chitharanjan Please specify the MCU you are using for better analysis
– Jens
Commented Aug 9, 2022 at 15:15
• LPC804 micro-controller used Commented Aug 10, 2022 at 11:31