﻿ Voltage divider: calculator and application – Renzo Mischianti

# Voltage divider: calculator and application

• 21
•
•
• 4
• 9
•
•
•
•
•
•

In electronics, a voltage divider (also known as a potential divider) is a passive linear circuit that produces an output voltage (Vout) that is a fraction of its input voltage (Vin).
Voltage division is the result of distributing the input voltage among the components of the divider.
A simple example of a voltage divider is two resistors connected in series, with the input voltage applied across the resistor pair and the output voltage emerging from the connection between them. (wikipedia)

Votage Divider Formula: Vout = Vin*R2/(R1+R2)

• Vin: source voltage in volts (V),
• R1: resistance of the 1st resistor in Ohms (Ω).
• R2: resistance of the 2nd resistor in Ohms (Ω).
• Vout: output voltage in volts (V),

### Simple calculator

Volts (V)
Volts (V)

#### Resistor size

Natually voltage divider will draw current (since the two resistors are in series with the supply voltage).

Choosing resistor values is not as simple as getting any two resistors with the right ratio: you could get a 5 V signal by using two 1 Ω resistors as a voltage divider with a 10 V supply, but then of course your voltage divider itself would be drawing I = U / R = 10 V / 2 Ω = 5 A and the resistors would have to dissipate P = I × U = 5 A × 10 V = 50 W total (25 W each).

On the other hand you could take two 1 MΩ resistors in this same setup and draw virtually no current at all, but then the 5 V would be incredibly sensitive to any load and even the generally high impedance of a microcontroller’s analog input would drop the voltage.

Alternatively, to get a stable output voltage while putting a minimal load on the supply, you can buffer the voltage divider’s output with an opamp.

### Application: check 18650 (3.7V) charge level

One of the most common application is to check a charge level on esp8266.
Battery can have 4.2v on full charge and when arrive to 3.3v It can be considered discharged, if you use It with esp8266 you can’t connect directly because esp analog pin have 3.3v as max input supported, and you can’t apply 4.2v.

So you must apply a voltage divider to check voltage.

I use a R1=10kohom and R2=20kohom, so when the battery have full charge (4.2v) to analog input arrive about 2.8v (check on calculator).

Remember to share Ground to have a good sample.

In my current work in progress project a centraline to check the status of solar panel Inverter (an ABB Power-One)

I need to put a battery to power the microcontroller when sun is not present, here the code that I use.

```// Battery voltage resistance
#define BAT_RES_VALUE_GND 20.0
#define BAT_RES_VALUE_VCC 10.0

[...]

float getBatteryVoltage(){
//************ Measuring Battery Voltage ***********
float sample1 = 0;
for (int i = 0; i &amp;amp;amp;lt; 100; i++) {
sample1 = sample1 + analogRead(A0); //read the voltage from the divider circuit
delay(2);
}
sample1 = sample1 / 100;
// REFERENCE_VCC is reference voltage of microcontroller 3.3v for esp8266 5v Arduino
// BAT_RES_VALUE_VCC is the kohom value of R1 resistor
// BAT_RES_VALUE_GND is the kohom value of R2 resistor
// 1023 is the max digital value of analog read (1024 == Reference voltage)
float batVolt = (sample1 * REFERENCE_VCC  * (BAT_RES_VALUE_VCC + BAT_RES_VALUE_GND) / BAT_RES_VALUE_GND) / 1023;
return batVolt;
}

```

So I can check the status of the battery.

### Application: bluetooth RX pin

Another common application is to add a divider to RX pin of bluetooth HC-05, HC-06 or SPP-C that works at 3.3v even if have a voltage regulator to VCC in.

## Thanks

I write this articles because I never remember how to calculate the resistor.

• 21
•
•
• 4
• 9
•

### 3 Responses

1. 15 October 2019

[…] (Arduino), but the first want a 3.3v, so to connecto to an Arduino you must use a Voltage divider (Voltage divider: calculator and application) to prevent damage to the […]

2. 22 October 2019

[…] Arduino working voltage is 5v, so we need to add a voltage divider on RX pin M0 and M1 of LoRa module to prevent damage, you can get more information here Voltage divider: calculator and application. […]

3. 10 November 2019

[…] Arduino working voltage is 5v, so we need to add a voltage divider on RX pin M0 and M1 of LoRa module to prevent damage, you can get more information here Voltage divider: calculator and application. […]