Contents

**Introduction**

When a voltage is input to the Analog-to-Digital Converter of the ESP8266 or ESP32, care must be taken that the max voltage spec of the ADC is not exceeded.

This page provides a voltage divider calculator for the ADC. This configuration of resistors reduces the input voltage to a range that doesn’t exceed the ADC spec.

**Calculator**

This tool provides resistor values that reduce the max input voltage to the input voltage range of the ADC.

Enter:

- Input voltage (Vin)
- Desired output voltage Vout (this is the maximum allowed voltage into the ADC)
- Either R1 or R2. Use the drop down menu to select the units

**Example Calculation**

The ESP8266 has a 12-bit SAR ADC with an effective range of 0 Volt to 3100 mV. This means that the max input voltage is 3.1 Volt (although it can be extended to a full scale value of 3.3 V)

If the input analog signal varies between 0V and 5V, using the calculator above, Vin is 5V, Vout is 3.1V. Choose R1 = 10 kohm. R2 is calculated to be 16.3 kohm.

In the case of the ESP chip, any input voltage between 0 V and 3.1 V can be accurately digitized. If a voltage of 5V is applied, the ADC’s output will be clipped at its maximum value (e.g., the output will be all ones for a binary ADC), and information about the actual input voltage will be lost.

???? Convert the analog input to digital output when it’s within the operating range of the ADC.

**Max Source Impedance**

Referring to the documentation for the ESP32 it states the following:

ADC is capacitive and can be considered as a large resistance.

Normally ADC datasheets will usually specify a maximum source impedance. However the Espressif team has not provided a number. We can safely assume that it is 10 kÎ©.

Higher values of input impedance will increase the sampling time and result in errors as the input signal won’t settle to a stable value fast enough. See this post to understand the impact of impedance on settling time.

In this case with **R1 = 10 kÎ©** and **R2 = 16.3 kÎ©**. The effective impedance is ** 6.2 kÎ©** (using this calculator) which is less than

**10 kÎ©**so it should be fine.

**Related Posts and Calculators**

**References**

[1] ESP32 ADC Range