GWE (Gas-Water-Energy) logger

 

Energy logger

Goals:

1. Can we see how much electric power is used by compliancies without plug (for instance light bulbs)?

2. Is it possible to see remote if lights are turned off?

This is a rather old idea. The basic idea was from around 2000, when I gave the assignement to a group students to design this for me. They did not design a solution but stayed in reporting possible solutions, so the idea was put on the pile with ideas. Until the summer of 2016 when some friends seems to have the same idea.

Due to the fact that I still got a Arduino-Mega laying around after the 3D printer project I decided to use that as the controller. And after our main fuses were replaced and extended with more groups, beginning of 2016. I decided to measure the power per group.

 

Step 1: measure the current per group

 

Step2: Measure the voltage

There is no need to measure the voltage per group, but due to the time spend in measuring one group the voltage has a different phase during the measurement of the other groups. This could easily be solved by remeasuring the mains voltage at the same time as the current.

The design of the circuit to measure the voltage is similar as the current measurement circuit.

 

Step 3: ADC + Reference voltage

First impression was that the ADC of the arduino was very sensitive for the used power supply. A short investigation of the arduino datasheet showed that this is cause by the fact that default the ADC ref is the 5V power supply. For this reason an external reference is added.

I have chosen to use the AD584 also due to the fact that it has a Vref/2 (unbuffered) output available. Note that this reference requires a higher power supply than 5V. But in principle the Arduino board also requires a higher input voltage to create the 5V internal, so that voltage can be used.

At first high accurate ADCs were ordered, but for simplicity of the design I have chose to start with using the 10 bit ADCs available in the Arduino Mega. I needed 10 current measurement and 1 voltage measurement, so 11 ADC inputs, which are available on the Arduino Mega, so not  a problem.

 

Step 4: Buffer opamp

There were two reasons to add a buffer opamp between the current transformer and the ADC:

  1. The ADC is rather low-ohmic and will cause a measurement error
  2. When Vref is turned off the arduino gets a negative voltage on its ADC and this ADC will be damaged. By using the same power supply for the reference as for the buffer opamps this is automatically safe.

The buffer opamps for the current coil can be in principle any opamp that is available, but there are some things to consider:

  1. If we use 5V as supply aswell as for Vref we should use a rail-to-rail opamp to be able to use full range of the ADC
  2. The bias and the offset current will give a direct error in the measurements. If you want to measure below 1W it means the current error should stay below 1W/230V = 4.3mA. With a gain of 2000 => 2.2uA. So the bias current and offset should stay well below that value.
  3. The voltage offset will give via the burder resistor also a measurement error. In my case the burden resistor was 220E so that means the offset voltage should be well below 220E*2.2uA = 0.48mV.  Note that item 2 and 3 are directly related. So if one is just meeting the spec the other should be well below such that it can be neglected.
  4. The opamp is powered allways (assuming the energy logger is always logging) so a low power consuming opamp is also wise to pick.

The buffer opamps for the voltage measurement have similar considerations.

The buffer opamps for the reference have also similar considerations but in that case the voltage offset will result in a direct reference error and require some extra attention.

 

Step 5: Calculating the power

To calculate the power used you need the current, voltage and the phase difference between them.

Luckily more people are working on this, so in my case I just downloaded the arduino libraries:

https://github.com/openenergymonitor/EmonLib

 

Step 6: Logging

First I started with logging on a local SD card. To be able to do so I needed to know the time. A standard example of getting real time in Arduino is available in the examples, so that could be easy added.

Secondly I would like to have a readout of the values remote (all over the world). For this I used:

because they had examples of Arduino available and was easy to implement.

Future idea is to use the Arduino also a web-host, but that has not been implemented.

 

 

Step 7: Power usage of the logger itself

Because the logger is always logging its power usage is also interesting.

The Arduino Mega board (assuming you use the local regulator) requires at least 6.6V. And the external reference also requires something like 7V. For this reason a 7.5V adapter is used.

Component Current used (mA)
Arduino Mega 51
Ethernet shield + SD card 157
Buffer opamps 13
Reference 1

