AC Current Transformer Interface Project

With my smart home solar installation project well underway, I wanted a way to get real-time information on my solar energy generation and energy consumption. As part of this project, I bought my Zappi smart EV charger and this has connected me into the rather impressive myenergi eco-system, which provides an excellent view of my energy situation, an impressive app and access to some great visualisations.

The main issues I have with this eco-system though, are that it is cloud based, there is no supported API and I don't really know how accurate the measurements provided are. As part of my smart energy management project I need to model my solar energy components and collect real data, so that my contextual smart home has real-time access to accurate information.

Current transformers (CTs) are sensors used to linearly step down the current passing through the sensor to a lower level compatible with a measurement device. The number of wire windings around the core dictates the step down ratio, or CT ratio, between the current in the measured line (primary), and the current output connected to the measurement device (secondary).

CTs can be split core or solid core. Split-core current transformers are cost effective and efficient, since the current can be measured without the need to break the conductor. This means they can safely and easily be retro-fitted to existing solar installations.

Note: You can't simply clip a current transformer around an existing cable as it will most likely be twin core. The currents flowing in a twin core cable will cancel out, so the CT has to fitted to a single core and this means finding a point where the cable has been split to be connected into a junction block, isolation switch, etc.

The objective of this project is simply to provide an interface that allows a current transformer to be easily connected to an Arduino processor, so that an analogue input pin can be to accurately measure the AC current in a wire. I know you can buy pre-built modules to do this already but, they are quite expensive and of variable quality. This is a high quality design and construction, at a fraction of the price of current consumer products. These may be made available to purchase if the demand is there.

Design

I have worked with a friend on this project, to design and build a cheap module that is reliable and accurate.

Most of the current transformers on the market use a 3.5mm jack plug to connect them, so my PCB has a suitable socket to allow them to be plugged in.

This tiny PCB provides a linear dc voltage output that is proportional to the AC current being sensed, with zero offset. The output depends on the range of currents being sensed and the ratio of the current transformer, so it needs to be calibrated.

The PCB provides 2 rows of 4 SIL pins, to allow it to be piggy backed onto another board. It is also possible to connect directly to the PCB, if this is not required. There are only 3 pins required to use this module:

  1. +V = 5V dc or 3V dc supply
  2. O/P = Analogue output, for connection to an analogue input pin
  3. GND

This makes it incredible easy to connect to an Arduino Uno or Mega 2560.

I'm not trying to do accurate energy measurement with these sensors. Whilst they measure resistive loads accurately, they do not take account of the power factor changes caused by reactive loads. They are good enough for my intended purposes though.

Software

I will share the Arduino code here very soon.

Testing

For my initial testing I'm using a 30A current transformer to measure the output current from my solar panels microinverters. This basically gives me a measurement of the power they are generating. My panels could output up to 6kW, which would be around 28A at mains voltages.

With the CT connected to a test device, I measured the voltage using the Arduino analogue port. A reading of 143 equated to 2.00kW, so the calibration factor is 14 in this instance. This means that the resolution of my measurements is 14W, which is very good. The myenergi eco-system reports to the nearest 0.1kW / 100W in comparison.

Once calibrated, my testing showed the accuracy and repeatability of results to be very good. The sensor is connected to an Arduino slave processor which does signal conditioning and rate limiting. This makes it super responsive to changes in power generation levels, so my contextual smart home can react quickly when doing my intelligent energy management.

I have discovered that the cloud-based API I'm using from Myenegi only allows one call every 60 seconds. This latency is not good and another reason why I've developed my own sensors.

Smart Home Integration

Over my many years doing smart home (I started in 2004), I have developed my own library of code for Arduino processors and this includes functions to integrate it into my distributed Home Control System and connect numerous types of sensors. These 'slave processors' can then do clever stuff like local control, self-monitoring of performance, local signal conditioning and rate limiting, send warnings and errors, or host some functions locally.

This maximises reuse across my many smart home projects, making it very quick and easy to develop and test new smart home capabilities. My smart home also employs the concepts of technology abstraction, meaning my smart home is also technology agnostic. This allows old technologies or broken sensors and devices to be swapped out with new ones, with minimal effort and zero reconfiguration.

Most of the Arduino processors installed in my smart home use an Ethernet IP network interface, to enable them to send and receive events with my Home Control System, using my unified communications protocol. Wired networks ensure very low latency and hence a great user experience, though occasionally I will use Wi-Fi.

Adding sensors and devices to my Home Control System is simply a matter of adding one line of JSON for each one, to the main configuration file. This defines the name, zone, object type and also the details of the slave processor it is hosted or controlled by. All the intelligence is within my Home Control System, which receives and sends encrypted events using my unified communications protocol. It sends events to update my smart home on things like the temperature, humidity, fan state, appliance and lighting state changes, occupancy, etc.

Summary

This project has been running in my smart home for a while now and is working really well. It allows my contextual smart home to gain an accurate and timely view of how my smart home solar installation project is working, without resorting to cloud-based platforms and 3rd party APIs. This is a key element in enabling my smart energy management. The key objects I plan to measure with this solution are:

My @smartest_home sometime tweets about Solar Power and this is measured using this PCB. Because the sensor and processing is local (within my home) and no cloud-based APIs are involved, my smart home can be very responsive to any changes in power generation caused by cloud cover, etc.

My @smartest_home also tweets about the House Power and this is measured using this PCB. The latency is very low and the measurement is very accurate. This means my contextual smart home can react very quickly to changes in value. It also means that my smart home can send a notification or make a voice announcement if set limits are crossed.

Updates

Whilst testing my smart immersion heater controller, I noticed that I was getting some odd readings using these sensor PCBs. The reason is because they try to average out the ac waveform, assuming it is sinusoidal. As my immersion heater is chopping the waveform in a complex manner, this assumption is no longer true. To address this, I have simplified the board, so that it can now be used to sample the waveform and accurately average the voltage seen. The Arduino now takes about 3500 samples in a 400mS window and uses the average value to much more accurately measure the waveform voltage and hence power.

This approach still only really works with resistive loads but I currently looking at measuring phase changes as well, to make it even more accurate.

On issue I noticed with this approach to measuring my solar power output is that my Enphase microinverters appear to use over 300W at night time. In practice they use very little real power at night and this is explained in this video.

Further Reading

Buy Me A Coffee

If you found this page useful you can buy me a coffee. This helps me maintain this website and add more content.