SCT013 Current measuring with esp

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
har
Normal user
Posts: 14
Joined: 23 Nov 2015, 14:49

SCT013 Current measuring with esp

#1 Post by har » 11 Jan 2016, 15:28

Hello,

I have a CT for measuring current, type SCT013, voltage output type.

And I was wondering if the analoge input of the ESP can be used for this purpose?

And if yes what is the best way?
regards
Har

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: SCT013 Current measuring with esp

#2 Post by costo » 11 Jan 2016, 15:56

The answer is NO.

This is an AC current transformer which has an AC output.
Analog input of ESP can do nothing with a 50/60Hz AC signal which comes from STC013.
The output state of ESP would be undefined, varying values.

You could add a detector circuit to make a DC voltage which is more or less an indication of the amount of AC current.

har
Normal user
Posts: 14
Joined: 23 Nov 2015, 14:49

Re: SCT013 Current measuring with esp

#3 Post by har » 14 Jan 2016, 11:19

Thanks for the answer.

I left the idea and change to a http://www.ebay.de/itm/111871746810 (XTM18SA series energy meters)

With this I can use a Pulse counter.
There a have 2 options:
1) Use a pulse counter with LDR.

2) The measuring unit can give pulse if connected to a 5V line. That would be the nice way if it would not be 5 volt. What would be the best way to convert it to 3,3 volt for the esp, a level shifer or divider with resistors?

kínd regards and thanks
Har

VasilijHCN
Normal user
Posts: 18
Joined: 08 Oct 2015, 18:02

Re: SCT013 Current measuring with esp

#4 Post by VasilijHCN » 15 Jan 2016, 08:18

I use XTM18SA meters, i can not see current, but power meter working great in domoticz, using 3.3v for pulse reading(S0 pins).
Connect ESP8266 gpio2 to pulse S0 directly, without any resistors to 20&21 connectors.

har
Normal user
Posts: 14
Joined: 23 Nov 2015, 14:49

Re: SCT013 Current measuring with esp

#5 Post by har » 15 Jan 2016, 10:12

Thanks
Thats great to hear it works with 3,3 Volt. :D

regards
Har

mkotek
Normal user
Posts: 116
Joined: 15 Dec 2015, 10:58
Location: Lomianki, Poland
Contact:

Re: SCT013 Current measuring with esp

#6 Post by mkotek » 15 Jan 2016, 11:18

VasilijHCN wrote:I use XTM18SA meters, i can not see current, but power meter working great in domoticz, using 3.3v for pulse reading(S0 pins).
Connect ESP8266 gpio2 to pulse S0 directly, without any resistors to 20&21 connectors.
When you are saying - connect directly, I understand, one needs to connect GPIO2 to connector 20 or any other way?
Michal 'Kotek', greetings from Poland. Zapraszam na mój blog o automatyce domowej po polsku: http://www.ukotka.com.

VasilijHCN
Normal user
Posts: 18
Joined: 08 Oct 2015, 18:02

Re: SCT013 Current measuring with esp

#7 Post by VasilijHCN » 15 Jan 2016, 12:22

i dont remember exactly 21 or 20, one to GND, other to GPIO2, if u connect this wrong nothing happens - u not destroy esp not power meter. try connect, then watch in web interface i pulses are counting, if not working change connection(swap wires) 20 with 21.
Be careful on AC live circuits, also remember change pulse count per kWh in domoticz settings.(2000 i/kWh in my case)

har
Normal user
Posts: 14
Joined: 23 Nov 2015, 14:49

Re: SCT013 Current measuring with esp

#8 Post by har » 15 Jan 2016, 22:35

That last remark raised another question.
I have already a power meter with 1000imp/kWh . when I as another with 2000imp/kWh it will show a double value.
Can espeasy the calculation option be use for counters?
Regards
Har

VasilijHCN
Normal user
Posts: 18
Joined: 08 Oct 2015, 18:02

Re: SCT013 Current measuring with esp

#9 Post by VasilijHCN » 18 Jan 2016, 07:26

I also use 1000 and 2000 imp/kWh power meters, for me espeasy formula not working in pulse counter, in domoticz i set 2000 power meter as water counter, changed pulsecount to 2000 for water. Now domoticz counters can not set separately pulsecount for each counter.

DeNB3rt
Normal user
Posts: 120
Joined: 15 Dec 2015, 14:07

Re: SCT013 Current measuring with esp

