I would like to be able to measure the power consumption of my heat pump separately in Homeassistant.
To do this, I would now use a CT sensor for each phase via ESPHome. But I am not sure which CT sensor I should use for my ESP8266:
one with integrated burden resistor which then outputs 1V at 20A (if I understand the specification correctly). Am I right in assuming that I will probably lose some accuracy since I am mapping the whole 20A to 1V values here, but I could theoretically map this to the whole 3.3V?
take one that outputs 50mA for 100A and then take a burden resistor with about 113ohm to utilize the entire 3.3V of the ESP?
Are there any decisive advantages or disadvantages here? Is my concern with accuracy justified?
The clamp converts 0-20 Amp to 0-1volt AC.
A sine wave of 1volt AC has a peak amplitude of 1 / 0.707 = 1.414volt.
AC sine wave also goes negative, so peak/peak voltage at 20Amp is 2.828volt.
The A/D should sample the full 2.828volt wave and can only measure positive signals,
so you must bias the other wire of the clamp at about 1.65volt. Most of this is explained here.
Leo..
If your heat pump is 3ph , then it will be a balanced load , so you only need to measure one phase , as they will all be the same ) .
You can buy “ current transducers “. That give a DC voltage or current output - that is the easiest to use .
For accuracy you need to use the internal
ADC voltage reference
The ESP8266 has only one Aref, which is about 1volt.
If we're talking about a development board, like the WeMos D1 min or NodeMCU,
then the analogue input has a 100k:220k divider fitted, which makes A0 about 3.2volt fullscale.
Leo..
Best to use one with an integrated burden as it will be chosen to give best accuracy. 113 ohms is probably too high. As pointed out by others that then gives you a nearly 3v ptp range which maps neatly onto the maximum range of an ADC with a 3v3 rail. You then need to sample the signal fast enough - at least 100Hz and either calculate the RMS value of just extract the peak value from the samples. RMS better as it will smooth out any spikes.
An important question is whether you want to measure "VAR" or real power? If the former then just multiplying rms current by some assumed or measured rms voltage does the trick. If you want actual power then you also need to sample the voltage waveform, compute the phase difference between current and voltage, and apply a power factor correction. Many solar power systems do this, in another thread I posted a link to a DIY system which does this. I suspect the load of a heat pump is mainly an induction motor so it will be somewhat reactive.
If you don't want real power then another approach is to just to rectify the output of the CT using a bit of analogue circuitry, such as a small bridge rectifier, and sample the DC. In theory the CT you cited will give a maximum DC voltage of 1.4V with a suitable smoothing capacitor - in practice the voltage will be a bit less than this because of the diode forward drop. Using Schottky diodes would help, or there are active full-wave rectifier circuits using op-amps that avoid the drop. Look at a datasheet / application note for the CA3140 op-amp for details.
Just to add that if you do choose a CT without a built-in burden, be sure one is connected at all times when it is sensing current. The way a CT works, it tries to drive some fraction of the amps in the primary conductor through whatever is connected on the secondary - if that's open circuit in theory the voltage is infinite! Not good for an Arduino if connected, or you!
If budget allows I would start with that. I would start with a current transducer rather than a current transformer. They also come in True RMS responding or Average Responding RMS indicating and since you have pretty much a true sine wave the lower cost average is fine. Easy to read and scale.
Using a CT you get in the example 1 volt AC out. Most uC devices such as an Arduino Uno need an analog in above 0 volts so using a CT you need to offset the AC. There are circuits to do this but if you want a good accurate system I would run with a current transducer verse a CT.
The link is but a single example from a single manufacturer, there are many to choose from.
For accuracy I also agree with hammy. If you want other than the internal reference A Google of voltage reference standard will bring up several examples. Like this one. Again, just an example.
Wow thanks for all the good answers
Also thanks for explaining everything so well.
yes I use a ESP8266 NodeMCU so I have 3.2V and would follow your recommendations here and take the ct sensor with built-in burden resistor. A current transducer is out of question because of the price, but thanks for the tip that I only have to measure one phase of the pump ;D
To the question of @jhaine yes I want to measure the real power so probably a bit more complicated. I also read a bit through the OpenEnergyMeter posts as well as watched some GreatScott! Youtube videos and now understand what the problem is and why I need to measure voltage as well. Thanks for the tipp. I then also came across the following video and that seems to address exactly my problem with a different CT sensor. Do you have anything to criticize about the mentioned procedure in the video?
Unfortunately I only understand half of what you tried to explain regarding the voltage measurement, but the mentioned procedure from the video should work with one of the mentioned power supplies from OpenEnergyMeter contributions or?
Or are your suggestions actually better? Only then you would have to explain them to me again please, how exactly I can measure them.
Just to be sure again: I can measure the voltage at any socket?
Sorry I don't have time to look at YT videos. If you really want to measure real power ideally you should sample the voltage very close to where the current measurement is done. You need a transformer to provide isolation and would probably need to provide some compensation for any phase shift in the transformer.
OK, back to the beginning. You have a few considerations to make.
Hi,
I would like to be able to measure the power consumption of my heat pump separately in Homeassistant.
To do this, I would now use a CT sensor for each phase via ESPHome. But I am not sure which CT sensor I should use for my ESP8266:
one with integrated burden resistor which then outputs 1V at 20A (if I understand the specification correctly). Am I right in assuming that I will probably lose some accuracy since I am mapping the whole 20A to 1V values here, but I could theoretically map this to the whole 3.3V?
take one that outputs 50mA for 100A and then take a burden resistor with about 113ohm to utilize the entire 3.3V of the ESP?
Are there any decisive advantages or disadvantages here? Is my concern with accuracy justified?
You are using an ESP8266 which has only a single A/D input. If you want to measure real power or true power you will need two A/D channels. You need to accurately measure voltage and current. To get around this you have two options. You can assume a fixed voltage and use it in your code or you can add a ADS1115 AD and use I2C to your ESP8266. A Google of ADS1115 to ESP8266 should get you some examples. The latter would be the more accurate way to go. Consider the ESP8266 is not quite linear. The ESP32 ADC has two non-linear regions, one just below ~0.5v and the other just above ~2.5v, Your signal is 0.0 to 1.0 VAC which needs conditioning. How accurately do you want things to be because you can't make a silk purse out of a sows ear. Even if you rectify your CT 0.0 to 1.0 volt a silicon diode bridge won't work since in a full wave bridge the forward voltage drop will be at best about 1.4 volts. Using Schottky diodes the forward voltage drop will be about 0.6 to 0.8 volt. The way low voltage AC from a CT is typically measured is using a "precision rectifier circuit" using an operational amplifier.
Yes, as to the voltage you need a step down transformer to both isolate and get mains voltage down to something you can work with and need to know the true transformer ratio. You also mention Real Power or True Power. You also mention a heat pump. I assume your load is not purely resistive but inductive? How accurate do you really need to be?
Well yes that's true but how fast does the thread starter really need to sample and thinking about it what to do with all the samples? That along with the EPS8266 is still limited to a single A/D channel so the mains voltage in the code would need to be a fixed value. Really I guess it all depends on what the person taking the measurements wants as to uncertainty.
I still haven't a clue how accurate they want or need? Let alone how fast they want to sample. I just want to point out some options.
Ok great then I take the socket right next to it.
I will probably use the following power supply, do you have anything to criticize? Or do you know better ones that are not too expensive?
Yes I know that the ESP8266 has only one analog input, I was actually planning to use the CD74HC4067 analog multiplexer, for which an ESPHome integration is already provided, but I never thought about the speed. How does it compare to the ADS1115?
I don't need to measure the real power too accurately. If I can determine to within 10-20W maybe 30W how much power is being used, I'll be super happy. Is that realistic? Also with the components I have chosen up to here?
You can analog MUX and yes the ADS1115 is slow and depending on your power you will be sampling 50 or 60 Hz so need to get enough samples of the sine wave. As long as you are aware of the shortcomings of the analog channel of the ESP8266.
Ok the AS1115 is slow and what about the CD74HC4067?
I live in Germany, so I have 230V at 50Hz.
There seems to have been a misunderstanding with the power supply: This is a 230V ac to 9v ac to measure the voltage curve. Of course I don't want to power my ESP with it.