Using an old stable regulator the total power used was around 4W. By using a newer switch-mode AC-DC converter the power usage dropped to around 2.5W, which was acceptable for this application.

The main consumer is the Ethernet shield.

 

Step 8: Cost of the logger

Component Price [Euro] Type Link
Arduino Mega + Ethernet/SD shield 11.11 Mega2560 AliExpress
10 current transformers 14.10 CT08CL5 Ebay
SD card 5.95   Action
6 opamps 2.83

For example:

TLC2272

Many types available, for example:

AliExpress

7.5 power supply 9.99   kijkshop
Connectors (div.) 1.90   <diverse>
Accurate reference 2.69 AD584 AliExpress
TOTAL 48.57   -

 AC-AC adapter, resistors and PCB were available from old electronics; and thus not mentioned in table above.

 

Step 9: Pictures of the setup

Installation of the current transformers

 

And the electronic (buffers + Arduino)

Due to the fact that the Arduino and the AC-DC power supply disturb the low analog signals they are replaced further away (see band cables in photo above).

 

Step 10: Circuit diagram

Mapping of the circuit above on the photo of the interface board (for n = 10):

Extra in this figure are some small components (R, C, Diodes) that are used for filtering of the supply.

Also some LEDs were added to diagnose errors of the Arduino; also not in the circuit diagram.

 

Step : Accuracy of the readout

The accuracy is determined by:

  1. Phase shifts
    1. The phase shift due to measuring current and voltage at different moments (there is a certain time already passed)
    2. Phase shift due to the used voltage readback method (transformer), which is slightly loaded by the resistors
    3. Phase shift due to current readout by a transformer
  2. Current readout error
    1. The current to voltage transformation done via a regular resistor => can be up to 10%, due to the choses accuracy of the resistors. Is a fixed value so could be calibrated.
    2. Due to used opamps:
      1. Error is introduced due to the bias current of the buffer opamps
      2. Error is introduced due to the voltage offset of the buffer opamps
    3. Reference voltage
      1. Mismatch between the Vref and Vref/2
      2. Accuracy of the Vref
      3. Stability of the Vref (due to supression of the Vcc variations)
    4. Accuracy of the Arduino ADC is limited to 10 bits
  3. Voltage readout error
    1. The resistive voltage divider => can be up to 2*10%, due to the choses accuracy of the resistors. Is a fixed value so could be calibrated.
    2. Due to used opamps:
      1. Error is introduced due to the bias current of the buffer opamps
      2. Error is introduced due to the voltage offset of the buffer opamps
    3. Reference voltage
      1. Mismatch between the Vref and Vref/2
      2. Accuracy of the Vref
      3. Stability of the Vref (due to supression of the Vcc variations)
    4. Accuracy of the Arduino ADC is limited to 10 bits

Lets look in more detail to the accuracy of 10 bits:

 

Water logger

Now that the electricity logger is installed (see above) it is easy to add things. The first addition was the water logger. The water meter has a small "moon" at the lowest digit which can easily be monitored either visual or via an inductive proximity sensors. Each time the moon rotates a puls is generated. This puls is handled in the Arduino code via an interrupt, so that no pulses are missed.

The output voltage of the inductive prox sensor is just above 5V (equal to the supply of the sensor), so two resistors are added as a voltage divider.

Such a proximity switch can be bought for circa 2.50 euro.

Connection of the sensor is done via an easy wood piece connected with tie-raps around the meter (see photo above).

 

Gas logger

In the "6" of the last digits of the gas meter is a small mirror.

Via a cheap IR detector + LED (circa 0.30 euro incl. PCB and comperator) the passing of this "6" can be detected.

Only "problem" is the aligning of the sensor for exactly the mirror.

We designed a small black bracket (see photo) around the gas-meter so it is easy to remove sensor when needed.

End 2017 the gas-meter is replaced by a "smart-meter" gas meter. The previous gas-meter was no longer "allowed".

With this "smart"-gas meter an automatic readout can be done via the electricity meter. See section "smart-meter".

 

Smart meter

There is of-course nothing smart to this meter. But it has a so called P1 interface.

Results