#10 Post by DeNB3rt » 21 Nov 2016, 13:44

Bumping this topic ;) ,

I want to measure/calculate AC power usage with my ESPEasy.
I found out this article:
http://www.homautomation.org/2013/09/17 ... d-arduino/

It's using a Non-invasive AC Current Sensor (type SCT-013-000 like in this topic title).
Burden resistor and an voltage devider to create an analog value between 0 -> 5V.
I think the same can be done to read the value with the ESP's ADC with voltage devider.

Anyone that tried this?
Located in Belgium, Bruges. Working on a full DIY domoticz setup with ESPEasy.

DeNB3rt
Normal user
Posts: 120
Joined: 15 Dec 2015, 14:07

Re: SCT013 Current measuring with esp

#11 Post by DeNB3rt » 21 Nov 2016, 15:04

maybe read the SCT031 with the ADS1115 supported by ESPEasy?
Located in Belgium, Bruges. Working on a full DIY domoticz setup with ESPEasy.

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: SCT013 Current measuring with esp

#12 Post by papperone » 21 Nov 2016, 15:39

DeNB3rt wrote:maybe read the SCT031 with the ADS1115 supported by ESPEasy?
SCT013 can be used with ESP8266 with proper voltage divider, you can add ADS1115 if you need to read multiple analog sensors.
This is one of the project I'm working with but as not enough time I'm not advancing at right speed... :(
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

DeNB3rt
Normal user
Posts: 120
Joined: 15 Dec 2015, 14:07

Re: SCT013 Current measuring with esp

#13 Post by DeNB3rt » 21 Nov 2016, 17:03

papperone wrote:
DeNB3rt wrote:maybe read the SCT031 with the ADS1115 supported by ESPEasy?
SCT013 can be used with ESP8266 with proper voltage divider, you can add ADS1115 if you need to read multiple analog sensors.
This is one of the project I'm working with but as not enough time I'm not advancing at right speed... :(
Nice to hear that you also try to get SCT013 working with ESP :-).
Yes with proper divider, it should be possible to read directly on ESP.
I've read that directly on ESP, ADC input is 0-1 V scaled 0-1023,
with nodeMCU (like me) it should be 0-3.3V (not sure).
Located in Belgium, Bruges. Working on a full DIY domoticz setup with ESPEasy.

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: SCT013 Current measuring with esp

#14 Post by papperone » 21 Nov 2016, 18:04

DeNB3rt wrote:
papperone wrote:
DeNB3rt wrote:maybe read the SCT031 with the ADS1115 supported by ESPEasy?
SCT013 can be used with ESP8266 with proper voltage divider, you can add ADS1115 if you need to read multiple analog sensors.
This is one of the project I'm working with but as not enough time I'm not advancing at right speed... :(
Nice to hear that you also try to get SCT013 working with ESP :-).
Yes with proper divider, it should be possible to read directly on ESP.
I've read that directly on ESP, ADC input is 0-1 V scaled 0-1023,
with nodeMCU (like me) it should be 0-3.3V (not sure).
ESP8266 ACD pin range is not changing (0-1V), only difference is that NODEMCU/WEMOS have a voltage divider already onboard to bring the range to 0-3.3V but still 1024 steps due to the conversion on chip.
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: SCT013 Current measuring with esp

#15 Post by costo » 23 Nov 2016, 00:52

DeNB3rt wrote:Bumping this topic ;) ,

I want to measure/calculate AC power usage with my ESPEasy.
I found out this article:
http://www.homautomation.org/2013/09/17 ... d-arduino/

It's using a Non-invasive AC Current Sensor (type SCT-013-000 like in this topic title).
Burden resistor and an voltage devider to create an analog value between 0 -> 5V.
I think the same can be done to read the value with the ESP's ADC with voltage devider.

Anyone that tried this?
I have to spoil the party here.
The link you gave puts this line in the loop of the program.: double Irms = emon1.calcIrms(1480); // Calculate Irms only
I suggest you read this page for better understanding what this means https://openenergymonitor.org/emon/node/846

The point is that you need to measure the momentary voltage of the sinusoidal AC waveform more than thousand times per second, that is a necessity to calculate the RMS value of the alternating voltage.
ESPEasy can do about one measurement per second. With so few measurements it is impossible to calculate the RMS value of a 50Hz AC waveform.

DeNB3rt
Normal user
Posts: 120
Joined: 15 Dec 2015, 14:07

