💬 Power Meter Pulse Sensor
-
I built this node but it doesn't seem to work. It shows up in the hardware list of my controller (Domoticz latest stable) as S_Power but no values appear like I was expecting V_WATT, V_KWH etc. Nothing appears under the devices section. Does the sketch need modifying for 2.0 or is it a Domoticz issue? Anybody else got one of these working?
-
Sorry please disregard, I got it working, the pot just needed trimming down, it was permanently triggered so not reading pulses. It worked straight away as soon as I did that. I thought the green light on the lm393 was a power indicator as it was always on, not pulsing.
-
Sorry please disregard, I got it working, the pot just needed trimming down, it was permanently triggered so not reading pulses. It worked straight away as soon as I did that. I thought the green light on the lm393 was a power indicator as it was always on, not pulsing.
-
Like all the nodes and the project in general, it's amazing, but in the space of 24hrs I have turned into a "turn everything off" sort of a guy. I cringed when I suddenly had a log of how much money I was wasting! One thing that's weird is that Domoticz shows 2 devices; usage and meter, the usage one doesn't update at all, but the meter one displays everything you need anyway. It's a bit like the DHT node, in that they show as 3 devices TempHum combined which update nicely; and 2x LacrosseTX which update randomly.
-
I do not understand. My boiler is 3KW. https://1drv.ms/i/s!AtuQgBKT8NIPhi4F_I3mPVYW0S9P
-
I do not understand. My boiler is 3KW. https://1drv.ms/i/s!AtuQgBKT8NIPhi4F_I3mPVYW0S9P
-
Can someone please explain how the sleep mode works?
My sensor works like a charm when sleep mode is "false" but when changing to "true" i get nothing to the GW
Exactly the same setup, the only thing I changed is from "false" to "true"
-
@miljume
Use sleep mode if you have battery for the node.Maybe it need lots of Kwh before sending new data. If you don't use sleep mode it will send watt more often.
-
it need to change 0,02 kWh before sending new value
see more information here
https://forum.mysensors.org/topic/4727/energy-meter-not-sending-at-expected -
it need to change 0,02 kWh before sending new value
see more information here
https://forum.mysensors.org/topic/4727/energy-meter-not-sending-at-expected -
@flopp Thanks for the link but I still cant get anything in sleep mode
Now I have waited for over an hour with simulated blinks approx twice/second but so far the device havent reported one single time!
By the way, does anyone know how to reset the value stored in the GW?
After some testing the value get's quite high :smiley:
-
Hi. I built this sensor and loaded the example. It appears the sensor registers with my serial gateway and appears in domoticz. The problem is it hasn't updated the value in 24h? Any ideas?
Thanks -
-
Came back from work and checked. it is sending to the gateway the first value and gets displayed in domoticz. then dead.. it appears it does not get the pulse count from the gateway respectively from domoticz. has anyone got this working with domoticz?
-
@asgardro
this is my sketch
i use MS 1.5.1/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * REVISION HISTORY * Version 1.0 - Henrik EKblad * * DESCRIPTION * This sketch provides an example how to implement a distance sensor using HC-SR04 * Use this sensor to measure KWH and Watt of your house meeter * You need to set the correct pulsefactor of your meeter (blinks per KWH). * The sensor starts by fetching current KWH value from gateway. * Reports both KWH and Watt back to gateway. * * Unfortunately millis() won't increment when the Arduino is in * sleepmode. So we cannot make this sensor sleep if we also want * to calculate/report watt-number. * http://www.mysensors.org/build/pulse_power */ #include <SPI.h> #include <MySensor.h> #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your light sensor. (Only 2 and 3 generates interrupt!) #define PULSE_FACTOR 1000 // Number of blinks per KWH of your meeter #define SLEEP_MODE false // Watt-value can only be reported when sleep mode is false. #define MAX_WATT 15000 // Max watt value to report. This filters outliers. #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway) #define CHILD_ID 1 // Id of the sensor child unsigned long SEND_FREQUENCY = 5*60000; // Minimum time between send (in milliseconds). We don't want to spam the gateway. MySensor gw; double ppwh = ((double)PULSE_FACTOR)/1000; // Pulses per watt hour boolean pcReceived = false; volatile unsigned long pulseCount = 0; volatile unsigned long lastBlink = 0; volatile unsigned long watt = 0; unsigned long oldPulseCount = 0; unsigned long oldWatt = 0; //double oldKwh; unsigned long lastSend; MyMessage wattMsg(CHILD_ID,V_WATT); MyMessage kwhMsg(CHILD_ID,V_KWH); MyMessage pcMsg(CHILD_ID,V_VAR1); void setup() { gw.begin(incomingMessage); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("Energy Huset", "1.1"); //1.1 no check for old value, always send // Register this device as power sensor gw.present(CHILD_ID, S_POWER); // Fetch last known pulse count value from gw gw.request(CHILD_ID, V_VAR1); attachInterrupt(INTERRUPT, onPulse, RISING); lastSend=millis(); } void loop() { gw.process(); unsigned long now = millis(); // Only send values at a maximum frequency or woken up from sleep bool sendTime = now - lastSend > SEND_FREQUENCY; if (pcReceived && (SLEEP_MODE || sendTime)) { // New watt value has been calculated if (!SLEEP_MODE && watt != oldWatt) { // Check that we dont get unresonable large watt value. // could hapen when long wraps or false interrupt triggered if (watt<((unsigned long)MAX_WATT)) { gw.send(wattMsg.set(watt)); // Send watt value to gw } Serial.print("Watt:"); Serial.println(watt); oldWatt = watt; } // Pulse cout has changed if (pulseCount != oldPulseCount) { gw.send(pcMsg.set(pulseCount)); // Send pulse count value to gw double kwh = ((double)pulseCount/((double)PULSE_FACTOR)); oldPulseCount = pulseCount; //if (kwh != oldKwh) { gw.send(kwhMsg.set(kwh, 4)); // Send kwh value to gw //oldKwh = kwh; //} } lastSend = now; } else if (sendTime && !pcReceived) { // No count received. Try requesting it again gw.request(CHILD_ID, V_VAR1); lastSend=now; } if (SLEEP_MODE) { gw.sleep(SEND_FREQUENCY); } } void incomingMessage(const MyMessage &message) { if (message.type==V_VAR1) { pulseCount = oldPulseCount = message.getLong(); Serial.print("Received last pulse count from gw:"); Serial.println(pulseCount); pcReceived = true; } } void onPulse() { if (!SLEEP_MODE) { unsigned long newBlink = micros(); unsigned long interval = newBlink-lastBlink; if (interval<10000L) { // Sometimes we get interrupt on RISING return; } watt = (3600000000.0 /interval) / ppwh; lastBlink = newBlink; } pulseCount++; }