voltage divider

Understanding Voltage Divider

Voltage divider means dividing the voltage into smaller value. Sometimes this is very useful if we had only measurement instrument with limited maximum value. Such as pocket oscilloscope.

Dividing voltage is very simple job but very powerful. We just need two resistor to do it. Here’s the example how we do it.

voltage divider
voltage divider

Considering we have 12V voltage, using two resistors will result 6v at the output. This is how we calculate it :

Vout = Vin * R1/(R1+R2)

So if we want to divide the voltage by 3. You can simply change the R2 to 2k. So the output will be :

Vout = 10 * 1k/(1k+2k) = 3,333 V

Voltage Divider Application Example

In some cases, voltage divider is very useful for signal conditioning. For example, you have to sense a voltage from a power supply using an arduino or other microcontroller. The power supply can generate voltage from 0V-50V. Unfortunately, your arduino can sense voltage only from 0V-5V. That’s why voltage divider come in handy. You can just divide voltage from power supply by 10. So the output will only produce voltage between 0V to 5V and you can read using arduino ADC easily.

Beside divide the voltage, you can use voltage divider to convert resistance based sensor to voltage. For example a light dependent resistor (LDR).

voltage divider with ldr
voltage divider with ldr

Take a look at picture above. We already know that LDR will vary the resistance by how much light that exposed to it. This will make easier to read voltage output from different light brightness.

Voltage Divider is not for Power Supply

If you are new to electronics and think to use voltage divider for power supply then you are wrong. Why not for power supply? Voltage divider works with big resistors, so it will produce very small current. Small current cannot used for power supply. You can user linear regulator or switching power supply instead.

Another Example and Use it As Voltage Sensor

I wanted a voltage sensor for 20V maximum voltage input. Like for example, Solar Panel which usually around 20V. I will use Arduino to read that voltage and print the value to a 16×2 with i2c module LCD. If you wanted a detailed tutorial about I2C LCD you can find it here.

Voltage divider ready by arduino

Here’s the example Arduino sketch to read voltage with 10k,2k, and 1k resistors for

Voltage Divider
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("Voltage Divider");
  lcd.setCursor(0, 1);
  lcd.print("Experiment");
  delay(1000);
  lcd.clear();
}

// the loop routine runs over and over again forever:
void loop() {
  int sensorValue = analogRead(A0);
  float voltage = sensorValue * (5.0 / 1023.0);
  Serial.println("Voltage : ");
  float Vin = voltage * 13 / 3.0;
  Vin = 0.94 * Vin;

  lcd.setCursor(0, 0);
  lcd.print("VDiv :");
  lcd.print(voltage);
  lcd.print("V");
  lcd.print(" ");
  lcd.setCursor(0, 1);
  lcd.print("Vin  :");
  lcd.print(Vin);
  lcd.print("V");
  lcd.print(" ");
  delay(500);
}

In my case, I need to multiply the voltage by 0.9 to make it more accurate. Here’s the code with multiply factor in it.

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0,0);
  lcd.print("Voltage Divider");
  lcd.setCursor(0,1);
  lcd.print("Experiment");
  delay(1000);
  lcd.clear();
}

// the loop routine runs over and over again forever:
void loop() {
  int sensorValue = analogRead(A0);
  float voltage = sensorValue * (5.0 / 1023.0);
  //voltage = 0.9653*voltage + 0.0155;
  voltage = 0.94*voltage;
  Serial.println("Voltage : ");

  lcd.setCursor(0,0);
  lcd.print("VDiv :");
  lcd.print(voltage);
  lcd.print("V");
  lcd.print(" ");
  lcd.setCursor(0,1);
  lcd.print("Vin  :");
  lcd.print(voltage*13/3.0);
  lcd.print("V");
  lcd.print(" ");
  delay(500);
}

2 Replies to “Understanding Voltage Divider”

  1. Thank you so much for this Video! I am not very good with electronics and I am a nubee with Arduino. I stumbled across this video on Utube because I am attempting to build a robot Arduino lawnmower. As soon as I began watching this video, I had to subscribe and ring the bell. I had been somewhat lost understanding what a Voltage Divider was and how to use it. Now, with a big thank you to you video I am now comfortable with my new knowledge and understanding of how to use it.

    Thank yo so very much!!!

Leave a Reply

Your email address will not be published. Required fields are marked *