💬 Water Meter Pulse Sensor
-
While looking into the water meter I realized that we are getting a "smart" meter replacement soon. I'll see if I can speed up the replacement schedule. Anyhow, the replacement is a Kamstrup Multical 21 (https://www.kamstrup.com/en-en/water-solutions/water-meters/multical-21) which has several options for reading:
- Requesting the data via optical interface?
- Enabling the pulse function via optical interface, and then reading the IR pulse at 1imp/10lit.
- Reading the wireless mbus signal? (e.g. https://github.com/weetmuts/wmbusmeters)
-
While looking into the water meter I realized that we are getting a "smart" meter replacement soon. I'll see if I can speed up the replacement schedule. Anyhow, the replacement is a Kamstrup Multical 21 (https://www.kamstrup.com/en-en/water-solutions/water-meters/multical-21) which has several options for reading:
- Requesting the data via optical interface?
- Enabling the pulse function via optical interface, and then reading the IR pulse at 1imp/10lit.
- Reading the wireless mbus signal? (e.g. https://github.com/weetmuts/wmbusmeters)
@bjornhallberg Suggest you discuss with your water supplier, and see what THEY intend to deploy for comms and explain what your own objectives are, that may refine what you are looking at, and they MIGHT actually help rather than be play "stupid" which is unfortunately common nowadays. In all probability they will be looking at wireless m-bus for drive-by readings, this is the predominant method of retrieval.
I admit to surprise at them deploying ultrasonics, they are on the expensive end of the market but they are extremely reliable and accurate. -
@flopp said in 💬 Water Meter Pulse Sensor:
TCRT5000 IR senso
I have not had good results using TCRT5000 IR sensor, did you?
@bjornhallberg well I still think this is the best approach to use RPI + OCRhttps://forum.mysensors.org/topic/1594/automatic-water-meter-reading-with-a-webcam
https://blog.m.nu/vattenmatning-med-raspberry-pi-och-webkamera/@bjacobse said in 💬 Water Meter Pulse Sensor:
@flopp said in 💬 Water Meter Pulse Sensor:
TCRT5000 IR senso
I have not had good results using TCRT5000 IR sensor, did you?
I didn’t get it to work.
I was so lucky that my water company change the meter to a meter with wireless m-bus.
So I bought a box for this and now I have 100% correct readings. -
@flopp said in 💬 Water Meter Pulse Sensor:
TCRT5000 IR senso
I have not had good results using TCRT5000 IR sensor, did you?
@bjornhallberg well I still think this is the best approach to use RPI + OCRhttps://forum.mysensors.org/topic/1594/automatic-water-meter-reading-with-a-webcam
https://blog.m.nu/vattenmatning-med-raspberry-pi-och-webkamera/ -
@zboblamont
In Sweden you need a certified installer to exchange your pipes, else in case of water damage your insurance won't cover.
so cheapest for me is a RPI with camera - but yes I would prefer a "real" measuring from a dedicated sensor -
@zboblamont
In Sweden you need a certified installer to exchange your pipes, else in case of water damage your insurance won't cover.
so cheapest for me is a RPI with camera - but yes I would prefer a "real" measuring from a dedicated sensor@bjacobse Pardon my laughter, insurers look for any excuse for sure, but I have never heard yet where a water meter or any other competent insertion damaged a building, let alone an insurance company refused to compensate for a building which burned to the ground (99.9%) on the basis the water meter was not a verified install. For sure some loss adjusters will use any excuse, but really?
To clarify, in many countries a certified inspector or Engineer must certify that work is carried out within the regulations, it does not state that HE/SHE has carried out the work, only that it has been inspected and verified as compliant. You know any certified local plumbers with 5 minutes to spare, because that is how long it takes me to fit one, and about the time it takes a certified pipe-jockey to verify it's right and sign it off, if it really concerns you ?I have 2 self fitted water meters with sensors, gas meter sensor etc, and a huge amount of DIY stuff any smartass insurer could IMPLY was a contributory factor to the disaster which befell my house, but frankly it wouldn't stand 1 second in Court before being laughed out...
Place hasn't burned down yet, fallen over in earthquakes, or been subjected to landslide, but luckily I don't have Swedish Insurers.... ;)
PS- I should clarify that the standing regulations are framed to quite rightly protect consumers as well as the service provider against cowboys interfering with apparatus. Changing light switches or sockets falls under the same overall umbrella despite everyone and their mother changing them. -
@zboblamont
In Sweden you need a certified installer to exchange your pipes, else in case of water damage your insurance won't cover.
so cheapest for me is a RPI with camera - but yes I would prefer a "real" measuring from a dedicated sensor@bjacobse I believe you can replace the meter yourself if you own it yourself and have the necessary skills. I live in such an area and was told I could mount it myself if I was confident enough. But of course, the fault will be yours if your bad job causes damages. In reality it is quite unlikely that you can mount it badly and not notice the problem immediately.
A more critical issue is that water meters are usually owned by the municipality or water company and they are sealed. It is impossible to replace the meter without breaking the seal and when the company notices they won't be happy at all.
-
@bjacobse I believe you can replace the meter yourself if you own it yourself and have the necessary skills. I live in such an area and was told I could mount it myself if I was confident enough. But of course, the fault will be yours if your bad job causes damages. In reality it is quite unlikely that you can mount it badly and not notice the problem immediately.
A more critical issue is that water meters are usually owned by the municipality or water company and they are sealed. It is impossible to replace the meter without breaking the seal and when the company notices they won't be happy at all.
@fredswed And by extension (Possibly Swedish water suppliers differ from UK or Romanian counterparts?) the data retrieved from their devices is often regarded as their property also, and brick walls begin to appear ino what should be readily shared data. If they will not share, fitting a downstream device within your own control can often be the only solution, don't interfere, augment...
As a perverse example, my own gas and electricity suppliers are the German monolith EON who provide and enable access to their 'graphs' online, updated with 1 or 2 month readings (gas and electricity).
Having checked the base data for their graphs, I realised they were presenting a lovely graph based on complete bunkum, and developed and maintained my own ever since, which IS accurate. I checked recently and their graphs are still pretty but complete rubbish.
Installing a gas meter sensor caused EON palpitations until they realised it was the commercial device for the meter and could not object on technicalities then quietly dropped objections, I don't care how they respond when I fit meters to the Consumer box, it is nowhere near their SMART meter which tells me nothing but tells them much, mainly that I halved their 2 monthly bill ;) .
If the service provider will allow detailed sharing of YOUR data, all good and well as it is mutually beneficial, but if not, easy enough to solve at your own expense.
I fitted two replacement upgraded radiators in the last month, somewhere a Romanian regulation lurks that I should not have done so, but the insurer doesn't give a damn unless it is found to have caused the demise of the insured property.. Is it worth the risk? Hell yes... -
It looks very interesting. I complied and uploaded successful, but it ran without run the loop function at all. infrared sensor lighted up but no print out attached Serial.print.
Can you give us the url to the library #include <MySensors.h>?. I am using MySensors 2.3.1 loaded from Adruino IDE->Tools->Manage Libary->search My Sensors from https://www.mysensors.org4:55:53.476 -> 60127 TSM:FAIL:RE-INIT
14:55:53.476 -> 60129 TSM TSM:FAIL:DIS
14:55:53.476 -> 900384 TSF:TDI:TSL
14:55:54.962 ->
14:55:54.962 -> __ __ ____
14:55:54.962 -> | / |_ / | ___ _ __ ___ ___ _ __ ___
14:55:54.962 -> | |/| | | | _ \ / _ \_ \/ __|/ _ \|_/ __|
14:55:54.962 -> | | | | || || | / | | _ \ _ | | _
14:55:54.962 -> || ||_, |/ ___|| ||/_/|| |/
14:55:54.962 -> |__/ 2.3.1
14:55:54.962 ->
14:55:54.962 -> 16 MCO:BGN:INIT NODE,CP=RNNNA---,REL=255,VER=2.3.1
14:55:54.962 -> 26 TSM:INIT
14:55:54.962 -> 27 TSF:WUR:MS=0
14:55:54.997 -> 33 !TSM:INIT:TSP FAIL
14:55:54.997 -> 35 TSM:FAIL:CNT=1
14:55:54.997 -> 37 TSM:FAIL:DIS -
Sorry to hijack the thread a bit,
I'm using a TCRT5000 sensor to read a water meter (Zenner), it works ok until it stops detecting pulses, I have to increase the sensitivity (clockwise turn the trimpot) and it works ok for another few days/weeks, then again it needs an increase in sensitivity, like somehow it's loosing it's sensitivity .
I'm already with my second sensor, the first one got to the end of the trimpot and couldn't adjust anymore.Has this happened to anyone else? It's powered by 5V, it's the LED losing power or the photosensor losing sensitivity? Any ideas?
Thanks. -
@flopp which box did you buy for m-bus readings? did you work it out?
''I was so lucky that my water company change the meter to a meter with wireless m-bus.
So I bought a box for this and now I have 100% correct readings.'' -
Water Meter shows up in mysensors.json and homeassistant logs but fails to appear in Homeassistant GUI.
I have a dozen Nodes already successfully operating
I used the default sketch on this page. Just added Node 6
Looks like values are not getting through
Thank you for your help -
this is HA log:
2019-07-04 23:24:05 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on mygateway1-out/6/255/3/0/11: b'Water Meter',
2019-07-04 23:24:05 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 6;255;3;0;11;Water Meter,
2019-07-04 23:24:23 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on mygateway1-out/6/255/3/0/11: b'Water Meter',
2019-07-04 23:24:23 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 6;255;3;0;11;Water Meter -
this is HA log:
2019-07-04 23:24:05 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on mygateway1-out/6/255/3/0/11: b'Water Meter',
2019-07-04 23:24:05 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 6;255;3;0;11;Water Meter,
2019-07-04 23:24:23 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on mygateway1-out/6/255/3/0/11: b'Water Meter',
2019-07-04 23:24:23 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 6;255;3;0;11;Water Meterhere is the sketch:
// Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_RF24 #define MY_NODE_ID 6 //#define MY_RADIO_NRF5_ESB //#define MY_RADIO_RFM69 //#define MY_RADIO_RFM95 #include <MySensors.h> #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your sensor. (Only 2 and 3 generates interrupt!) #define PULSE_FACTOR 1000 // Number of blinks per m3 of your meter (One rotation/liter) #define SLEEP_MODE false // flowvalue can only be reported when sleep mode is false. #define MAX_FLOW 40 // Max flow (l/min) value to report. This filters outliers. #define CHILD_ID 1 // Id of the sensor child uint32_t SEND_FREQUENCY = 30000; // Minimum time between send (in milliseconds). We don't want to spam the gateway. MyMessage flowMsg(CHILD_ID,V_FLOW); MyMessage volumeMsg(CHILD_ID,V_VOLUME); MyMessage lastCounterMsg(CHILD_ID,V_VAR1); double ppl = ((double)PULSE_FACTOR)/1000; // Pulses per liter volatile uint32_t pulseCount = 0; volatile uint32_t lastBlink = 0; volatile double flow = 0; bool pcReceived = false; uint32_t oldPulseCount = 0; uint32_t newBlink = 0; double oldflow = 0; double volume =0; double oldvolume =0; uint32_t lastSend =0; uint32_t lastPulse =0; void setup() { // initialize our digital pins internal pullup resistor so one pulse switches from high to low (less distortion) pinMode(DIGITAL_INPUT_SENSOR, INPUT_PULLUP); pulseCount = oldPulseCount = 0; // Fetch last known pulse count value from gw request(CHILD_ID, V_VAR1); lastSend = lastPulse = millis(); attachInterrupt(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), onPulse, FALLING); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Water Meter", "1.1"); // Register this device as Water flow sensor present(CHILD_ID, S_WATER); } void loop() { uint32_t currentTime = millis(); // Only send values at a maximum frequency or woken up from sleep if (SLEEP_MODE || (currentTime - lastSend > SEND_FREQUENCY)) { lastSend=currentTime; if (!pcReceived) { //Last Pulsecount not yet received from controller, request it again request(CHILD_ID, V_VAR1); return; } if (!SLEEP_MODE && flow != oldflow) { oldflow = flow; Serial.print("l/min:"); Serial.println(flow); // Check that we don't get unreasonable large flow value. // could happen when long wraps or false interrupt triggered if (flow<((uint32_t)MAX_FLOW)) { send(flowMsg.set(flow, 2)); // Send flow value to gw } } // No Pulse count received in 2min if(currentTime - lastPulse > 120000) { flow = 0; } // Pulse count has changed if ((pulseCount != oldPulseCount)||(!SLEEP_MODE)) { oldPulseCount = pulseCount; Serial.print("pulsecount:"); Serial.println(pulseCount); send(lastCounterMsg.set(pulseCount)); // Send pulsecount value to gw in VAR1 double volume = ((double)pulseCount/((double)PULSE_FACTOR)); if ((volume != oldvolume)||(!SLEEP_MODE)) { oldvolume = volume; Serial.print("volume:"); Serial.println(volume, 3); send(volumeMsg.set(volume, 3)); // Send volume value to gw } } } if (SLEEP_MODE) { sleep(SEND_FREQUENCY); } } void receive(const MyMessage &message) { if (message.type==V_VAR1) { uint32_t gwPulseCount=message.getULong(); pulseCount += gwPulseCount; flow=oldflow=0; Serial.print("Received last pulse count from gw:"); Serial.println(pulseCount); pcReceived = true; } } void onPulse() { if (!SLEEP_MODE) { uint32_t newBlink = micros(); uint32_t interval = newBlink-lastBlink; if (interval!=0) { lastPulse = millis(); if (interval<500000L) { // Sometimes we get interrupt on RISING, 500000 = 0.5 second debounce ( max 120 l/min) return; } flow = (60000000.0 /interval) / ppl; } lastBlink = newBlink; } pulseCount++; }``` -
@bereska said in 💬 Water Meter Pulse Sensor:
Is it possible to get any help on this page or not?
Crying out loud most likely will not help...
Seems your setup is a little special, so just some assumptions from one using a serial GW and not MyS-MQTT:
Your controller is asked for sending an initial value, but has none yet. So no answer is sent out. Triggering the counter on Node side could help to send one (after waiting time has passed). Then have a look at your controller, if there's a value available. If, you might set the correct value, restart your node afterwards and see, if everything now works as expected? -
@bereska said in 💬 Water Meter Pulse Sensor:
Is it possible to get any help on this page or not?
Crying out loud most likely will not help...
Seems your setup is a little special, so just some assumptions from one using a serial GW and not MyS-MQTT:
Your controller is asked for sending an initial value, but has none yet. So no answer is sent out. Triggering the counter on Node side could help to send one (after waiting time has passed). Then have a look at your controller, if there's a value available. If, you might set the correct value, restart your node afterwards and see, if everything now works as expected?