Understanding Voltage Divider
Understanding Voltage Divider
miliohm.com
E LE CT RONICS A ND SO F T W A R E T U T O R I A L S
BASIC ELECTRONICS
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.
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.
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. }
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. }
Share this:
Related
2 Replies to “Understanding
Voltage Divider”
1. Pingback: How to convert resistance to voltage -
miliohm.com