Introduction
This project is based on the explanation at https://learn.openenergymonitor.org/electricity-monitoring/ctac/how-to-build-an-arduino-energy-monitor, and uses its library for the calculations.
It has inputs for 2 current clamps SCT013-030, and calculates voltage (V) and current (A), real power in Watt, apparent power in VA, and the power factor (no unit).
Overview of the measured properties
| Measured entity | Symbol | Unit | Description |
|---|---|---|---|
| Voltage | Vrms | V (Volt) | The actual mains voltage, true RMS (root mean square). |
| Current | Irms | A (Ampere) | The actual mains current, true RMS (root mean square) |
| Apparent Power | VA (Volt Ampere) | Is the product of Vrms and Irms. Is larger than the real power. | |
| Real Power | W (Watt) | Power that is consumed at this very moment | |
| Real Power Consumption over time | Wh (Watt Hour), mostly kWh | Not measured in this project | |
| Power Factor | PF | (none since this is a factor) | Power Factor = Real Power / Apparent Power |
See for more explanation https://learn.openenergymonitor.org/electricity-monitoring/ac-power-theory/introduction.
The power is negative for power generation, and positive for power consumption.
Used Components
- NRF24L01Plus for communication with the MySensors gateway.
- AdapterBoardForNRF24L01 to deliver a stable power supply to the NRF24L01.
- Opamp-LM6142 to create a virtual ground level. This opamp is chosen because it works rail-to-rail, and it is suitable for low voltage power supplies.
- SCT013-Split-core-current-transformer type 30A 1V, to generate a safe voltage to measure.
- Arduino Uno to measure, calculate and communicate.
- Uno Prototype shield
- Power supply 5V DC based on HLK-PM01
- Transformator 220V AC to 9V AC 1W
- Diodes: 4x 1N4148
- Resistors: 2x 100k, 1x 120k, 1x 12k
- Capacitors: 1x 100nF
Virtual ground with an opamp
See https://www.analog.com/en/analog-dialogue/raqs/raq-issue-46.html
- Quote:
- What we should do is connect the device as a follower (output to inverting input) and connect the non-inverting input to a potential somewhere between the supply rails.
Source code
The hardware is foreseen to connect 2 current clamps.
First sign of life
First sign of life
__ __ ____
| \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___
| |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
| | | | |_| |___| | __/ | | \__ \ _ | | \__ \
|_| |_|\__, |____/ \___|_| |_|___/\___/|_| |___/
|___/ 2.3.2
16 MCO:BGN:INIT NODE,CP=RNNNA---,FQ=16,REL=255,VER=2.3.2
26 TSM:INIT
28 TSF:WUR:MS=8000
34 TSM:INIT:TSP OK
36 TSM:FPAR
38 ?TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
785 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
790 TSF:MSG:FPAR OK,ID=0,D=1
1251 TSF:MSG:READ,7-7-255,s=255,c=3,t=8,pt=1,l=1,sg=0:1
1539 TSF:MSG:READ,21-21-255,s=255,c=3,t=8,pt=1,l=1,sg=0:1
2048 TSM:FPAR:OK
2049 TSM:ID
2050 TSM:ID:REQ
2053 TSF:MSG:SEND,255-255-0-0,s=2,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
2069 TSF:MSG:READ,0-0-255,s=2,c=3,t=4,pt=0,l=2,sg=0:28
2074 TSF:SID:OK,ID=28
2076 TSM:ID:OK
2078 TSM:UPL
2107 TSF:MSG:SEND,28-28-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
2114 TSF:MSG:READ,0-7-255,s=2,c=3,t=4,pt=0,l=2,sg=0:28
2119 TSF:MSG:BC
2129 TSF:MSG:READ,0-0-28,s=255,c=3,t=25,pt=1,l=1,sg=0:1
2135 TSF:MSG:PONG RECV,HP=1
2138 TSM:UPL:OK
2139 TSM:READY:ID=28,PAR=0,DIS=1
2144 TSF:MSG:SEND,28-28-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
2158 TSF:MSG:READ,0-0-28,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
2170 TSF:MSG:SEND,28-28-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.2
2182 TSF:MSG:SEND,28-28-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
2209 TSF:MSG:READ,0-0-28,s=255,c=3,t=6,pt=0,l=1,sg=0:M
2223 TSF:MSG:SEND,28-28-0-0,s=255,c=3,t=11,pt=0,l=19,sg=0,ft=0,st=OK:Energy Meter SCT013
2235 TSF:MSG:SEND,28-28-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:2.0
2247 TSF:MSG:SEND,28-28-0-0,s=1,c=0,t=13,pt=0,l=17,sg=0,ft=0,st=OK:EM - Energy meter
2259 TSF:MSG:SEND,28-28-0-0,s=2,c=0,t=30,pt=0,l=16,sg=0,ft=0,st=OK:MM - Mains meter
2268 MCO:REG:REQ
2273 TSF:MSG:SEND,28-28-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
2280 TSF:MSG:READ,0-0-28,s=255,c=3,t=27,pt=1,l=1,sg=0:1
2285 MCO:PIM:NODE REG=1
2287 MCO:BGN:STP
2289 MCO:BGN:INIT OK,TSP=1
0.45 Watt RMS, 0.50 VA, 2.13 V RMS, 0.24 A RMS, 0.89 powerfactor.
2593 TSF:MSG:READ,0-20-255,s=2,c=3,t=4,pt=0,l=2,sg=0:28
2598 TSF:MSG:BC
2735 TSF:MSG:READ,0-20-255,s=2,c=3,t=4,pt=0,l=2,sg=0:28
2740 TSF:MSG:BC
2876 TSF:MSG:READ,0-20-255,s=2,c=3,t=4,pt=0,l=2,sg=0:28
2881 TSF:MSG:BC
3017 TSF:MSG:READ,0-20-255,s=2,c=3,t=4,pt=0,l=2,sg=0:28
3022 TSF:MSG:BC
3159 TSF:MSG:READ,0-20-255,s=2,c=3,t=4,pt=0,l=2,sg=0:28
3164 TSF:MSG:BC
0.33 Watt RMS, 0.39 VA, 1.87 V RMS, 0.21 A RMS, 0.84 powerfactor.
3597 TSF:MSG:READ,0-20-255,s=2,c=3,t=4,pt=0,l=2,sg=0:28
3602 TSF:MSG:BC
3604 TSF:MSG:READ,0-20-255,s=2,c=3,t=4,pt=0,l=2,sg=0:28
3609 TSF:MSG:BC
0.24 Watt RMS, 0.27 VA, 1.39 V RMS, 0.20 A RMS, 0.89 powerfactor.
0.20 Watt RMS, 0.26 VA, 1.61 V RMS, 0.16 A RMS, 0.76 powerfactor.
0.13 Watt RMS, 0.18 VA, 1.26 V RMS, 0.14 A RMS, 0.72 powerfactor.
0.10 Watt RMS, 0.14 VA, 1.10 V RMS, 0.12 A RMS, 0.71 powerfactor.
0.07 Watt RMS, 0.10 VA, 1.01 V RMS, 0.10 A RMS, 0.64 powerfactor.
0.03 Watt RMS, 0.09 VA, 0.91 V RMS, 0.10 A RMS, 0.27 powerfactor.
0.05 Watt RMS, 0.09 VA, 0.97 V RMS, 0.09 A RMS, 0.57 powerfactor.
11390 TSF:MSG:SEND,28-28-0-0,s=1,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:0.1
11402 TSF:MSG:SEND,28-28-0-0,s=1,c=1,t=55,pt=7,l=5,sg=0,ft=0,st=OK:0.1
11412 TSF:MSG:SEND,28-28-0-0,s=1,c=1,t=56,pt=7,l=5,sg=0,ft=0,st=OK:0.59
11423 TSF:MSG:SEND,28-28-0-0,s=2,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=OK:1.13
11435 TSF:MSG:SEND,28-28-0-0,s=2,c=1,t=39,pt=7,l=5,sg=0,ft=0,st=OK:0.12
0.05 Watt RMS, 0.10 VA, 1.04 V RMS, 0.09 A RMS, 0.48 powerfactor.
0.04 Watt RMS, 0.08 VA, 1.06 V RMS, 0.08 A RMS, 0.42 powerfactor.
0.01 Watt RMS, 0.06 VA, 0.85 V RMS, 0.07 A RMS, 0.23 powerfactor.
0.00 Watt RMS, 0.04 VA, 0.77 V RMS, 0.06 A RMS, 0.06 powerfactor.
0.01 Watt RMS, 0.05 VA, 0.82 V RMS, 0.06 A RMS, 0.11 powerfactor.
0.00 Watt RMS, 0.05 VA, 0.73 V RMS, 0.07 A RMS, 0.07 powerfactor.
0.01 Watt RMS, 0.07 VA, 0.93 V RMS, 0.07 A RMS, 0.10 powerfactor.
0.01 Watt RMS, 0.04 VA, 0.71 V RMS, 0.05 A RMS, 0.22 powerfactor.
-0.01 Watt RMS, 0.08 VA, 1.27 V RMS, 0.06 A RMS, -0.07 powerfactor.
-0.00 Watt RMS, 0.05 VA, 0.82 V RMS, 0.06 A RMS, -0.01 powerfactor.
21519 TSF:MSG:SEND,28-28-0-0,s=1,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:0.0
21530 TSF:MSG:SEND,28-28-0-0,s=1,c=1,t=55,pt=7,l=5,sg=0,ft=0,st=OK:0.1
21541 TSF:MSG:SEND,28-28-0-0,s=1,c=1,t=56,pt=7,l=5,sg=0,ft=0,st=OK:0.0
Build in a box
The S is for "Solar", and the G for "Grid".
Hot glue keeps everything in place
The LM6142 with the opamps mounted on a nano experiment board
The power supply has a normal fuse and a thermal fuse.