SCT-013-030 current monitor sensor
-
its seem good kWh every 2min
1864W is the power valuesend(IrmsMsg1.set(intrms * 232.0, 1));the sketch send power value P (in W) and energy (in kWh) calculated over 2min.
double energie = (intrms * 232.0 * SEND_FREQUENCY / 1000) / 3.6E6; // and after nrj1 += energie; send(kWhMsg1.set(nrj1, 5));in domoticz i have one "dispositif" included instant power Watt and day cumulate energy kWh
bye -
its seem good kWh every 2min
1864W is the power valuesend(IrmsMsg1.set(intrms * 232.0, 1));the sketch send power value P (in W) and energy (in kWh) calculated over 2min.
double energie = (intrms * 232.0 * SEND_FREQUENCY / 1000) / 3.6E6; // and after nrj1 += energie; send(kWhMsg1.set(nrj1, 5));in domoticz i have one "dispositif" included instant power Watt and day cumulate energy kWh
bye -
a clamp measure only intensity I (in A) and Power =UrmsxIrms so if in u home Urms=241V u can change with this value but the power measurment not consider cosphy
by example the power measurment of my fridge =257W but true value is (with cosphy) 257x0,56=....W
so if u change 232V with 241V why not but at the end its will continu to be a approximate of the true power.
bye -
a clamp measure only intensity I (in A) and Power =UrmsxIrms so if in u home Urms=241V u can change with this value but the power measurment not consider cosphy
by example the power measurment of my fridge =257W but true value is (with cosphy) 257x0,56=....W
so if u change 232V with 241V why not but at the end its will continu to be a approximate of the true power.
byeOkay :) understand now, and what about calibration for wiring I followig this site
And they calibrate
emon1.current(1, 111.1);And yours calibration
emon1.current(PIN_ANALOG_I1, 30.0);Is some difference after this calibrations in measuring ?
-
Because with test sketch from that site I get actual consumption 0,5 kWh but from mysensors sketch I get much higher values look

1,7 kWh per one hour is too much , I had only TV and fridge in power on mode, I had total consumption per last year about 2140 kWh , which is about 6 kWh per day.
-
hello,
- the constant 30 is the divide between ratio/burden resistor including inside the clamp
for me ration=1800 and R=62ohm (1800/62 approx 30)
http://www.planete-domotique.com/notices/S/C/SCT013-030V.pdf - i can see 1677 Wh=1,677 kWh ... but 1900W for only TV+fridge its many
mine clamp2 log in domoticz

- Maybe it can help u??? i have a pulse powercounter count every flash (1 Wh of energy) of mine electric box and the power (Watt) send to gw is wrong in domoticz but the energy counting (kWh) is great.

Where come the wrong of fake power (GW ? sketch ? domoticz , i dont know)
bye
- the constant 30 is the divide between ratio/burden resistor including inside the clamp
-
hello,
- the constant 30 is the divide between ratio/burden resistor including inside the clamp
for me ration=1800 and R=62ohm (1800/62 approx 30)
http://www.planete-domotique.com/notices/S/C/SCT013-030V.pdf - i can see 1677 Wh=1,677 kWh ... but 1900W for only TV+fridge its many
mine clamp2 log in domoticz

- Maybe it can help u??? i have a pulse powercounter count every flash (1 Wh of energy) of mine electric box and the power (Watt) send to gw is wrong in domoticz but the energy counting (kWh) is great.

