ZMPT101B, powerfactor and current shown

Thanks Robert. Once again excellent write up and explanation. I will try and check what you proposed and report back.

You’re talking resistors of the current sensors, right? Which doesn’t make sense to me.
Silly me, I didn’t say that I use the “complete board” and not the transformer alone.

Do you want me to measure the resistors there?

I tried short circuiting the sensor’s input. This gives exactly the same reading as w/o current going through the line. Around 1.5A.

Swapping the reading of voltage and current didn’t change a thing. It’s exactly as before. With phase shift of 1.7 I get 0.82, no matter what.

That link tells me nothing useful, but worse, it is confusing me. This “Active Single Phase Voltage Transformer Module AC Output Voltage Sensor” seems to indicate that the output is a.c. (like a normal transformer) but this “Output signal: the output signal for the sine wave, the waveform of the median (DC component)” seems to say that the output is d.c. If it really is d.c, it cannot be used because the voltage input to emonLib is expected to be an exact sample of the mains a.c. wave. I need a circuit diagram to be able to know what the true action of the module is, and it would be far too difficult and time-consuming to derive it from the photos. It is certainly more complicated and has many more components than the circuit on the data sheet for the ZMPT101B.

If the output is d.c. but is not fully smooth, then your long settling time, your voltage calibration of 1300 and your inability to make the phase correction all start to make sense, because the filter is taking away the d.c., emonLib is measuring the ripple on the d.c. and that ripple is at 100 Hz and will be phase shifted relative to the mains wave.

That totally makes sense to me. I’m almost sure that this device outputs DC and not AC.
I just never thought about it, as I saw a lot of sketches that use that setup.

Just the first links on Google:

I will need to investigate more, and probable use the transformer alone, or rip off some parts of the PCB to make it output AC again.
You already helped me a lot! Much appreciated!

You sound more certain then me! If you look at Learn→Electricity Monitoring→Voltage Sensing→1. Measuring Voltage with an AC-ACPower Adapter→Measuring AC Voltage with an AC to AC power adapter, you can see what the emonTx/Arduino expects. In emonLib, to calculate real power, each pair of voltage and current samples are multiplied together to give the instantaneous power, and those instantaneous powers are averaged to give the average real power. At the same time voltage and current samples are each squared, those squared values are also averaged to give the rms voltage and current respectively.

If you rectify the voltage to give d.c. you can calculate the rms value because you know (or assume) the shape of the wave. But given the a.c. wave, emonLib calculates the true rms value whatever the shape.

My certainty is the main problem here :wink:. I guess to know everything just to find out that i know nothing. It’s for sure not the lack of reading as i have read all the links you gave.
I will start all over again and will surely solve it.

Try to check the circuit of your module against this diagram: problem with translate the values of voltage sensor ZMPT101B - Project Guidance - Arduino Forum
(from the bottom of problem with translate the values of voltage sensor ZMPT101B - Project Guidance - Arduino Forum)

All the resistors appear to have the same values as the photo. If it is the same, then the module DOES give an a.c. output exactly as you require (provided that the power supply is the same as the Arduino Mini - 3.3 V or 5 V), but you need to calibrate it as well as the sketch. You should have not more than 1.1 V rms out for a 3.3 V supply, or 1.6 V rms for a 5 V supply to your Arduino.

1 Like

Shame on me. First of all I ordered 100A type which don’t have the burden resistor inside. Then I switched to 50A types which have the resistor. Of course I didn’t change the PCB. So I can assume that CUR_CAL is 50 for that clamp meter. Correct?
Had a good read here as well: firmware for SCT-013-030 | Archived Forum

CUR_CAL is 50 for that current transformer with NO external burden resistor.

This is what by poor man’s shitty osci reads:

And the resitors do somehow resemble with the diagram you posted. Most of them are correct, but most of the 10k ones in the diagram are 5k ones on the PCB (well they are built in. Values (103) printed on them indicates they are 10k).

Both the Arduino and the ESP are powered by 5V from a AC/DC power supply connected to the same 220V AC as the voltage sensor. The 3.3V for the voltage sensor are taken from the Wemos D1 3.3V pin. All share common ground and VCC.

