Current monitoring with ESPEasy

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
mattlward
Normal user
Posts: 70
Joined: 24 Jan 2018, 15:20

Current monitoring with ESPEasy

#1 Post by mattlward » 21 Feb 2018, 17:48

I would like to set up a simple current monitor using CT's for US 120 volt circuits. It does not appear to me that there are any tasks for this type of monitor... am I over looking something? Just starting to look at what and how to build it.

Example of CT:
https://www.sparkfun.com/products/11005

I would like to have the sensor non-invasive, otherwise a sonoff POW would work. This will monitor a sump pump and tell me if it is running, running with no load or off. The key is, did it get stuck on and is it running dry!

User avatar
Methuselah
Normal user
Posts: 45
Joined: 04 Feb 2018, 01:39
Location: Boston, MA

Re: Current monitoring with ESPEasy

#2 Post by Methuselah » 21 Feb 2018, 18:21

Along the same lines, how about voltage monitoring, e.g. the amount of voltage on a pin?
N00b to the world of ESPEasy, but I've been programming since the days of punch cards and paper tape :)

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Current monitoring with ESPEasy

#3 Post by Shardan » 21 Feb 2018, 18:38

Yes and no :)

This sensors - depending on type - give back an analog current or voltage.
Usually it is a current, seems to be the case with this sensor too.

It delivers an AC current so there is no possibility to connect it directly to the ESP,
some additional electronics is needed.
Stromwandler_Verstaerker.png
Stromwandler_Verstaerker.png (3.72 KiB) Viewed 8196 times
I've tried this circuit. The Resistor R1 is the load for the current provided from the sensor.
It should be adapted accordingly to the datasheet of the sensor, usually values between 10...100 Ohm.
Do NOT use standard diodes like 1N4148, the schottky diodes are used for a reason.

The Opamp amplifies the voltage delivered from the sensor circuit. Depending on the sensor
and the value of R1 it might be necessary - or not. As the ESP can take a voltage from 0....1V max it
might be possible to feed the rectifier output (connection R3-C2) directly to the ESP.

One disadvantage: This circuit tends to be a bit laggy, it won't show current spikes, short raises or drops of current.
For your purpose this should not be relevant.

Voltage monitoring:
The ESP has one analog input so you may measure voltage (DC 0...1V) from one source.
Voltage and current together same time - no.

Metering mains AC is a more complex thing. This is possible basically by rectifying mains voltage
and divide the voltage down to 0..1 V. This has two disadvantages:
First this isn't much precise as the analog --> digital converter has a resolution of 1024 steps from 0..1 V.
Second and important - this will set your whole circuit to mains voltage - this is dangerous.

If you want to calculate power consumption this will need much more effort. With AC it is not
simply Watt=Volt x Ampere. You will have to meter the phase shift between voltage and current
to caluclate the cos phi factor. For this i'd recommend using a simple power meter with
counter output ("S0 out") and just count the counter pulses with an ESP.

Regards
Shardan
Regards
Shardan

mattlward
Normal user
Posts: 70
Joined: 24 Jan 2018, 15:20

Re: Current monitoring with ESPEasy

#4 Post by mattlward » 21 Feb 2018, 18:43

This is what I am looking at building... but on a Wemos D1.

http://www.homautomation.org/2013/09/17 ... d-arduino/

Shardan, what are you thoughts regarding that circuit? I realize that it will not be super accurate since there is no voltage reference. But, if I can detect an amp or 1.5 amp difference I should be golden!

mattlward
Normal user
Posts: 70
Joined: 24 Jan 2018, 15:20

Re: Current monitoring with ESPEasy

#5 Post by mattlward » 21 Feb 2018, 18:59

Might be better to use full size arduino and build a voltage divider to sample mains voltage as well as current. So maybe a arduino with ESP built in.

Domosapiens
Normal user
Posts: 307
Joined: 06 Nov 2016, 13:45

Re: Current monitoring with ESPEasy

#6 Post by Domosapiens » 21 Feb 2018, 20:18

And how about this one? A DC version:

Image

https://nl.aliexpress.com/item/YHDC-SCT ... 03007.html

With a 100KOhm in series, connected to the analog port, should do the job?
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Current monitoring with ESPEasy

#7 Post by Shardan » 22 Feb 2018, 16:39

... wich is no DC version but a version with rectifier....
Regards
Shardan

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Current monitoring with ESPEasy

#8 Post by Shardan » 22 Feb 2018, 16:47

mattlward wrote: 21 Feb 2018, 18:59 Might be better to use full size arduino and build a voltage divider to sample mains voltage as well as current. So maybe a arduino with ESP built in.
Detecting 1..3 Ampere shouldn't be a problem at all.
Use the sensor you showed above, the circuit shown in my earlier post ... i'd try first with breadboard to get the right RL value and
see if the opamp is necessary at all. As far as i've seen from the datasheet the RL is rather low, 10 Ohms.
It might be necessary to use a bigger one to get a full scale.
If you configure this circuit to a max of 3A it will give an accuracy around 5..10 mA - quite good I think.

Connecting mains to an arduino for metering is same problem as mentioned above - you will get a direct connection from mains
to the arduino - I don't think that's a good idea.
Regards
Shardan

Olfried
Normal user
Posts: 11
Joined: 05 Nov 2023, 21:49

Re: Current monitoring with ESPEasy

#9 Post by Olfried » 05 Nov 2023, 22:06

I just posted a nice solution for connecting a SCT-013-013 current transformator to ESP Easy WITHOUT sampling the whole input.

viewtopic.php?t=9894

Rob73
Normal user
Posts: 30
Joined: 25 May 2022, 15:05

Re: Current monitoring with ESPEasy

#10 Post by Rob73 » 10 Nov 2023, 02:15

The PZEM-004T modules are a nice option for current and voltage monitoring.

Rob

Post Reply

Who is online

Users browsing this forum: No registered users and 34 guests