Elektroda.com
Elektroda.com
X

Analyzer - meter of 230VAC network parameters - single phase.

futek2 9183 114
This content has been translated flag-pl » flag-en View the original version here.
  • Analyzer - meter of 230VAC network parameters - single phase.

    Hello, interested in building a simple analyzer - meter of 230V network parameters - single phase.
    The meter is based on the ESP32 module according to the diagram attached, and the whole system is not complicated.

    You will need the following parts to build the meter:
    1 - ESP32 DEVKIT V1 module with 4 MB memory, as in the attached picture;
    2 - current measurement sensor - current transformer for the range of 100A with 1V output or for the range of 25A with 1V output type SCT013, as in the attached picture;
    3 - voltage measurement sensor - voltage transformer type TV16, as in the attached picture;
    4 - 5k precision potentiometer - 2 pieces, as in the attached picture;
    5 - 230VAC / 5V 0.7A power adapter or charger with mini USB plug to power the ESP32 module, as shown in the diagram;
    6 - universal mounting plate;
    7 - resistors and capacitors as in the diagram;
    8 - test leads and tips as in the picture of the whole meter.


    It's important to buy a converter
    current, please choose the type that has a 1V output


    I bought all the elements on a well-known auction site, and the total cost did not exceed PLN 150.
    Attached are two versions of the software to be uploaded to ESP32. The difference is that one is for a maximum range of 25A, and the other for 100A, depending on which current transformer we buy.

    The meter measures and displays the shifts of sinusoidal voltage and current waveforms relative to each other. Calculates COS fi, and in case of detecting the inductive factor, calculates the capacitance of the capacitor to compensate for it.
    In addition, it is possible to calculate the THD factor from the measurement of voltage or current with graphs showing harmonic levels - max 9.

    Results and graphs are displayed on the screen of a phone, tablet or laptop.
    Connection with the meter via Wi-Fi, and the meter has the IP address 192.168.10.1 - picture attached.
    The program can be tested immediately after uploading to the ESP32 module without the need to build the entire meter.
    Pictures from subsequent screens and the appearance of the meter are attached.

    I do not describe too much, because the construction is simple, which even a novice electronics can handle.
    All calculations are contained in software, which was not easy for me, especially with counting and measuring harmonics - I wanted to make it legible and give accurate results.
    The screens with the results are refreshed every 5 seconds, and the graphs are plotted using the vector graphics function - SVG.

    After building the meter, calibration is performed with precision potentiometers.
    I calibrated using 2 kettles of 2000W and a digital meter, which is enough to set the voltage and current range as indicated on the meter.
    After calibrating, mark the voltage terminal that will be connected to the neutral conductor and the other terminal that will be connected to the phase conductor.

    And after putting the current sensor on the phase wire, put it on so that it is in front of the connected voltage wire on the phase.
    Connection of the meter to the 230VAC network in the sketch drawing attached.
    And when we make sure that the COS fi measurement is correct, you need to mark with a marker the direction of attaching the current sensor to the cable.
    I determined this by disabling all pickupselectricity, and leaving the desktop computer and the meter should show the capacitive power factor, if inductive, I will change the direction of the sensor's fastening.
    To be sure, you can do a few tests on other devices, e.g. on the motor, and it should show an inductive power factor. When calibrating with kettles, the power factor should be close to 1.

    As the housing of the meter, I used the housing of the laptop power supply.

    The meter has the ability to update the software without the need to remove the ESP32 module, you can upload the new soft via WIFI using the browser from the address 192.168.10.1/new when the login window appears, user admin password admin , and then select the correct bin file and wait for the message about successful firmware upload.

    The inspiration to design and build the meter and write the program code was this article from a few years ago - link below:
    https://majsterkowo.pl/rejestrator-napiecia-pradu-mocy/

    I am asking for any comments and suggestions for improvement or changes.

    Greetings and I wish you satisfaction with using the analyzer - a meter of 230 V single-phase network parameters.

    In conclusion, I propose to calibrate the current measurement using 75% of the range. For 25A, I used two electric sensors, 2000W each, because the measurements will be more reliable.

    I think many colleagues will see what is going on in our home electrical networks, which will contribute to reducing electricity costs.

    Update - software 10/28/2022
    For both versions, a scale has been added - horizontal lines for THD graphs.
    Increased number of decimal places for voltage and current.


    Update - software 07/11/2022
    A configuration window has been added so that you can connect to your home router and send data to the server.
    link below
    https://www.elektroda.pl/rtvforum/viewtopic.php?p=20261095#20261095


    Update - software 24/11/2022

    Description and programs to upload firmware to ESP32.
    https://www.elektroda.pl/rtvforum/viewtopic.php?p=20300780#20300780

    Regards
    Futek2

    Cool? Ranking DIY
    About Author
    futek2
    Level 19  
    Offline 
    futek2 wrote 476 posts with rating 204, helped 2 times. Live in city Częstochowa. Been with us since 2006 year.
  • #2
    gulson
    System Administrator
    Great, once I bought a few pieces of it, I didn't know that you can do such wonders with it. By the way, contact me on PM for a small gift for the article ;)
  • #3
    simw
    Level 26  
    Great mini project - though maybe not that mini :)
    I don't see anything about kilowatt hours in the pictures. It seems that everything is already done to additionally make an energy meter.
  • #4
    futek2
    Level 19  
    Hello Col. simw .
    Thank you for the hint when I find some free time to add another version with energy counting in kWh. It is easy at this stage because all measurements are already made by the meter.
    I encourage you to test it on the sofa itself without mounting. and this will then encourage you to build the whole meter.
    I have an interesting observation from the measurements of various devices, mainly desktop computers, because they emit a lot of harmonics, but I also have interesting observations on LED bulbs and the operation of an automatic washing machine, especially when it spins.

    Regards.
    Futek2
  • #5
    jarekgol
    Level 33  
    futek2 wrote:
    I also have interesting observations on LED bulbs and the operation of an automatic washing machine, especially when it spins.
    triac controller?
  • #6
    Shadowix
    Level 31  
    How is the quality of these measurements?
    Have you compared them with a decent meter/meter?
    The webserver is on ESP or is it sent to some MQTT database?
  • #7
    ^ToM^
    Level 41  
    A very practical device! Congratulations on your ingenuity.

    I think maybe we could add a grid and scale to the graphs. It's best to be able to turn it on and off. It is then easier to compare waveform sizes.
  • #8
    snow
    Level 31  
    In the diagram with ESP, I would change the description with the 5VDC power supply on the output not +5V and -5V, but +5V and GND. Or some other way. This power supply does not output -5V.
  • #9
    futek2
    Level 19  
    Hello.
    I answer in turn.
    I had the opportunity to compare the meter with the measurements of the company meter PQM-707 by Sonel.
    The differences in the indications were at the level of about 1.5%, but it depends on the accuracy of the calibration.
    The THD calculation is also within these limits.
    And as for graphs and sending measurement data to the server, e.g
    https://thingspeak.com there is such a version in preparation, but it will require individual configuration of logging in to the home router and server data to which the measurement results will be sent.
    And as for the mesh, it's not difficult to add, but I didn't want to send too much data to the website, which could slow down refreshes. But I am collecting all comments and when the next version is created, I will take into account the suggestions of my colleagues.

    According to the remarks of snow I will correct the schematic.

    I am asking for comments related to the calibration because in the program code I made a certain reserve for possibly different parameters of the purchased transformers so that they fit in the adjustment range of precise potentiometers.

    The meter has already proven itself when setting the regulator parameters in the transmitting inductive reactive power compensator.

    Regards.

    Futek2
  • #10
    __Maciek__
    Level 20  
    Congratulations !
    I wonder if the introduction and measurement of the artificial zero voltage (3.3V/2) makes sense? From openenergymonitor sources, they use a low-pass filter to determine this artificial zero.

    In addition, I believe that the dynamics of the input signals is large enough to successfully use constant input elements and software calibration. (There is no question of different batches for different ranges.) PS. the shunt for the current transformer is usually small 5K is a lot and can lead to increased errors in the upper measurement range.

    Plus for the use of a voltage transformer. (I did without it, but I'm not happy with it in terms of potential risks.) Analyzer - meter of 230VAC network parameters - single phase.

    An important element is the comparison with reference indications. (At first I wanted to calibrate my measurement with a hair dryer - but I had terrible non-linearities - it turned out that the load characteristics it was doing were very different from sine - and comparisons to non-RMS meters were useless.)
  • #11
    futek2
    Level 19  
    Hello Col. __Matt__ .
    Choosing this option with a reference voltage of 3.3V /2, I was guided by the parameters of the ADC converters in ESP32. Their parameters are not in the full range linear beginning and end are slightly flattened.
    In the code, I corrected this defect of the ESP32 converter, it is not difficult to implement because someone has already developed an appropriate library.
    And since the measurements are not performed on the full range, especially in the middle of the herds, the reference voltage is 3.3V / 2 because it can be assumed that the maximum values do not exceed these maximum values and the lower minimum ones.
    When calibrating the transducer, however, you need to give a maximum voltage of 230VAC and for a current of at least 20A, it is so programmed in the conversion parameters that the voltage of 350V is correctly measured and the current of 28A is already underestimated by about 0.2A.
    There is a description of this linearity in the link below
    https://github.com/e-tinkers/esp32-adc-calibrate

    I believe that ESP32 for such a simple system has good parameters and counting speed because I sample measurements every 300us so that the graphs are smooth and the calculations are quite accurate because there is something to average, there is also a lot of calculation for harmonics because furier function libraries are used.
    And the program code is over 700kb.
    I may change something, but I tested it for a long time and I am convinced that many colleagues will be satisfied if they decide to build this meter for such a small amount of money.
    Regards.
    Futek2
  • #12
    shimano73
    Level 12  
    Hello, I wanted to download these packages but they have probably been deleted, at least that's the message I receive
  • #13
    futek2
    Level 19  
    Maybe it was when I updated
  • #14
    Janusz_kk
    Level 37  
    I downloaded the code and there is a bin, so we have an advertisement again or a substitute for the project because the author is ashamed of his code.
  • #15
    kris8888
    Level 38  
    I have a question why on most of the attached screenshots the apparent power expressed in VA does not exactly coincide with the product of the current and voltage values?

    Similarly, multiplying the given apparent value by the power factor does not give active power?
  • #16
    __Maciek__
    Level 20  
    @futek2 That's not what I meant in terms of 3.3V/2. (I know that the ADC in ESP32 leaves a bit to be desired) rather why are you measuring - I think so based on the diagram, and you don't use a low-pass filter - is there any purpose for it (maybe to speed up calculations, but probably marginal, unless you use math on floats does the transducer noise negatively affect the measurements?)

    https://learn.openenergymonitor.org/electricity-monitoring/ctac/digital-filters-for-offset-removal

    @Janusz_kk I'm not surprised there and I understand the author, it's intellectual property, he shares part of his work - if you have questions about the details, ask, I think you'll get an answer. Today too many people count on everything ready served on a plate. I don't think that's the way. The author showed a lot of his work anyway and that should be appreciated. Perhaps, as he refines the code, he will share it, for example, on Github / in this thread .. but it's only his good will and it should be respected.
  • #17
    khoam
    Level 42  
    Janusz_kk wrote:
    I downloaded the code and there is a bin, so we have an advertisement again or a substitute for the project because the author is ashamed of his code.

    I also don't like it a bit, especially since the Arduino libraries he used are under the LGPL license. They too were "served on a plate" and are someone's intellectual property.

    futek2 wrote:
    I believe that ESP32 for such a simple system has good parameters and counting speed

    How did you deal with the noise on the ADC input (quite a common problem) and the calibration of the ADC itself (the characteristic is non-linear)?
    link
  • #18
    futek2
    Level 19  
    Responding wheels. kris8888 is to inform you that the calculations are exactly done. But I send the results on the website with one decimal place. But if you have such a wish, then at your request there will be an accuracy of 3 decimal places for current and 1 decimal place for voltage, then the rest will agree. No problem.
    Maybe trying to simplify the design too sparingly I did some things.
    But it's nice to read comments to improve the project according to the wishes of colleagues.
    Please confirm whether or not I should make a correction?

    Futek2
  • #19
    kris8888
    Level 38  
    Well, but it's not about the decimal places, because even taking the data from the first discharge where we have U=236V, I=10.4A, the apparent power should be 2454 VA and it is given as 2452 VA. In turn, even assuming these 2452 VA, multiplying by the power factor of 0.93 should give 2280W. A is 2289W. In other screenshots, these discrepancies are even greater.
  • #20
    futek2
    Level 19  
    Col. kris8888 you say, and you have.
    No problem is also update each version.
    I think I would leave the rest of the results because it's not a laboratory after all.

    Regards.
    Futek2
  • #21
    kris8888
    Level 38  
    futek2 wrote:

    I think I would leave the rest of the results because it's not a laboratory after all.

    Well, not really, but if you want to use this device for, for example, counting active energy, then every watt matters and it's better not to round the intermediate values too much.
  • #22
    jarekgol
    Level 33  
    @kris8888 2 at 2454 is 0.08% is there anything to fight for? And I suspect that the input data is worse than 0.08% anyway
    @futek2 nice design and familiar casing :) Is this transducer in the hall or does it have coils inside? Where did you buy it? because there are others on Allegro. Why are there 2 zips of the same size?
  • #23
    khoam
    Level 42  
    jarekgol wrote:
    2 at 2454 is 0.08% is there anything to fight for? And I suspect that the input data is worse than 0.08% anyway

    In addition, the ADC accuracy in ESP32 is 3%. After calibration with LUT - maybe it will reach 1%.
  • #24
    TechEkspert
    Editor
    Great idea and execution.
    Maybe it will be possible to observe the influence of the nearby PV on the grid voltage?
    With a better frequency standard, the grid frequency stability could also be investigated.
  • #25
    shimano73
    Level 12  
    Very nice project, I can't wait to test it. How will it behave in the grid to which the photovoltaics and the fronius inverter are connected. I would be interested in a version with 3F and the ability to connect to a home WiFi network. I am considering mounting other current transformers on a smaller pcb board with an input current of e.g. 30A and enclosing everything in a housing mounted on a din rail, e.g. D3MG or D4MG and if I put some small tft after i2c there, ehh but I dreamed :) . I have a 15kW electric central heating furnace and 9kWp panels, so I have something to test :) My friend does not share sources, he respects them, but with their help I could manage my needs.
  • #26
    Dariusz Goliński
    Level 22  
    And I like this project very much.
    I would add the ability to dump measurements to a file for later analysis in lexel.
  • #27
    futek2
    Level 19  
    Hello colleagues interested in the description of the analyzer - a measure of network parameters.
    Thank you all for your opinions and suggestions for improvements, some I've already done, some require more input in writing the code.
    But no one has done this measure so far, so there is no point to discuss the results of the measurements.
    I made a small change in the graphs with harmonics is that the harmonic bars are higher than the actual calculations to make them more clearly visible because without this correction when they were from the actual calculations they had low levels. And I did it by squared the calculations taken to plot the graphs,

    Having this meter, I have already made further measurements, especially with my PV. And so the PV operation brings the power factor close to 1 (about 0.98) but the meter shows that the COS has changed to the opposite because the direction of the current flow has changed, but the shapes of the graphs have improved significantly.
    The changes took place on the THD charts to the advantage.
    In summary, the inverter of the PV installation improves the shape of the sine wave of voltage and current, so it can also be said that it improves the power factor to close to 1.

    Another test on a single-phase motor at a branch chopper. The engine has a power of about 2kW and when it starts to spin, it starts to generate inductive reactive energy, which the meter shows and calculates the capacitor, and it was 45uF. This factor changed to a small extent when I was grinding the branches. I connected in parallel to the cable that powered the shredder motor and the meter - the analyzer was at home fastened in the box on the same phase as the connected shredder.
    And what I noticed was that the power factor improved, it approached 1 (0.98) and at the same time the current consumed decreased by about 1.2A, which was shown by the analyzer meter, but not trusting, I took a digital multimeter and the meter showed the same - a decrease in current by the same value.
    I leave this experience without comment because maybe someone will do a similar experiment and the result will be similar.

    In the near future, I plan to do similar tests with other engines, such as from the central heating circulation pump or an automatic washing machine and even a refrigerator.

    Because maybe we do not realize that it is possible to reduce electricity consumption by at least a few percent by compensating for inductive reactive power.

    I also had the opportunity to make measurements where the 40kVar inductive reactive power compensator works and the test was a very simple measurement when it works - the compensator is turned on when the devices are turned on and when turned on when the devices are working.

    Similar effects, only a larger current difference on the main power cable and a deterioration of the inductive power factor of 0.68.
    Attached are a few photos where you can see how many capacitors are connected - the LED strip on the right.
    I think it's something to think about.
    Regards.
    Futek2
  • #28
    amigo71

    Level 13  
    Janusz_kk wrote:
    I downloaded the code and there is a bin, so we have an advertisement again or a substitute for the project because the author is ashamed of his code.

    Thank you for letting me know, I was about to download it to experiment a bit.
    I can buy it ready-made on alle **o, but it's no pleasure.
  • #29
    Janusz_kk
    Level 37  
    If I want to 'copy' once or twice, bin is enough for me, and I just wanted to see in the code how the author solved some things, because even without doing anything similar, but analyzing the code, a person learns and draws conclusions by building something else.
  • #30
    metalMANiu
    Level 20  
    But my colleague wanted to show off only the idea and execution, not the whole code