Hello 
today i show you Arduino Wattmeter  Measure Voltage, Current and Power Consumption using arduino


Materials Required

  1. Arduino Nano
  2. LM358 Op-Amp
  3. 7805 Voltage regulator
  4. 16*2 LCD display
  5. 0.22 ohm 2Watt shunt resistor
  6. 10k Trimmer pot
  7. 10k,20k,2.2k,1k Resistors
  8. 0.1uF Capacitors
  9. Test Load
  10.  breadboard

Circuit Diagram


First i show you  arduino wattmeter



For ease of understanding the arduino wattmeter circuit is split into two units. The upper part of the circuit is the measuring unit and the lower part of the circuit is the computation and display unit. For people who are new to this type of circuits followed the labels. Example +5V is label which means that all the pins to which label is connected to should be considered as they are connected together. Labels are normally used to make the circuit diagram look neat.

The circuit is designed to fit into systems operating between 0-24V with a current range of 0-1A keeping in mind the specification of a Solar PV. But you can easily extend the range once you understand the working of the circuit. The underlying principle behind the circuit is to measure the voltage across the load and current through it to calculate the power consumes by it. All the measured values will be displayed in a 16*2 Alphanumeric LCD.

Further below let’s split the circuit into small segments so that we can get a clear picture of how the circuit is indented to work.

Measuring Unit

The measuring unit consists of a potential divider to help us measure the voltage and a shut resistor with a Non-Inverting Op-amp is used to help us measure the current through the circuit. The potential divider part from the above circuit is shown below




Here the Input voltage is represent by Vcc, as told earlier we are designing the circuit for a voltage range from 0V to 24V. But a microcontroller like Arduino cannot measure such high values of voltage; it can only measure voltage from 0-5V. So we have to map (convert) the voltage range of 0-24V to 0-5V. This can be easily done by using a potential divider circuit as shown below. The resistor 10k and 2.2k together forms the potential divider circuit. The output voltage of a potential divider can be calculated using the below formulae. The same be used to decide the value of your resistors, you can use our online calculator to calculate value of resistor if you are re-designing the circuit.

Vout = (Vin × R2) / (R1 + R2)

The mapped 0-5V can be obtained from the middle part which is labelled as Voltage. This mapped voltage can then be fed to the Arduino Analog pin later.

Next we have to measure the current through the LOAD. As we know microcontrollers can read only analog voltage, so we need to somehow convert the value of current to voltage. It can be done by simply adding a resistor (shunt resistor) in the path which according to Ohm’s law will drop a value of voltage across it that is proportional to the current flowing through it. The value of this voltage drop will be very less so we use an op-amp to amplify it. 
The circuit for the same is shown below



Here the value of shunt resistor (SR1) is 0.22 Ohms. As said earlier we are designing the circuit for 0-1A so based on Ohms law we can calculate the voltage drop across this resistor which will be around 0.2V when a maximum of 1A current is passing through the load. This voltage is very small for a microcontroller to read, we use an Op-Amp in Non-Inverting Amplifier mode to increase the voltage from 0.2V to higher level for the Arduino to read.

The Op-Amp in Non-Inverting mode is shown above. The amplifier is designed to have a gain of 21, so that 0.2*21 = 4.2V. The formulae to calculate the gain of the Op-amp is given below, you can also use this online gain calculator to get the value of your resistor if you are re-designing the circuit.

Gain = Vout / Vin = 1 + (Rf / Rin)

Here in our case the value of Rf is 20k and the value of Rin is 1k which gives us a gian value of 21. The amplified voltage form the Op-amp is then given to a RC filter with resistor 1k and a capacitor 0.1uF to filter any noise that is coupled. Finally the voltage is then fed to the Arduino analog pin.

The last part that is left in the measuring unit is the voltage regulator part. Since we will give a variable input voltage we need a regulated +5V volt for the Arduino and the Op-amp to operate. This regulated voltage will be provided by the 7805 Voltage regulator. A capacitor is added at the output to filter the noise.


Computation and display unit


In the measuring unit we have designed the circuit to convert the Voltage and Current parameters into 0-5V which can be fed to the Arduino Analog pins. Now in this part of the circuit we will connect these voltage signals to Arduino and also interface a 16×2 alphanumeric display to the Arduino so that we can view the results. The circuit for the same is shown below

As you can see the Voltage pin is connected to Analog pin A3 and the current pin is connected to Analog pin A4. The LCD is powered from the +5V from the 7805 and is connected to the digital pins of Arduino to work in 4-bit mode. We have also used a potentiometer (10k) connected to Con pin to vary the contrast of the LCD.

Code

 

#include <LiquidCrystal.h> // Default Arduino LCD Librarey is included

int Read_Voltage = A3;
int Read_Current = A4;
const int rs = 3, en = 4, d4 = 8, d5 = 9, d6 = 10, d7 = 11; // Mention the pin number for LCD connection
LiquidCrystal LCD (rs, en, d4, d5, d6, d7);

void setup () {
  lcd.begin (16, 2); // Initialise 16 * 2 LCD

  lcd.print ("Arduino Wattmeter"); // Intro Message Line 1
  lcd.setCursor (0, 1);
  lcd.print ("With Arduino"); // Intro Message line 2

  delay (2000);
  lcd.clear ();

}

void loop () {
 
 float Voltage_Value = analogRead (Read_Voltage);
 float current_Value = analogRead (Read_Current);

 Voltage_Value = Voltage_Value * (5.0 / 1023.0) * 6.46;
 Current_Value = Current_Value * (5.0 / 1023.0) * 0.239;

 lcd.setCursor (0, 0);
 lcd.print ("V ="); lcd.print (Voltage_Value);
 lcd.print ("");
 lcd.print ("I ="); lcd.print (Current_Value);

 float Power_Value = Voltage_Value * Current_Value;

 lcd.setCursor (0, 1);
 lcd.print ("Power ="); lcd.print (Power_Value);

 
delay (200);
}

No comments

Theme images by Dizzo. Powered by Blogger.