0% found this document useful (0 votes)
29 views8 pages

Understanding Voltage Divider

Uploaded by

Esam Mohamad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views8 pages

Understanding Voltage Divider

Uploaded by

Esam Mohamad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Tuesday, October 29, 2024

miliohm.com
E LE CT RONICS A ND SO F T W A R E T U T O R I A L S

HOME ARDUINO RASPBERRY PI BASIC ELECTRONICS

BASIC ELECTRONICS

Understanding Voltage Divider


 July 17, 2017  2 Comments

 Arduino divider ldr microcontroller sensor voltage

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

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

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

1. #include <Wire.h>
2. #include <LiquidCrystal_I2C.h>
3.
4. // Set the LCD address to 0x27 for a 16 chars
and 2 line display
5. LiquidCrystal_I2C lcd(0x27, 16, 2);
6.
7. // the setup routine runs once when you press
reset:
8. void setup() {
9. // initialize serial communication at 9600
bits per second:
10. Serial.begin(9600);
11. lcd.init();
12. lcd.backlight();
13. lcd.setCursor(0, 0);
14. lcd.print("Voltage Divider");
15. lcd.setCursor(0, 1);
16. lcd.print("Experiment");
17. delay(1000);
18. lcd.clear();
19. }
20.
21. // the loop routine runs over and over again
forever:
22. void loop() {
23. int sensorValue = analogRead(A0);
24. float voltage = sensorValue * (5.0 / 1023.0);
25. Serial.println("Voltage : ");
26. float Vin = voltage * 13 / 3.0;
27. Vin = 0.94 * Vin;
28.
29. lcd.setCursor(0, 0);
30. lcd.print("VDiv :");
31. lcd.print(voltage);
32. lcd.print("V");
33. lcd.print(" ");
34. lcd.setCursor(0, 1);
35. lcd.print("Vin :");
36. lcd.print(Vin);
37. lcd.print("V");
38. lcd.print(" ");
39. delay(500);
40. }

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.

1. #include <Wire.h>
2. #include <LiquidCrystal_I2C.h>
3.
4. // Set the LCD address to 0x27 for a 16 chars and 2
line display
5. LiquidCrystal_I2C lcd(0x27, 16, 2);
6.
7. // the setup routine runs once when you press reset:
8. void setup() {
9. // initialize serial communication at 9600 bits per
second:
10. Serial.begin(9600);
11. lcd.init();
12. lcd.backlight();
13. lcd.setCursor(0,0);
14. lcd.print("Voltage Divider");
15. lcd.setCursor(0,1);
16. lcd.print("Experiment");
17. delay(1000);
18. lcd.clear();
19. }
20.
21. // the loop routine runs over and over again forever:
22. void loop() {
23. int sensorValue = analogRead(A0);
24. float voltage = sensorValue * (5.0 / 1023.0);
25. //voltage = 0.9653*voltage + 0.0155;
26. voltage = 0.94*voltage;
27. Serial.println("Voltage : ");
28.
29. lcd.setCursor(0,0);
30. lcd.print("VDiv :");
31. lcd.print(voltage);
32. lcd.print("V");
33. lcd.print(" ");
34. lcd.setCursor(0,1);
35. lcd.print("Vin :");
36. lcd.print(voltage*13/3.0);
37. lcd.print("V");
38. lcd.print(" ");
39. delay(500);
40. }

Understanding voltage divider and How to us…


us…

Share this:

 

Related

How to convert How to use PT100 MCP4725 Tutorial


resistance to voltage RTD Temperature with Arduino and
July 24, 2017 Sensor with ardino ESP-board
In "basic electronics" August 26, 2020 (NodeMCU)
In "arduino" October 13, 2022
In "arduino"

2 Replies to “Understanding
Voltage Divider”
1. Pingback: How to convert resistance to voltage -
miliohm.com

2. robert buckles says:

March 29, 2022 at 2:13 am


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!!!

You might also like