Power Quality Meter

by Alexandru Furdui in Circuits > Arduino

1150 Views, 1 Favorites, 0 Comments

Power Quality Meter

IMG_20220806_174324.jpg
IMG_20220806_174315.jpg
IMG_20220807_142028.jpg

This meter measures the RMS voltage and current, real power, power factor, energy consumed and the cost of the electricity used up to date of the devices plugged into the meter's outlet. It does this by measuring the instantaneous voltage and current with the help of a current sensor and a voltage sensor, and then does a couple of calculations to provide useful information on the display.

This project is not intended for beginners. In order to make this meter, you will be working with mains voltage and you will need to know basic electronics and how to solder.

Supplies

Here is a list of what you will need to build this meter:

  • Arduino nano board
  • Nokia 5110 display
  • Hall effect current sensor ACS712 (20 A)
  • Voltage sensor ZMPT101B
  • Electrical junction box
  • PCB Prototype board
  • Extension cord
  • 5V mobile phone charger
  • USB cable
  • Wire connectors
  • Female pin header connectors

Creating the Circuit

diagram_bread_bb.png
circ.png
IMG_20220505_183730.jpg

I chose to use a pcb prototype board to solder the electrical components on, in order to have a compact circuit and to eliminate the risk of components coming loose.

The components are not soldered directly to the pcb, because I want to be able to easily mount/demount them, so I used female pin header connectors.

Connections Nokia display to Arduino:

SCLK -> D11

DN or DIN -> D10

D/C -> D9

RST -> D8

SCE or CS -> D7

The voltage and current sensors are connected to A0 and respectively A1 analog pins of the arduino board.

Connect the power pins of the sensors to the arduino power pins.

You will need to cut the usb cable and solder the black wire to the GND pin, and RED wire to the 5V pin on the arduino. This way the circuit can be powered from the mains, through a phone charger.

Base for the Circuit

IMG_20220505_151153.jpg

To provide a safe to use meter, the circuit and the mains wires will be inside an electrical junction box.

Cut the extension cord in half and drill 2 side holes in the electrical junction box.

Now cut a rectangle in the box cover for the display.

Mounting the Circuit Into the Box

IMG_20220505_201647.jpg
IMG_20220505_202916.jpg

First, connect the sensors to the mains wires like in the electrical diagram. The ground wire is not represented in the diagram, but I just connected the two halves together.

Next, place the pcb into the box and mount the components on it. Also, place the Nokia display into the box cover and secure it with hot glue. I secured the pcb to the junction box with some screws, and i electrically isolated the current sensor and the display to make sure that it will not accidentally touch the mains wires. I strapped the extension cord's cables to the box, to make sure that it can't be pulled off.

The Software

Once you connected everything correctly, take out the arduino and connect it to the computer.

Upload the program to it.

Code explanation: I used a buffer of 160 samples which can store approximately 1.6 periods of a 50 Hz signal. So in total 2 buffers for voltage and current which leaves enough ram for the proper functioning of the code in the ATmega328 chip. After I took the instantaneous measurements I made some calculations to find the root mean square of the current and voltage, active power and power factor. After that, to have a relatively stable output values I also made an average of 11 measurements and finally display the results.

A good explanation of the calculations used in the code: https://learn.openenergymonitor.org/electricity-monitoring/ac-power-theory/arduino-maths

For interfacing the display with the arduino I used Adafruit_GFX and Adafruit_PCD8544 libraries.

Calibration of the Meter

Now that the meter works we need to calibrate it to give us accurate measurements. To do this we need to compare the values of the meter to the values of a multimeter. First we can calibrate the current sensor by modifying the constant in the code until we get a result close to that of the multimeter. For the calibration of the voltage sensor I recommend to use the knob on the sensor itself first and if necessary afterwards you can modify the constant in the code.