Re: SCT013 Current measuring with esp

#16 Post by DeNB3rt » 23 Nov 2016, 17:04

costo wrote:
DeNB3rt wrote:Bumping this topic ;) ,

I want to measure/calculate AC power usage with my ESPEasy.
I found out this article:
http://www.homautomation.org/2013/09/17 ... d-arduino/

It's using a Non-invasive AC Current Sensor (type SCT-013-000 like in this topic title).
Burden resistor and an voltage devider to create an analog value between 0 -> 5V.
I think the same can be done to read the value with the ESP's ADC with voltage devider.

Anyone that tried this?
I have to spoil the party here.
The link you gave puts this line in the loop of the program.: double Irms = emon1.calcIrms(1480); // Calculate Irms only
I suggest you read this page for better understanding what this means https://openenergymonitor.org/emon/node/846

The point is that you need to measure the momentary voltage of the sinusoidal AC waveform more than thousand times per second, that is a necessity to calculate the RMS value of the alternating voltage.
ESPEasy can do about one measurement per second. With so few measurements it is impossible to calculate the RMS value of a 50Hz AC waveform.
Party breaker ;)
No, many thanks for the hint!
You are correct, the RMS value must be measured with 1480 samples per second.

Could I do this with a seperate arduino pro mini (MiniProExtender) with the code and via I2C send the result to the ESP?
I have an pro mini 5v laying around.

Code: Select all

#include "EmonLib.h"                   // Include Emon Library
EnergyMonitor emon1;                   // Create an instance
 
void setup()
{  
  Serial.begin(9600);
 
  emon1.current(5, 60);             // Current: input pin, calibration.
  //calibration is explained bellow
}
 
void loop()
{
  double Irms = emon1.calcIrms(1480);  // Calculate Irms only
 
  Serial.print(Irms*230.0);	       // Apparent power
  Serial.print(" ");
  Serial.println(Irms);		       // Irms
}
The ESPeasy can handle the received value over to e.g. domoticz?

The party must go on :ugeek:
Located in Belgium, Bruges. Working on a full DIY domoticz setup with ESPEasy.

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: SCT013 Current measuring with esp

#17 Post by costo » 24 Nov 2016, 23:39

DeNB3rt wrote: Party breaker ;)
No, many thanks for the hint!
You are correct, the RMS value must be measured with 1480 samples per second.

Could I do this with a seperate arduino pro mini (MiniProExtender) with the code and via I2C send the result to the ESP?
I have an pro mini 5v laying around.

Code: Select all

 code 
The ESPeasy can handle the received value over to e.g. domoticz?

The party must go on :ugeek:
Ofcourse you can do such things with an small Arduino board and the PME plugin. I have no experience with the emon library but it should work.

Some time ago I did a measuring AC-current project, you can read about that here:

viewtopic.php?f=4&t=627&start=10#p6463
viewtopic.php?f=2&t=1078&p=6462#p6462

The results I got with a ACS712 i.c.w. a Pro-Mini were not impressive, a lack of resolution and accuracy. Not good for measurering small currents.
But good enough to see if a motor, lamp or heater is turned on.
To measure AC reasonable accurate you need a 12-bit AD-converter. Arduino boards have only 10-bit resolution. , only Arduino DUE has 12-bit AD converters and I guess it is possible to use that board with the PME plugin instead of a Pro-Mini board.

temitope1234
New user
Posts: 1
Joined: 29 May 2019, 03:24

Re: SCT013 Current measuring with esp

#18 Post by temitope1234 » 29 May 2019, 03:45

har wrote: 11 Jan 2016, 15:28 Hello,

I have a CT for measuring current, type SCT013, voltage output type.

And I was wondering if the analoge input of the ESP can be used for this purpose?

And if yes what is the best way?
regards
Har
please can you help me with the circuit diagram of how to connect an esp8266 with sct013

alkakamble
New user
Posts: 1
Joined: 10 Jun 2019, 11:37

Re: SCT013 Current measuring with esp

#19 Post by alkakamble » 10 Jun 2019, 12:53

This is an air conditioner current transformer which has an air conditioner yield.

Simple contribution of ESP can do nothing with a 50/60Hz Air conditioning signal which originates from STC013.

The yield territory of ESP would be vague, fluctuating qualities.

You could add an indicator circuit to make a DC voltage which is pretty much a sign of the measure of air conditioning current.

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests