DIY wattmeter with an Arduino
Measuring power and energy using regular multimeters can be challenging or even unfeasible at times. In order to conduct such a precise and reliable measurement, a specific wattmeter is necessary. Due to their high cost, an alternative option is introduced in the form of a homemade wattmeter using an Arduino Nano board.
Parameters
This wattmeter gauges the actual power, total power, reactive power, phase, and energy. Additionally, the wattmeter also calculates the average, root mean square, variation, highest, lowest, and frequency of the voltage and current. It is able to calculate the voltage and current’s area and track the duration of the measurements. Depending on the display being used, either two or four parameters can be read at the same time.
An ideal instrument should not differentiate between AC and DC, as it ideally should. The key is selecting the correct parameter, all of which are justified through mathematical calculations. The voltage, current, real, and apparent power have a bandwidth around 1.8 kHz. The range of frequencies for reactive power and phase is restricted to mains frequencies between 50 and 60 Hz.
Accuracy
Even though an Arduino may not be the most precise board available, it is still possible to create a reliable measurement tool with it. After the recommended parts are utilized and following calibration, a precision of 0.2 % can be attained across a 10 °C temperature span.
Code
The Arduino code for this wattmeter is available as a text file: arduino-wattmeter-code-v1.0.
Circuit
In order to maintain simplicity in the circuit and design, a compromise was necessary: The meter’s voltage and current inputs have set ranges. However, a solitary amplifier is utilized in order to minimize the burden voltage of the current measurement.
General description
The voltage is determined by measuring between the terminals labeled “COM” and “V”. A voltage divider using R1 and R2 lowers the voltage for measurement by the analog input A4 of the Arduino. The Arduino is shielded from overvoltages by diodes D1 and D2. The present flowing through the “A” terminal passes through fuse F1 and shunt resistor R3 to reach the “COM” terminal. The voltage drop across R3 is directly proportional to the current flowing through it. As the voltage is extremely low (±50 mV total), IC1 amplifies it with R4,5 before sending it to analog input A5. Diodes D3 and D4 safeguard the electronics from voltage surges.
To enable the measurement of both positive and negative voltages, the “COM” voltage needs to be set at half of the reference voltage. The internal Arduino reference voltage is 1.1 V when used, therefore the “COM” voltage should be around 0.55 V. The impedance of this voltage should be relatively lower than that of R2. Since the Arduino reference voltage has limited capacity, the 2.5 V reference voltage is created using resistors R6 & R7 in a voltage divider circuit from the 5 V power source. The voltage might change, but this won’t impact the precision as it is monitored (input A6) and factored into the calculations.
The 16*2 (or 16*4) character LCD-module connected to the Arduino can display the measured parameters through a 4 bit databus and 3 control signals. The four switches S1…4 choose these parameters. The LED D7 serves as an overflow signal and will illuminate if the voltage or current input is overwhelmed, causing the measurement to become unreliable. The wattmeter gets its power from a 9 VDC adaptor plugged into the Arduino’s VIN and GND. The following text should be paraphrased using the same input language and maintaining the same number of words:
Voltage & current range
The voltage and current ranges are predetermined, so the input circuitries need to be adjusted for the specific application of the wattmeter. When selecting a range, expect values that may go beyond the nominal value rather than just focusing on the nominal value. When the wattmeter is applied to a 12 V PV-system, the battery voltage might exceed 14 V and the open terminal voltage of a PV-panel can be as high as 18 V. Inrush currents can exacerbate this issue, especially for current values. Remember that the chosen range is related to maximum values. The maximum value of a 100 Vrms sinusoidal AC voltage will increase by √2 to 141 V.
Voltage input attenuator
The voltage input attenuator is determined by the resistors R1 and R2. This resistor network will divide the input voltage so that the Arduino measures half reference voltage, 0.55 V, at maximum range. The resistor R2 has a fixed value of 10 kΩ, and the range is set by R1 and is calculated as:
[Ω].
If for instance a 50 V range is required, R1 must be 899 kΩ. Because this value isn’t a standard value, the closest higher E12 value is 1 MΩ. The value for R1 is may never be chosen lower than 10 kΩ to retain the overvoltage protection. Therefore the lowest possible range is ±1.1 V.
Current range
The current range is determined by the resistive value of the shunt R3, the amplification and the analog input sensitivity. Because the Arduino input sensitivity is fixed at ±0.55 V and the amplification is also fixed at 10 times, the voltage drop across R3 at full range is ±55 mV. So the range is set by the value of R3 and can be calculated as:
[Ω]
If a 5 A range is required, R3 must be 0.011 Ω, and is rounded to 0.01 Ω.
Shunt resistor properties
The shunt resistor is an essential component that requires specific focus. Resistors’ resistance values can change due to temperature fluctuations. By self heating as well as by the ambient temperature. In order to decrease the self-heating of the shunt resistor, the power dissipation allowed must be significantly oversized. The power dissipation specified should be around 10 times greater than the actual maximum dissipation. In the provided circuit, the shunt resistor consumes 0.25 W by dissipating 5 A · 50 mV, making a 3 W resistor appropriate. A shunt resistor with a temperature coefficient of 50 ppm/°C can achieve a tolerance of 0.1% over a temperature range of 20 °C. This involves the self-heating of the shunt resistor and the subsequent temperature increase inside the instrument housing. Using a shunt resistor with a greater temperature coefficient will take precedence. The original tolerance doesn’t matter much because it is accounted for through calibration.
Selecting a minimal burden voltage across the shunt (maximum of 50 mV) allows for a resolution of 50 μV on a four-digit display. This leads to thermoelectric voltages being apparent at junctions made of different metals when there are temperature variations between the terminals. The shunt can experience temperature variations because of varying power dissipation from nearby components. Slight variations in the solder joints of the shunt resistor can lead to temperature discrepancies. Many resistors produce considerable thermoelectric voltages and are ineffective in this specific use. The recommended resistor for the shunt is the VISHAY-DALE – WSL3637R0100FEA, which possesses outstanding qualities.
Amplifier
The LTC1050 is a special rail-to-rail opamp with a low input offset voltage (5 μV) and a low input bias current (10 pA). Don’t replace the opamp with any other type with unknown or worse specification.
Components analog section
All resistors in the analog section, including R1, 2, and 4…7, are 0.25 W metal film resistors with a 1% tolerance and a temperature coefficient of 100 ppm/°C or superior. The reverse leakage current of protection diodes D1…6 must be extremely low. Although the 1N4184 specified may not be the most ideal choice, it typically functions effectively. A significant variation exists in the reverse leakage current, so it is wise to monitor this current. In order to achieve this, attach the diode in the opposite direction within a series circuit including a voltmeter (Ri=10MΩ) and a 9 V battery. The voltage that can be measured should not go over 100 mV, which is equivalent to a leakage current of 10 nA.
Build
The wattmeter prototype presented in this article is constructed in a single PCB-unit to eliminate the need for external wiring to connectors. The only exception is the fixed mounted riser board for the four push button switches. It is possible to construct it on an 80*100 mm Perfboard and is simple. Only the following requires particular focus:
A four point measurement is used to measure the current to the shunt resistor R3. The resistor is equipped with four terminals: I+ and I- for current flow, and S+ and S- for detecting burden voltage. This is illustrated in the adjacent photo. Examine the star point connection on the circuit diagram at the sense terminal S- located on the “COM” side. All links to this fabricated “zero” can only be established here to prevent inaccuracies in measurements. The final point to note is the separation between the digital ground for switches and display, and the analog ground for the analog input circuit. Do not link the two grounds, as the Arduino already has a connection between them.
Following soldering, thoroughly clean the circuit board and Arduino Nano board with Isopropyl alcohol. This is to get rid of leak currents caused by remaining flux.
The part list for the wattmeter is displayed in Table 1. Keep in mind that the values for R1 and R3 are determined by the specified voltage and current range. You can substitute carbon film resistors with metal film resistors, but do not interchange metal film resistors with carbon film resistors.
For more detail: DIY wattmeter with an Arduino