That does not sound right. The ZMPT101B module should give you a sine wave with an amplitude of 2.5 V centred on 2.5 V d.c. if your Arduino has a 5 V supply, so that you use the full range of the analogue input. But from what you write and that picture, you have the 3.3 V version of the ZMPT101B. The output of that can be no greater than 1.65 V amplitude centred on 1.65 V d.c., and you will only use ⅔ of the available range of the Arduino input. Though this is not ideal, it will work and the loss of precision will make little difference, but it does mean that emonLib will take a minute or two to settle.

And I do not like the high frequency superimposed on the wave. That should not be there.

I don’t think there is such a thing. Input is up to 30V if I can trust the description. But output will be altered by input I guess. So I will power it with 5V and see. The Arduino should be fine with 5V input anyhow.

You should power the ZMPT module from 5 V. When you do, it is likely that the high frequency instability will disappear.

That’s what I did. Much better result. And I now see the 2.5V. Also there is no “swing-in” anymore. I reboot the Arduino and it instantly shows the correct voltage.

If I set the PHASE SHIFT to -1.2 then I see a power factor of 1.00. With 1.7 it’s at 82%.

This is the oszi screen:

image

That is good.

Is that with voltage and current samples as originally written, or with the order reversed? Ideally, the number should be between 0 and 1, but -1.2 is OK (and yes, the default value is outside that range, but changing it would create a compatibility nightmare).

That is looking better. You might find that extra smoothing on the 5 V supply will reduce the high frequency ripples.

1 Like

The -1.2 is with sample order REVERSED. But i will try it the original way as well. You say, the ideal number is 0-1, but every sample I see uses 1.7. Why’s that? If “my” value is -1.2 is it ok to use it?

How would I smooth the 5V supply? I guess I should add caps to stabilize the voltage, right?

This still leaves one of the biggest problems open: Why is the current sensor showing (now with 82k resistors instead of the 10k ones) around 1A load, when it should show ZERO? The error gets less and less as current goes up, but especially at night when all three phases together should not exceed 300-500W, this can impose a HUGE error.

History.
If the order were to be reversed in emonLib, there would be less distortion and a much smaller change of amplitude of the voltage wave resulting from the phase shift algorithm.

Yes - it’s closer to the ‘ideal’ range then 1.7.

Yes, that would be my first move.

Which resistors do you mean?

As I wrote earlier, it is electrical noise that is finding its way into the ADC. Where it is coming from and how it is getting in is the real question. It could be on your mains supply and coming through the power supply to your Arduino, it could be generated inside the Arduino or from the Wemos and put onto the 5 V from there, and from the 5 V it could be getting in via the analog reference for the Arduino, or it could be coming through the ZMPT module. It might or might not be travelling on copper wires or p.c.b. tracks, it could also be inductively or capacitively coupled from one place to another close by.

Your oscilloscope pictures show a high frequency (approximately 1000 Hz) on the voltage wave. Where is that coming from? If it is also on the current wave, some if not all of it could be that.

1 Like

If I had a good way to read the 5V rail I’d do it. My oszi is not capable I guess.
I will try to rip everything apart, or build it new. Is it an issue if the arduino analog input wire to the sensor output is some cm long? Should it be shielded?
I also think that the resolution of the 50A sensor with (10bit?) resolution is around 28W @220V. So I can’t expect too much. Can I expect a ZERO reading at all?
The resistors I mentioned is the identical pair between GND / sensor / VCC. The ones that should be 10-470k.

With both the c.t. and the ZMPT module, the impedance of the circuit is so low that length - provided it is not really long, centimetres and not tens of centimetres, and screening should not matter.

Do you mean the current transformer? The value is not important when everything is mains-powered, and in many respect the lower the value, the better.

You don’t need those resistors for the ZMPT101B, because their function is performed by R4 & R7 on the module, which sets the quiescent output voltage to midway between GND & VCC.

You will probably never read a true zero, but you should get lower than 1 A. When you are calculating and reading real power, it will of course improve because you are not rectifying (in software), so the noise will tend to average towards zero. The effect of that is you have a low real power and a high apparent power, therefore a very low power factor.

1 Like