First post here, and hope I’m not out of scope.
I’m building the energy monitor as per
that is based on emonlib for the calculations.
I’ve build it but I’m facing a problem that seems to be almost common but unsolved.
If I run the code ( on the board ) without any circuit connected, I get a good 0 as reading, and that is expected.
If I connect the “classic” circuit, with the voltage divider, capacitor and burden resistor I get a reading of 20 to 50 W which is unexpected.
The scaring part is when I connect the SCT-013-000. In this case, usually ( but not always ) I get a reading of 150 to 200W, without even clamp the CT to a cable, and that’s quite a bit of reading and can give false value on CMS or similar ( at the moment I’ using HomeAssistant but planning to change ).
If I clamp the CT to a cable with a high load reading seems fine,or at least in sync with my efergy monitor.
So my question is : is there a way to get more reliable reading ?
May a circuit not build on breadboard but on a printed circuit board be more effective ?
To add more infos, my divider is based on 2x10K 5% resistor, a 10mf 16V electrolitic capacitor, a 62 ohm (but realized with several resistor as I have not a 62 resistor around ) as burden and a 0.1 mf ceramic in parallel with burden as per https://www.casler.org/wordpress/low-current-measurement-performance-of-the-sct013/#Filter_Capacitor_Needed
Thanks in advance.
Pigi ( from italy )
Welcome, Pigi, to OEM.
I have answered this question many, many times. Most likely, your problem is noise. This seems to be a bigger problem and happens more often when someone uses a “breadboard” or prototype board construction. You don’t say if you are using an Arduino or something else, but assuming it is an Arduino, the noise might be coming from the power supply you are using. I am told that using the “barrel” connector and a 7 - 12 V d.c. supply is usually better than 5 V. We think the noise is being injected onto the ADC reference voltage, which is the 5 V of the Arduino. If the noise is not coming from your power supply, it might be generated by the processor itself and the digital switching that goes on inside it. I suggest you look at Atmel’s Application Note AVR465: Single-Phase Power/Energy Meter with Tamper Detection, you will see it uses the internal 1.1 V reference and the AREF pin is carefully decoupled to earth. As far as I know, no Arduino does that.
The link you provide mentions an ESP32. That has a very poor ADC and we do not recommend using it. See [TW#12287] ESP32 ADC accuracy · Issue #164 · espressif/esp-idf · GitHub
Remember that when you are using a 100 A c.t., you have a very small voltage - 100 W load gives you a voltage into your ADC of about 5 mV rms, therefore you must be very careful with the layout, with shielding and earthing, to make sure that no digital signals share an earth with the analogue signal you are trying to measure.
Your problem will be worse if you are only calculating r.m.s. current, because the noise will be rectified by the maths and added to the wanted signal, rather than largely getting cancelled out, which is what happens when you also measure voltage and calculate the real power.
Robert, first of all thanks for taking the time to answer me !!! I really appreciated.
Unfortunally I’m not an expert in those things, just a passionate diy-er so most of technical dicussion are quite hard to understand, but yes, I’m on the road of learning and will .
As per your questions ( advice ? ) yes, I’m using esp32 or more exactly a chinese version called “NodeMCU ESP32 OLED Module” or also “Wemos LOLIN32”, exactly as per link because of the nice oled display embedded, but it would ( should ) not be a problem to replace it with something other.
The nice things about the project in link, that made me choose it are:
- The nice oled display
- The code and instruction somewhat well documented
- All the nice stuffs to create and AWS IoT and an homeassistant.io MQTT endpoint.
More interessed in the latter than the former, but good to have both.
- The use of FreeRTOS.
I have used, in my tests, a battery connected to the project ( a powerbank for mobile phones ) to eliminate every problem with bad power supply, so I think the problems arise from the ESP board itself, as indicated in your link. Not that I have full understood what’s inside this link, but I will try to read again and again until I understand it
The “external circuit” is indeed on protoboard per semplicity and my suspect are exactly what you mention. Noise somewhere. I’m also thinking to change the CT to a “smallest” one, as 100A are really exaggerated for an home. It looks promising the SCT006 that should top at 20A so maybe could give a better resolution in a home environment. What do you think ?
Being that I’m quite good at coding ( not for this board but I’m used to be a PC programmer for a while ) I wouldn’t mind to change the board, if you have some good advise for it . It would be interesting to convert this code for other boards, but I would really be in the open part ( I mean Arduino or similar ) unless you advise differently.
Thanks again for your time .
Not true - that is on a 60 Hz mains supply. Look at my test report in ‘Learn’ to see what happens at 50 Hz, which is what you and I have - they are really only good to 16 A. If you want more than 16 A (~4 kW), these are worth looking at: https://uk.rs-online.com/web/p/current-transformers/7754909 or /7754903 or /7754912 but I have not tested one.
You can, if it is possible, use a multi-turn primary winding for your c.t. - 5 turns with the 100 A c.t. will make it into a 20 A one.
I do not have an ESP32, so I cannot test one, but there are many reports that the ESP8266 and the ESP32 have poor ADCs. Analogue and digital inside the same 1 cm² is hard, and unless you are very good with keeping them apart, you will have a noise problem. I suggest you try two capacitors across 3.3 V & GND, as close as possible to the module. One will be a large electrolytic, say 100 µF, the second in parallel a 0.1 µF ceramic or plastic film. Those might help. If the analogue section has a separate power pin, then do the same with that.
Also worth reading: https://www.espressif.com/sites/default/files/documentation/esp32_hardware_design_guidelines_en.pdf
This applies to the ESP32, not the ESP32 Module. If the module does not follow the recommendations, then you must expect problems.
Very interesting document, Robert.
I’ve looked also at your CT recommendations but it seems they are missing the protection diode, or at least that’s what I understand reading the docs.
At the moment I’ve attachet the clamp and have both the efergy and my esp32 experiment on lines to check.
Unfortunally ( or luckely, it depends ) In my home I always have a constant load of at least 350/400W that I suspect comes from fridge and other appliances, so I’m out of critical reading.
This will let me try the stuffs while I read and study more to find a way to get better reading. I will probably buy some other hardware like arduino or even emontx or eventually another esp32 to try your suggestions for capacitors.
Thanks for the moment.
I’ll keep you informed.
Yes, they are. But they also come without a plug, so you could easily put a pair of diodes if you need a plug, but if you’re using screw terminals, there isn’t really a problem - just isolate the circuit, disconnect and short the wires if you need to remove the burden.