Voltage Sensing Circuit (I) - Voltage divider theorem

Week 2

A simple voltage sensing circuit is built by making use of the voltage divider theorem, whereby Vout = [ {R2 / (R1+R2)] * Vin ]. We had previously experimented with this circuit where R1 is of value 980K while R2 is of value 10K, the voltage display was more inaccurate from the calculated voltage output as the accuracy was around +/- 1V, as compared to the current accuracy of +/- 0.4V. We begin experimenting and replaced the R1 with the value of 100K, only then did the circuit start displaying more accurate Voltage values.

                   Figure 1: Voltage Divider Theorem

Figure 2: Voltage Sensing Circuit

The circuit is tested with a voltage output of 5V from the DC Power Supply, 4.72V is then being sensed by the circuit. Whereas for a voltage of 10V, a 9.49V is being sensed. This shows that the circuit is only accurate up to a certain extent, and can be improved.

 Figure 3: Voltage sensing circuit (5V)

Figure 4: Voltage sensing circuit (10V)


The code for the voltage-sensing circuit is as shown:



#include 

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);    

int analogInput = A0; 

float vout = 0.0;
float vin = 0.0;
float R1 = 99400.0; //100k
float R2 = 9720.0; //10k
int value = 0;

void setup()
{
   Serial.begin(9600);
   pinMode(analogInput, INPUT);
   lcd.begin(16,2);
}

void loop()
{
   // read the value at analog input
   value = analogRead(analogInput);
   vout = (value * 5.0) / 1023.0;
   vin = vout / (R2/(R1+R2)); 
   
  lcd.clear();
  lcd.print("Voltage = ");
  lcd.println(vin,2);

  delay(1000);
}

Comments

Popular posts from this blog

Transmission within the car - HC-05 & HC-06 FC114 (Bluetooth module)

Week 13 - Integration test - PLX-DAQ, Chase vehicle simulation, LoRa interface