In this post we calculate the resistor values for a voltage divider network used with an Arduino.
Contents
Background
A voltage divider reduces the input voltage to a smaller value. In this case we want to use it to reduce the voltage to a level that can be safely measured by an Arduino.
A voltage level can be measured by inputting it to any one of the Analog Input Pins.
How many Analog Input Pins does an Arduino have?
An Arduino has 6 Analog input pins labeled A0, A1, A2, A3, A4, A5.
The Analog Input pins shown in the picture can support a maximum value equal to the supply voltage. In most cases this value is +5V although in some cases it is +3.3V.
Exceeding this voltage level on the A0-A5 Analog Input lines can result in damage to the Arduino.
A voltage divider is used to convert a large voltage level to a smaller one such that it doesn’t damage the inputs. It consists of a network of two resistors as shown in the picture below.
Voltage Divider Calculator
Enter the following values into the calculator
- Vin – this is the input voltage that can be any value
- Vout – this is the input voltage to the Arduino (Vout < Vin)
- Either R1 or R2 and the calculator will calculate the other
Example Calculation
Convert a maximum value of +20V down to +5V.
A resistor value R2 = 1 kΩ gives R1 = 3 kΩ.
What Resistor Values to use at the Input to the ADC?
The ADC in the Atmega Chips used in the Arduino is optimized for analog signals with an output impedance of approximately 10 kΩ or less. In this case the values of R2 = 1 kΩ gives R1 = 3 kΩ give an effective impedance of 750 Ω which satisfies the above condition. (Use the parallel resistor calculator to find this).
Related Calculators
- The Arduino has a 10-bit ADC. Use this calculator to find the digital output for any analog input level.
- This calculator can be used to find the smallest voltage level (resolution) of the 10-bit ADC in the Arduino.
- Calculate the signal-to-noise ratio of the ADC