Welcome to Solarduino , A blog about DIY Solar PV and Arduino projects

DIY Simple AC Energy Meter with Arduino

Energy Meter is a very useful device that displays important electrical parameters. A typical full specs of AC Energy Meter displays 6 important electrical parameters, which are AC RMS Voltage, AC RMS Current, RMS Power, Instantaneous Power, Power Factor and accumulate Energy consumption. 

There are 2 main sensors which measure instantaneous voltage and current values from the system and the rest values are calculated based on these 2 input values by microchips. The current sensor can use split core transformer for measurement which does not require direct conductor contact between meter and the household electrical system. Unfortunately, in order to obtain voltage value, you need a wire connection from the electrical Distribution Board to the meter which involve safety risk of touching live wires. 

Some people are concern about safety and do not want to do any wiring on the existing electrical system. They might just want a very simple energy meter to measure the estimate energy consumption so that they can manage energy usage. This meter is designed specially for the group of people that no direct wiring is required. What you have to do is clip on the split core transformer to a live cable and that’s it, measurement can be done easily. 

Due to the simplicity of the AC Energy Meter, there are some compromises on the measurement. This meter could not measure AC Voltage since no direct contact made. Due to this, other related electrical parameters such as the Real Power (watt) and power factor could also not be determined. However, you can assumed and key in the typical constant RMS voltage (example 230Vac) for calculation purpose. In this way the Apparent Power can be estimated. Although Real Power is more accurate in measuring consumption, but it is no big deal in larger picture and if you are not typical in some deviation. There are quite some commercial AC energy meter uses this principle.

 

Wireless Smart Energy Monitor for Saving

This is an energy meter for the whole household monitoring and the measurement unit is fit inside electrical panel while there is a portable monitor display which is constantly communicate and acquire data via wireless with the measurement transmitter unit. You can get it at our affiliate link here !!!

Wi-Fi Smart Energy Monitoring Control Meter

This is a smart household energy meter that could monitor and controlled by phone anywhere around the world at anytime. This is for single phase household and installed in electric panel via din rail. Get it at our affiliate link here !!!

Warning ! You may now dealing with high voltage and high power source ! We assumed that you have the basic electrical knowledge and know what you are dealing with. You may need guidance from experienced guys if you are new to electrical work. Safety and Precaution must be always have in mind. We shall not be responsible for anything happening to you.

Arduino has the ability to measure AC current (via hall effect CT) by analog input pins. For Arduino UNO, there are 6 analog input pins (A0-A5) where you need separate pin for each measurement. If you stacked up a LCD Display Shield, Analog Pin A0 is automatically occupied by the button function. If you are going a step further by adding Datalogger Shield, Analog Pin A4 and A5 are also occupied for I2C communication for the Real Time Cloak module in the Datalogger Shield. Technically it still left Analog Pin A1 to A3 for AC Current pin. In this project, I will set A1 to measure AC current using Hall effect split core transformer. Do not reverse the voltage polarity which may damage the pins.

Arduino is the micro controller board for programming and automation purpose

Arduino UNO (compatible board)

If you still not yet own an Arduino Micro-controller Board, you can get it cheap at our affiliate link here !!!

UNI-T Multimeter is a good quality with decent price. We have been using UNI-T multimeter for years has not been any issue. We were using UT33C model. It can measure RMS Voltage. You can get yours at our affiliate link here !!!

Measure Current using Split Core Transformer 

The current sensor that is widely used for Arduino is the ACS712 Current Sensor Module. These modules require direct contact which I think is a major drawback. It has to be connected in series to the measured value. However, today we would like to use another type of similar principle which is Hall effect Split Core Transformer

It utilizing hall-effect phenomenon which voltage is produced from the movement of current within the region of magnetic field. The voltage produced by hall effect is directly proportional to the applied current making it suitable to estimate the applied current from the voltage sensed.

The sensor can measure current in 2 direction. Reverse current will not damage the sensor but the voltage produced will be in reduced. As we know, Arduino analog input only read positive integer values. In order to measure 2 direction, the zero point should be at half the total voltage range (0 to 5V) which is 2.5V. This is true if the supply voltage to the sensor is 5V. 

Fortunately, there is also a hall-effect sensor with split core transformer type (as picture on left). It is the Hall-Effect Split-Core Sensor HSTS016L module. The model ranges from 10A up to 200A. With split core current sensor type, not alteration on the existing system required. You can get it via our affiliate link here !!! The output voltage of this sensor is 2.5V +/- 0.625V with decent accuracy.

How the signal being processed

Root-Mean Square (RMS) current value is the square rooted averaged value that is derived from summation of squared of each raw values. 

The apparent power will be the multiplication of RMS current and the RMS voltage which you key it in the code as constant value. 