Where come the wrong of fake power (GW ? sketch ? domoticz , i dont know)
bye
- the constant 30 is the divide between ratio/burden resistor including inside the clamp
-
updated my sketch with new values for SCT-013-00 result is now
#define MY_DEBUG #define MY_RADIO_NRF24 // EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3 ***/ #include <SPI.h> #include <MySensors.h> #include "EmonLib.h" // Include Emon Library EnergyMonitor emon1; // Create an instance #define CHILD_ID_CLAMP1 0 #define PIN_ANALOG_I1 A1 //pince amperemetrique1 unsigned long lastSend_power = millis(); unsigned long lastSend_c = millis(); unsigned long SEND_FREQUENCY = 120000; // Minimum time between send (in milliseconds). We don't wnat to spam the gateway. unsigned long SEND_FREQUENCY_C = SEND_FREQUENCY / 30; int index = 0; double Irms1 = 0; boolean pcReceived1 = false; float nrj1 = 0, old_nrj1; MyMessage IrmsMsg1(CHILD_ID_CLAMP1, V_WATT); MyMessage kWhMsg1(CHILD_ID_CLAMP1, V_KWH); MyMessage pcMsg1(CHILD_ID_CLAMP1, V_VAR1); void before() { } void presentation() { sendSketchInfo("Multisensors_Entree", "2.0"); // Send the sketch version information to the gateway and Controller present(CHILD_ID_CLAMP1, S_POWER); // Register this device as power sensor request(CHILD_ID_CLAMP1, V_VAR1); } void receive(const MyMessage &message) { if (message.type == V_VAR1) { nrj1 = old_nrj1 = message.getFloat(); Serial.print("Received last nrj count from gw:"); Serial.println(nrj1); pcReceived1 = true; } } void setup() { emon1.current(PIN_ANALOG_I1, 111.1); // Current: input pin, calibration. Serial.println("SETUP completed"); } void envoi_donnees(double intrms, int id_clamp) { Serial.print("Envoi des donnees .... clamp="); Serial.println(id_clamp); double energie = (intrms * 240.0 * SEND_FREQUENCY / 1000) / 3.6E6; switch (id_clamp) //can be modified ... { case 1: { send(IrmsMsg1.set(intrms * 240.0, 1)); nrj1 += energie; send(kWhMsg1.set(nrj1, 5)); send(pcMsg1.set(nrj1, 5)); old_nrj1 = nrj1; } break; } } void loop() { unsigned long now = millis(); bool sendTime_c = now - lastSend_c > SEND_FREQUENCY_C; // Calcul de Irms1 et Irms2 if (sendTime_c) //calcul Irms moy clamp1/clamp2 { if (index == 0) { Irms1 = emon1.calcIrms(1480); } else { Irms1 = (index * Irms1 + emon1.calcIrms(1480)) / (index + 1); } lastSend_c = now; index++; } bool sendTime_power = now - lastSend_power > SEND_FREQUENCY; if (sendTime_power) { // Envoi ou request Puissance1 if (pcReceived1) envoi_donnees(Irms1, 1); else { request(CHILD_ID_CLAMP1, V_VAR1); Serial.println("Request VAR1"); } //on reinitialise les compteurs lastSend_power = now; index = 0; } }
-
Hi , i update your sketch for Multiple sensor
#define MY_RADIO_NRF24 #define MY_DEBUG #include <SPI.h> #include <MySensors.h> #include <EmonLib.h> #define SERIAL_BAUD 115200 #define PIN_ANALOG_I1 A0 // The input you attached SCT1. #define PIN_ANALOG_I2 A1 // The input you attached SCT2. #define PIN_ANALOG_I3 A2 // The input you attached SCT3. #define CHILD_ID_WATT 0 // child-id of sensor #define CHILD_ID_KWH 1 // child-id of sensor #define CHILD_ID_VAR1 2 // child-id of sensor #define MAX_CT 3 // Number of CT sensor EnergyMonitor ct1, ct2, ct3; MyMessage msgWatt(CHILD_ID_WATT,V_WATT); MyMessage msgKwh(CHILD_ID_KWH,V_KWH); MyMessage msgVar(CHILD_ID_VAR1,V_VAR1); unsigned long lastSend_power = millis(); unsigned long lastSend_c = millis(); unsigned long SEND_FREQUENCY = 60000; // 1 mn Minimum time between send (in milliseconds). unsigned long FREQUENCY_SAMPLE = SEND_FREQUENCY / 12 ; // ( 5 s) #define MAX_CT 3 double Irms[MAX_CT]; float nrj[MAX_CT]; boolean pcReceived[MAX_CT]; int index = 0; void setup() { #ifdef MY_DEBUG Serial.begin(SERIAL_BAUD); Serial.println("Begin SETUP"); #endif //ct1.current(PIN_ANALOG_I1, 111.1); // Current: input pin, calibration. ct1.current(PIN_ANALOG_I1, 60); // current constant = (100 ÷ 0.050) ÷ 33 Homs = 60 ct2.current(PIN_ANALOG_I2, 60); ct3.current(PIN_ANALOG_I3, 60); Irms[0] = ct1.calcIrms(1480); // initial boot to charge up capacitor (no reading is taken) - testing Irms[1] = ct2.calcIrms(1480); Irms[2] = ct3.calcIrms(1480); for (int i=0; i<MAX_CT; i++) { Irms[i] = nrj[i] = 0; pcReceived[i]=false; } #ifdef MY_DEBUG Serial.println("SETUP completed"); #endif } void presentation() { sendSketchInfo("Energy Meter", "2.1"); present(0, S_POWER); request(0, V_VAR1); present(1, S_POWER); request(1, V_VAR1); present(2, S_POWER); request(2, V_VAR1); } void receive(const MyMessage &message) { int SensorID ; SensorID = message.sensor ; if (message.type == V_VAR1) { nrj[SensorID] = message.getFloat(); pcReceived[SensorID] = true; #ifdef MY_DEBUG Serial.print("Received last nrj["); Serial.print(SensorID); Serial.print("] count from GW:"); Serial.println(nrj[SensorID]); #endif } } void send_data(double intrms, int SensorID) { #ifdef MY_DEBUG Serial.print("Send data for SensorID="); Serial.println(SensorID); #endif double energie = (intrms * 240.0 * SEND_FREQUENCY / 1000) / 3.6E6; nrj[SensorID] += energie; send(msgWatt.setSensor(SensorID).set(intrms * 240.0, 1)); send(msgKwh.setSensor(SensorID).set(nrj[SensorID], 5)); send(msgVar.setSensor(SensorID).set(nrj[SensorID], 5)); } void loop() { unsigned long now = millis(); double _Irms[MAX_CT]; bool sendTime_c = now - lastSend_c > FREQUENCY_SAMPLE; if (sendTime_c) { _Irms[0] = ct1.calcIrms(1480) ; if (_Irms[0] < 0.3) _Irms[0] = 0; _Irms[1] = ct2.calcIrms(1480) ; if (_Irms[1] < 0.3) _Irms[1] = 0; _Irms[2] = ct3.calcIrms(1480) ; if (_Irms[2] < 0.3) _Irms[2] = 0; Irms[0] = (index * Irms[0] + _Irms[0]) / (index + 1); Irms[1] = (index * Irms[1] + _Irms[1]) / (index + 1); Irms[2] = (index * Irms[2] + _Irms[2]) / (index + 1); lastSend_c = now; index++; #ifdef MY_DEBUG for (int i=0; i<MAX_CT; i++) { Serial.print("CT"); Serial.print(i); Serial.print(" : "); Serial.print(Irms[i]*240.0); // Apparent power Serial.print(" "); Serial.println(Irms[i]); // Irms } #endif } bool sendTime_power = now - lastSend_power > SEND_FREQUENCY; if (sendTime_power) { for (int i=0; i<MAX_CT; i++) { // Envoi ou request Puissance1 if (pcReceived[i]) { send_data(Irms[i], i); } else { request(i, V_VAR1); Serial.println("Request VAR1"); } } //on reinitialise les compteurs lastSend_power = now; index = 0; } }


