Page 1 of 1

incorrect voltage on a Sonoff S31

Posted: 10 Aug 2023, 23:45
by dbemowsk
So I just flashed a Sonoff S31 with ESP Easy. When I initally configured the CSE7766 power monitor and was checking the values returned, it was showing around 119 volts. Now the voltage being shown is over 900 volts. Do I have something configured wrong that it is showing that high of a value for voltage??

Image

Image

Let me know if there is any other infformation you need from me to figure this out.

Thanks

Re: incorrect voltage on a Sonoff S31

Posted: 11 Aug 2023, 01:09
by TD-er
Can you clear the U ref, I ref and P ref fields and save?
This will load the calibration values again from the chip.

If the values are still the same, you need to perform a calibration of that unit as the board you have is probably not using the same resistor values as mentioned in the datasheet of the CSE7766.
The calibration values are from the manufacturer of the chip and based on the resistor values mentioned in the datasheet.
Is Sonoff decided to use different values, the readings may be off quite a lot.

What build are you using?
I have spent quite a lot of work on that plugin in the past few weeks, so if you use one of the latest GitHub Actions builds, you will use the latest code for that plugin.

If you need to open up the unit to upload a new version (e.g. when it is using a 1M flash chip), please have a good look at the resistors connected to mains voltage pins, to see if some got damaged and thus offsetting the measured voltages.

Re: incorrect voltage on a Sonoff S31

Posted: 11 Aug 2023, 01:48
by dbemowsk
Ok, so I cleared those values and saved. This is the values it showed immediately after the save.
Image

After I close out to the devices list and go back to editing the device again, the U Ref stays the same, but the I Ref and P Ref change.
Image

This is what I see though after the U, I and P Ref numbers were updated. Not sure how they changed in the first place, because when I first got this configured, it was showing a voltage of 119 volts or there about, which I thought was fairly normal. I diddn't look to see what those values were after the initial install, but they clearly had to have changed.
Image

Re: incorrect voltage on a Sonoff S31

Posted: 11 Aug 2023, 15:06
by TD-er
Those '1950' etc. values are the 'defaults' I use in the plugin.
When the plugin is initialized and it finds the defaults, it will read them from the chip itself.

Maybe it is best to save it once more, now the calibrated values are read from the chip, to make sure it isn't the same as those "default" values.
Then it won't read the calibrated values again.

My theory is that it perhaps did read the wrong values, or values to mixed up with data still in the buffer from the serial port at boot.

Re: incorrect voltage on a Sonoff S31

Posted: 12 Aug 2023, 17:24
by dbemowsk
OK, so it appears that the U Ref value keeps changing every so often. You can see here that it is now a negative number. The other numbers stay constant as the I Ref sand P Ref at 16345 and 5362 respectively have not changed from the last screenshots I sent. Only the U Ref has changed.
Image

You mentioned the 1950 values are ones that you put in initially. When I clear the U Ref value, it reverts to the 1950 value and gives me what looks to be a fairly normal reading. It appears to keep that value for a number of hours. I check it at random times and i'll see that all of a sudden the number has changed. Is there a way for me to do a calibration and write the new values to that chip myself?

Re: incorrect voltage on a Sonoff S31

Posted: 12 Aug 2023, 18:12
by TD-er
You can call the calibration command for that plugin.
See: https://espeasy.readthedocs.io/en/lates ... -available

Re: incorrect voltage on a Sonoff S31

Posted: 12 Aug 2023, 18:31
by dbemowsk
Thank you. I will look that over and figure it out. Any ideas on a good resistive load to use?

Re: incorrect voltage on a Sonoff S31

Posted: 12 Aug 2023, 20:05
by TD-er
An old fashioned light bulb as it also lists a power rating.
Otherwise some soldering iron which is working on mains voltage (not one with a transformer)

Re: incorrect voltage on a Sonoff S31

Posted: 12 Aug 2023, 23:55
by dbemowsk
So would I call it like this:

V=voltage
I=current
P=power

http://[IP_of_unit]/control?cmd=secalibrate,V,I,P

Re: incorrect voltage on a Sonoff S31

Posted: 13 Aug 2023, 00:31
by TD-er
But then with the correct order of letters in the command name :)

For 234.5 Volt, 1.5 A:

Code: Select all

csecalibrate,234.5,1.5
N.B. the parameter separator is a comma (,) and the decimal separator is a dot (.)

Re: incorrect voltage on a Sonoff S31

Posted: 13 Aug 2023, 05:44
by dbemowsk
You had asked earlier what build I was running.
Image

Re: incorrect voltage on a Sonoff S31

Posted: 13 Aug 2023, 09:47
by Ath
That is a not so up-to-date build, please get a very recent build from here: (see below)
Or by disconnecting from mains power, and hooking up to USB-serial and flash from Chrome or Edge using the Web-flasher: https://TD-er.nl/ESPEasy/latest

Edit: removed link

Re: incorrect voltage on a Sonoff S31

Posted: 13 Aug 2023, 10:49
by TD-er
With one side note....
In that build, linked by Ton, there was still a bug for exactly this plugin you're using.
So please use this build: https://github.com/letscontrolit/ESPEas ... 5834419140

I will merge that PR and also update the web flasher, but that may take me some time....