The sensor is quite sensitive. We need 2-time calibration for the sensor and both calibration need to be done during no current measured. The first calibration is making sure it shows exactly at 0 point when no current is measured. It is an analog value calibration. Some modules might not showing exactly at analog value 512 when no value is detected (I have shifted it to 0 point using Arduino code for easy understanding). We need to add an offset value for this to adjust it back to origin when no value detected.

The second calibration is to further eliminate false signal value after RMS calculation. Even after the first calibration is made, there are still some minor ghost or electrical noise even when no current are measured. We have to add another offset to make it to zero value at the final stage for display. This second calibration must be done only after the first calibration take into effect. Both calibrations can be done manually (the harder way) or automatically by pressing the SELECT Button in the LCD Display Shield and wait for about 5 seconds. Of cause you need to have the LCD shield in order to work. You may purchase at our affiliate link here !!!

I recommend you to add a 16X2 LCD Display Shield which can be directly fit on to the top of the Arduino board without the need of extra wiring for the LCD Display. Without the LCD Display, you can only monitor the measured current value on PC via Serial Monitor. You can get the LCD Display board at our affiliate link here !!!. 

The good news is you do not need to manually calibrate the offset settings if you got the LCD Display Shield with you. Below we have attached the code that utilizes the button function that could automatically calibrate by itself when you pressed the SELECT Button. You may download from the end of this page below.  

Datalogger Shield

If you plan to record the data in a proper way, you may consider this Datalogger Shield. It allows your arduino to record your data in SD Card. Datalogger shield is often installed together with LCD Display shield. Please find it at our affiliate link here !!! For more about this Datalogger Shield, kindly visit our post here.

Hardware Connection

Once you get your Hall effect split core transformer current sensor module and Arduino Board ready, you may start to do hardware wiring. Below is the schematic of the whole wiring. You may also need some tools and accessories. Be sure your connection cable is tight and module shall be installed in such a way no movement at all. 

You can stack up screw shield, Datalogger Shield and LCD Display Shield on top of Arduino UNO. No additional wiring is required as the shields are meant for adding function without need of extra wiring. If more modules or shields are stacked, if voltage dropped is obvious, you may consider using independent 5V power supply and not from the arduino board.

In order to connect wiring between Arduino board and module, you need the dupont line cables male to female. You can get it at our affiliate link here !!!

You need the connector that can secure cables and isolate from accidental touch. Get the fast connector at our affiliate link here !!!

Outlet Socket Energy Meter

This is the outlet socket type of energy meter measuring the load consumption of your particular outlet socket load(s). Each wall outlet socket can be installed one unit. You may grab the unit at our affiliate link here !!!

Screw Shield / Expansion Shield

When there are a lot of wiring around especially more than 1 sensor, sharing pins will be difficult as existing pins (ground and 5V) are limited. This shield provides a lot of convenient terminals for each of the input and output pins. The shield can be mounted directly on top of the Arduino Uno board or in between the shields which made it very convenient to use. You can get it at our affiliate link here !!!

Software Codes

The final step would be adding source code onto Arduino board. I assume you have installed the Arduino Software. If you have not installed the software, the link here can bring you to the official download site. Once you have downloaded the software, you may download the code file (.ino) for this application below (right click save link). 

There is 2 source codes file attached which are source code with and without Datalogger shield function. Both have LCD Display Shield. If you don’t have LCD Display shield with you, kindly delete all the relevant code and you have to manually calibrate and key in the 2 offset values for the sensor. However, I still highly recommend that you get a LCD Display Shield.

With LCD Display Shield, once the code is uploaded to the Arduino board, the current value will be shown on the LCD Display. We have added the auto calibrate function, once the SELECT button is pressed, the value returns to exact zero point. You may have to wait about 5 seconds long until all values are re-calibrated. If first press is not satisfied, you may repeat by pressing it again.

I will not display the code here because it is long. You can download the .ino file to see for your own. Almost all code lines are with explanation. datal

Before we end, we would like to give gratitude to you for taking the time to read the post. We would need readers like you to support us in order to keep growing. You can support us in the following ways :

Donate & Fund Raising

If you like my work, please send me a donation to encourage me to do more. Thanks

Aliexpress Affiliate

We are the member of Aliexpress affiliate marketing. Do support us by clicking the affiliate product links if you do wish to purchase them.

Like and Share

If you like our post, we need your support to like and share our posts or videos so that it can reach more and more people like you !!

Result – In Serial Monitor

Result – In LCD Display

 

For Arduino Code Files, Remember to Right Click > Save Link As … You may alter the internal code as you wish. Happy coding !! 

Simple AC Energy Meter with LCD.ino
Simple AC Energy Meter with LCD and Datalogger.ino