💬 Water Meter Pulse Sensor



  • @mfalkvidd Thanks. Have now connected the digital pin2 to gnd and in the last 1h the values are always 0.000 going to leave it this way until night since now i'm at work. I would like to find out what was creating the spurious interrupts??
    Other thing that ill find out tonight is when i connect the sensor to the arduino will it create rong data or will it only send real data only when the water meter starts running water...

    One more thing today at 8:00 when i did the pin2 to gnd the first "boot" over domoticz i got this value as you can see on the image below. Is this normal? Have been trying to deleted but it wont go away.

    Once again thanks for your help.

    0_1497430047720_Water data.png



  • @mrc-core
    The spurious interrups are caused by the open line. The Arduino has high impedance inputs and anything from a WiFi signal or the signal from a close by circuit can cause the value to swing between 0 and 3 Volt, triggering your input. See https://www.arduino.cc/en/Tutorial/DigitalPins

    On your high value in the graph: Domoticz water sensors require the sensor to post the total water volume. This means that the sensor needs to "know" the total of volumes from all the past measurements. In fact all the (wrong) past pulses you generated with the open input are stored by the sensor. There are 2 ways this storage mechanism can be realized in Arduino code:

    (1) keep the value in the Arduino EEPROM and
    (2) use a build in feature of Domoticz to store values on behalf of sensors.

    Mysesnsors uses method 2 as method (1) has 2 disadvantages: The code needs to continuously write to the EEPROM, because you never know when the Arduino will be rebooted. The EEPROM on the Arduino chip does not allow you to write to it that often (max 100,000 times or so) and the EEPROM is cleared when you update the software. The sketch used by MySensors uses method (2) by sending the pulsecount to the gateway using send(lastCounterMsg.set(pulseCount)) statement at the same time the volume is sent to Domoticz with send(volumeMsg.set(volume, 3)); At each reboot the sensor requests the value of VAR1 from the gateway using request(CHILD_ID, V_VAR1); The sensor does not send any data to the gateway until the gateway has received the counter past value. The receive() function is called by the Mysensor library when data comes back from the gateway. There the pulseCount += gwPulseCount statement adds the value to the pulseCount.

    This means the sensor will not be able to "forget" the pulses that came from the period your digital input was not connected.

    There are 3 ways to fix this problem:

    • you can delete your sensor at the Domoticz side (throwing away all history): First power down your Arduino sensor, the go into Domoticz screen and remove the sensor from the Utility screen and then remove the sensor from the Setup->Hardware->MysensorsGW->Setup->Click on your water meter-> delete all Children-> delete the water meter sensor itself. Then power up your Arduino and you will see the sensor show up again.
    • as above: remove your sensor from the Utilities tab and change the code to give your sensor another new ID. At the top of your code you can put a statement like
    #define MY_NODE_ID 10
    

    This will be the ID number that shows in the hardware setup screen in Domoticz for your sensor. If you omit this code MySensors will create a new (unique) code for you. However in my system I prefer to allocate the numbers myself to each sensor. So a quick way to create a brand new sensor history in Domoticz is to simply change the MY_NODE_ID number (change from 10 to 11).

    • change yuor Arduino code to force a 0 in the VAR1 holding variable for your sensor. You can do that by adding a statement send(lastCounterMsg.set(0)); inside your loop() function (best place is here):
    // Only send values at a maximum frequency or woken up from sleep
       if (SLEEP_MODE || (currentTime - lastSend > SEND_FREQUENCY)) {
           lastSend=currentTime;
    
          send(lastCounterMsg.set(0));  // <--- keep here shortly and remove later
    
           if (!pcReceived) {
               //Last Pulsecount not yet received from controller, request it again
               request(CHILD_ID, V_VAR1);
               return;
           }
    

    You will compile and upload this code to your Arduino and let it run for a minute or so, then remove the line and upload the orginal code. You should now be able to remove the data point in Domoticz (by using ctrl-mouseclick on the graphic item)

    Hope this helps

    Bart



  • @bart59 Thanks have done like you said and did clean the data from the gateway.
    All day until 1h ago i had left my arduino connected on my pc and i did like mfalkvidd said connecting the digital pin 2 to gnd and my arduino did not send any strange value to the gateway always seend volume 0.00 this was perfect.
    Now that i'm at home i had connect my arduino to the sensor 3.3v gnd and digital pin2 and in the first log there it was value increase on volume when my sensor was in front off me...

    I have a arduino nano pro 3.3v on easy pcb board and i'm using the hall sensor i dont see why i'm getting this problem...
    I have a WiFi AP inside home and my sensor is outside.

    Even the water flow says i have a 2.00 L/min when the sensor is not near the water meter.



  • New update.... have change the arduino mini pro for another one flash a new code a new sensor and again i'm getting volume data when the sensor is not near the water meter. I dont understand what's happening.



  • @mrc-core Just to make sure: are you connecting/disconnecting the data pin to your sensor when the Arduino is powered off and are you sure the connection is solid? If you connect things with power on you may accidently trigger a pulse a 100 times.... which will be sent to the gateway 20 secs later. Always power off stuff first and use a solid connection (soldering is always better) when making modifications. How did you power the hall sensor? Should be from the 3.3V VCC connector of the Arduino and not from the higher voltage or something separate. Can you upload a photo of your setup to allow us to see how you connect things?

    Bart


  • Mod

    In addition to what bart59 said, make sure the hall sensor isn't near anything magnetic. It will be triggered by any magnetic material, not just the water meter.



  • @bart59 Yes i'm using the 3,3v from the arduino and i always connect everything with the arduino power off. Give me mor 5 minutes and i'll upload a photo from my sensor going to bring it inside home.
    @mfalkvidd i think i don't have anything magnetic on the place were i'm putting the arduino and the sensor at this time.

    Thanks for the replays.



  • Ok here's the photo off my sensor. On my code i'm using the digital pin2 since digital pin3 has a resistor for Dallas and dht sensors but i'm not using them at this time. This arduino is only for water meter.

    0_1497472280160_transferir.jpg



  • I think i have fix my problem. I have been playing with the code and the sensor and notice that the power led and data led on the sensor were always on no mater the digital pin i was trying to use.
    This also happened with the analog pin A0.
    In one last attempt i decided to use the digital pin 3 with the resistor soldered on the board for sensors like dallas and dht11 or dht22.

    Now the first thing i had noticed was the data led was not on and now it only comes on when i passe a magnet under my sensor... it does not count any pulsecount if i passe the magnet over the sensor only under it.

    Counted the times i had passed the magnet under the sensor and my gateway received te exact number 30 times = 0.030 volume and now the volume is stop at this number no more ghost encrease numbers.

    Tomorrow morning i'm going to mount the sensor over the water meter to see if this finaly works.

    The only problem i'm getting now is some NACK over the transmissions... like this:
    6604747 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=25,pt=5,l=4,sg=0,ft=3,st=OK:30
    volume:0.030
    604794 !TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=NACK:0.030
    pulsecount:30
    634781 !TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=25,pt=5,l=4,sg=0,ft=1,st=NACK:30
    volume:0.030
    634828 !TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=2,st=NACK:0.030



  • @mrc-core The NACK may be bad transmission. I typically connect a 5 cm piece of wire to the antenna of the send/receive module to increase the reception of data



  • @bart59 and @mfalkvidd Thanks for all the help. Today i toke the sensor to the water meter and for my luck my water meter is too old 1997 and no mater the position i put the hall sensor it just doesn't get any pulse at all 😞 at this time i really don't now what to use to get the data from my water meter...
    I have already tried also the TCRT5000 and also does not work. Here's an image from my water meter
    0_1497529305996_Sem Título.png

    The TCRT5000 when i put over the glass the green led stays always on but when i remove it from the glass and point it to the black part of my meter the green led goes off the sensor is working ok but the glass from my meter does not help at all.

    Any sugestions off other sensors i can try or use ?



  • @mrc-core You are right. This is the wrong type of water meter. I have been using 2 other brands watermeters: the Honeywell C7195x2001B (see http://ecc.emea.honeywell.com/downloads/EN2R9029.PDF) and the Caleffi series 316 (http://www.arbo.it/images/techsheets/316405.pdf). You local central heating installation guy may have them as they are used in boiler systems of central heating for the warm water supply. They are also sold on eBay. Both work more or less the same and can be operated on 5V. The number of pulses per liter are much higher (something like 500 pulses per liter), so they are more accurate. You will need to modify your code to work with this. Below the code of my sensor (which also measures multiple temperatures at the same Arduino chip):

    /**
     * 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.
     * 
     * (c) 2017 Bart M - last edits: 15 May 2017
     * 
     * Note: using timer0 to generate a second interrupt for our 1 ms counters. timer0 is still also  used for delay()
     *
     * Functions WTW Flow and Temperature
     * 
     * WTW flow
     *  - Flow of shower cold water
     *  - Flow of boiler cold water entry
     *  
     * Temperature 
     * - Temperature of outgoing water (Dallas with cable)
     * - Temperature of shower head (Dallas)
     * 
     * Flow meter using Honeywell C7195A2001B which has a hall sensor that pulses at 7 Hz per liter/min
     * we count only upgoing pulses, so in our case we get: 
     *   7 pulses per second at 1 l/min
     *   420 pulses per liter
     *   420000 pulses per m3
     * Flow meter Caleffi 316 which has a hall sensor that pulses at 8.8 Hz per liter/min (according to specs)
     * In reality the frequency is about 30% lower in my case, so we have to correct this with a factor of 1.3.
     *   8.8 pulses per second at 1 l/min
     *   528 pulses per liter
     *   528000 pulses per m3
     *   528000/1.3 = 406154
     * 
     * If we use 250 m3 per year we come to 105 x 10^6 pulses/year
     *`this is stored in an unsigned long that can hold 4295 x 10^6 -> volume overflow after 41 years
     *
     *****************************************************************************************************  */
    
    // BOARD: PRO MINI 5V V/ 16Mhz ATMEGA328 16Mhz
    
    // type of flow meter
    #define CALEFFI
    // #define HONEYWELL
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG 1
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    // No repeater 
    
    // node ID's
    #define MY_NODE_ID 27             // start naming my own nodes at number (set in comments if you want automatic)
    #define FLOW_ID 1                 // flow meter 1 (start here if more)
    #define NFLOWS 2                  // number of flow meters  
    #define TEMP_ID 3                 // Temperature (start here if there are more linked)
    
    #include <SPI.h>
    #include <MySensors.h>  
    #include <DallasTemperature.h>
    #include <OneWire.h>
    
    // PIN connections where the flow meters are connected. We have 2 flow meters, so our array has 2 entries
    uint8_t FlowPins[NFLOWS] = {2, 3};
    #define TEMP_PIN 4                // temp sensor connected to pin4
    
    #ifdef CALEFFI
    // #define PULSE_FACTOR 528000        // Number of blinks per m3 of your meter Caleffi (from data sheet)
    #define PULSE_FACTOR 406154        // Nummber of blinks per m3 of your meter Caleffi (measured in my installation)
    #else
    #define PULSE_FACTOR 420000        // Nummber of blinks per m3 of your meter Honeywell
    #endif
    
    // configs
    #define MAXFLOWERROR 50             // maximum number of l/min that we accept
    
    // delay times
    #define CHECK_FREQUENCY 1000         // time in milliseconds between loop (where we check the sensor) - 1000ms
    #define MIN_SEND_FREQ 10             // Minimum time between send (in multiplies of CHECK_FREQUENCY). We don't want to spam the gateway (10 seconds)
    #define MIN_FLOW_SEND_FREQ 20        // Minimum time between send (in multiplies of CHECK_FREQUENCY). We don't want to spam the gateway (30 seconds)
    #define MAX_SEND_FREQ 600            // Maximum time between send (in multiplies of CHECK_FREQUENCY). We need to show we are alive (600 sec/10 min)
    
    // one wire config
    #define ONE_WIRE_BUS TEMP_PIN
    #define MAX_ATTACHED_DS18B20 8
    
    // Motion message types
    MyMessage volumeMsg(FLOW_ID,V_VOLUME);
    MyMessage flowMsg(FLOW_ID,V_FLOW);
    MyMessage lastCounterMsg(FLOW_ID,V_VAR1);
    MyMessage tempmsg(TEMP_ID, V_TEMP);
    
    OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
    DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. 
    float lastTemperature[MAX_ATTACHED_DS18B20];
    volatile unsigned int numSensors = 0;
    
    double ppl = ((double)PULSE_FACTOR / 1000.0);    // Pulses per liter
    boolean pcReceived[NFLOWS];                      // received volume from prior reboot
    double oldflow[NFLOWS];                          // keep prior flow (only send on change)
    unsigned long oldflow_cnt[NFLOWS];               // only send when changed
    
    
    // updated in ISR
    volatile unsigned int mcnt = CHECK_FREQUENCY;   // decremented in ISR at 1000Hz. Cycles at one per second to update send counters
    volatile unsigned int tempsendcnt[MAX_ATTACHED_DS18B20];  
    volatile unsigned int maxtempsendcnt[MAX_ATTACHED_DS18B20];
    volatile unsigned int flowsendcnt[NFLOWS];
    volatile unsigned int maxflowsendcnt[NFLOWS];
    volatile bool flow_status[NFLOWS];              // status of flow (on or off cycle)
    volatile unsigned long flow_cnt[NFLOWS];        // counter volume for each flow sensor
    volatile unsigned int intervalcnt[NFLOWS];      // keep track of number of milliseconds since we had previous flow info
    
    void before() { 
      for (uint8_t i=0; i<NFLOWS; i++) {
        pinMode(FlowPins[i], INPUT);
      }
      // Startup up the OneWire library
      sensors.begin();
      for (uint8_t i=0; i<NFLOWS; i++) {
        oldflow[i] = 0;
        flow_status[i] = false;
        flow_cnt[i] = 0;
        oldflow_cnt[i] = 0;
        pcReceived[i] = false;
        flowsendcnt[i] = MIN_FLOW_SEND_FREQ;
        maxflowsendcnt[i] = MAX_SEND_FREQ;
        intervalcnt[i] = 0;
      }
      for (uint8_t i=0; i<MAX_ATTACHED_DS18B20; i++) { 
         lastTemperature[i]=0;
         tempsendcnt[i] = 0;
         maxtempsendcnt[i] = MAX_SEND_FREQ;
      }
    }
    
    void setup() {
       Serial.println("setup()");
       // Timer0 is already used for millis() - we'll just interrupt somewhere
       // in the middle and call the TIMER0_COMPA_vect interrupt
       OCR0A = 0xAF;
       TIMSK0 |= _BV(OCIE0A);
       sensors.setWaitForConversion(true);
       // Fetch last known pulse count value from gw
       for (uint8_t i=0; i<NFLOWS; i++) {
         request(FLOW_ID+i, V_VAR1);
       }
    }
    
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("WTW flow sensor", "1.2");
    
      // Register all sensors to gw (they will be created as child devices)
      numSensors = sensors.getDeviceCount();
      Serial.print("# temp sensors: ");
      Serial.println(numSensors);
      DeviceAddress add;
      for (uint8_t i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) { 
         present(TEMP_ID+i, S_TEMP);
         Serial.print(i);
         Serial.print("=");
         sensors.getAddress(add, i);
         printAddress(add);
         Serial.println();
      }
      for (uint8_t i=0; i<NFLOWS; i++) {
        present(FLOW_ID+i, S_WATER);
      }
    }
    
    // function to print a device address of a Dallas temp sensor
    void printAddress(DeviceAddress deviceAddress) {
      for (uint8_t i = 0; i < 8; i++) {
        // zero pad the address if necessary
        if (deviceAddress[i] < 16) Serial.print("0");
        Serial.print(deviceAddress[i], HEX);
      }
    }
    
    
    void loop() {
      // we come here every 1000 ms (defined in CHECK_FREQUENCY)
      
      // now handle temperature
      if (numSensors>0) {
        sensors.requestTemperatures();
        for (uint8_t i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
          // Fetch and round temperature to one decimal
          float temperature = static_cast<float>(static_cast<int> (sensors.getTempCByIndex(i) * 10.)) / 10.;
      
          // Only send data if temperature has changed and no error
          if (((lastTemperature[i] != temperature && tempsendcnt[i]==0) || maxtempsendcnt[i]==0) && temperature != -127.00 && temperature != 85.00) {
            // Send in the new temperature
            send(tempmsg.setSensor(TEMP_ID+i).set(temperature,1));
            // Save new temperature for next compare
            lastTemperature[i]=temperature;
            tempsendcnt[i] = MIN_SEND_FREQ;
            maxtempsendcnt[i] = MAX_SEND_FREQ;
          }
        }
        for (uint8_t i=0; i<NFLOWS; i++) {
           if ((flowsendcnt[i]==0 && (oldflow_cnt[i] != flow_cnt[i])) || (flowsendcnt[i]==0 && oldflow[i] != 0) || maxflowsendcnt[i]==0) {
              if (!pcReceived[i]) {   //Last Pulsecount not yet received from controller, request it again
                 Serial.print("Re-request var1 for sensor ");
                 Serial.println(FLOW_ID+i);
                 request(FLOW_ID+i, V_VAR1);
                 wait(2*CHECK_FREQUENCY); // wait at least 1000 ms for gateway (cannot be sleep or smartSleep)
                 return;
              }
              flowsendcnt[i] = MIN_FLOW_SEND_FREQ;
              maxflowsendcnt[i] = MAX_SEND_FREQ;
              double volume = ((double)flow_cnt[i]/((double)PULSE_FACTOR));      
              double flow = (((double) (flow_cnt[i]-oldflow_cnt[i])) * ((double) 60000.0 / ((double) intervalcnt[i]))) / ppl;  // flow in liter/min
    
              Serial.print("Flow meter:");
              Serial.println(FLOW_ID+i);
              Serial.print("pulsecount:");
              Serial.println(flow_cnt[i]);
              Serial.print("volume:");
              Serial.println(volume, 3);
              Serial.print("l/min:");
              Serial.println(flow);
              intervalcnt[i] = 0;
              oldflow[i] = flow; 
              oldflow_cnt[i] = flow_cnt[i];
              send(lastCounterMsg.setSensor(FLOW_ID+i).set(flow_cnt[i]));     // Send  pulsecount value to gw in VAR1
              send(volumeMsg.setSensor(FLOW_ID+i).set(volume, 3));            // Send volume (set function 2nd argument is resolution)
              if (flow<MAXFLOWERROR) send(flowMsg.setSensor(FLOW_ID+i).set(flow, 2));                // Send flow value to gw
           }
        }
      }
    
      // Serial.print(end_loop-start_loop);
      wait(CHECK_FREQUENCY);
    }
    
    // Receive data from gateway
    void receive(const MyMessage &message) {
      for (uint8_t i=0; i<NFLOWS; i++) {
         if (message.type==V_VAR1 && message.sensor==FLOW_ID+i) {
            unsigned long gwPulseCount=message.getULong();
            flow_cnt[i] += gwPulseCount;
            oldflow_cnt[i] += gwPulseCount;
            oldflow[i] = 0;
            Serial.print("Received last pulse count for ");
            Serial.print(FLOW_ID+i);
            Serial.print(" from gw:");
            Serial.println(gwPulseCount);
            pcReceived[i] = true;
         }
      }
    }
    
    
    // Interrupt on timer0 - called as part of timer0 - already running at 1ms intervals
    SIGNAL(TIMER0_COMPA_vect) {
      if (mcnt>0) mcnt--;
      for (uint8_t i=0; i<NFLOWS; i++) {
         if (mcnt==0) {
            if (flowsendcnt[i]>0) flowsendcnt[i]--;
            if (maxflowsendcnt[i]>0) maxflowsendcnt[i]--;
         }
         intervalcnt[i]++;
         bool val = digitalRead(FlowPins[i]);
         if (val != flow_status[i]) {
            flow_status[i] = val;
            if (!val) flow_cnt[i]++;      // we increment counter on down flank
         }
      }
      if (mcnt==0) {
         mcnt = CHECK_FREQUENCY;
         for (uint8_t i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) { 
            if (tempsendcnt[i]>0) tempsendcnt[i]--;
            if (maxtempsendcnt[i]>0) maxtempsendcnt[i]--;
         }
      }
    }
    

    Good luck

    Bart



  • @mrc-core If I do a search for "B93 315.04 lisboa" I get MSV Janz company turn up, but I don't understand Portugese. It is probably a magnetic drive even at 1997 fabrication, but perhaps some searching will yield clues or contact the manufacturer?



  • @zboblamont I have already read that pdf there they say this:

    "The design of the Magnetic Transmission reduces the number of components
    Operating in the water, increasing the reliability of the meter."

    They also say this in the pdf:

    "Any of these models can be supplied ready to receive the
    Pulse transmission (see tele-count catalog). Ex .: MSV 1520t"

    In this last information i made a search for MSV 1520t were i found again another pdf that talks about my water meter.
    Here's the link: http://resopre.pt/conteudo.php?fam=CONTADORES,CONT_DOMESTICOS&pag=AGUA_RESOPRE.PT&detail=693

    You can see 5 water meters on that link all off them say's Magnetic Transmission "Transmissão magnética" but has you can see none off them look like mine. Has i can understand mine is the more basic off them all i do belive that i have the first generation off this water meters.

    I have done one last test yesterday leaving a water tap open and passed the hall sensor all over the water meter from side to side and top to bottom and never got any impulse digital led light turning on.
    The led did turned on when i put my finger in the top off the sensor or in cables near the pins of the sensor.



  • @mrc-core Well, I did suggest contacting the manufacturer with the information on your meter, they are better able to advise or may even sell a sensor head to retrofit. Usually these manufacturers are very helpful, and at least you speak the language.
    I know that some manufacturers insist on factory building the sensor arrangement inside the meter (Zenner?) but you may be lucky.
    The magnetic drive is more to avoid mechanical connection between the metering section and the water flow, so no axle or sealing ring to leak !
    I have a plastic Elster, it has the same magnetic coupling as yours, but I was unable to sense any changing magnetic field when I checked it, but I had already ordered the specific read head for it so was not unduly concerned, and it should arrive in next few days. This sensor pulses when a small metal arc on the small dial passes beneath the sensor every 1 litre. It was around 30 euro from memory, so not a mad price.



  • Hello,
    i have got water meter with pulse output. So I have just arduino and RFM69W. Sleep mode false/true works well with standard bootloader. Optiboot with sleep mode false works also well. But I would like to run it on battery optiboot with true sleep mode which doens work correctly. Sensor doesnt receiceve last pulse count from gw.
    Any idea how to fix it?

    0 MCO:BGN:INIT NODE,CP=RRNNA--,VER=2.1.1
    4 TSM:INIT
    4 TSF:WUR:MS=0
    8 TSM:INIT:TSP OK
    10 TSM:INIT:STATID=3
    12 TSF:SID:OK,ID=3
    14 TSM:FPAR
    145 TSF:MSG:SEND,3-3-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    743 TSF:MSG:READ,0-0-3,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    747 TSF:MSG:FPAR OK,ID=0,D=1
    2152 TSM:FPAR:OK
    2152 TSM:ID
    2154 TSM:ID:OK
    2156 TSM:UPL
    2164 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2179 TSF:MSG:READ,0-0-3,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2185 TSF:MSG:PONG RECV,HP=1
    2189 TSM:UPL:OK
    2191 TSM:READY:ID=3,PAR=0,DIS=1
    2201 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    2254 TSF:MSG:READ,0-0-3,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    2269 TSF:MSG:SEND,3-3-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1
    2283 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    2336 TSF:MSG:READ,0-0-3,s=255,c=3,t=6,pt=0,l=1,sg=0:M
    2351 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=11,pt=0,l=11,sg=0,ft=0,st=OK:Water Meter
    2367 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.1
    2381 TSF:MSG:SEND,3-3-0-0,s=3,c=0,t=21,pt=0,l=0,sg=0,ft=0,st=OK:
    2387 MCO:REG:REQ
    2398 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    2451 TSF:MSG:READ,0-0-3,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    2457 MCO:PIM:NODE REG=1
    2461 MCO:BGN:STP
    2469 TSF:MSG:SEND,3-3-0-0,s=3,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
    2476 MCO:BGN:INIT OK,TSP=1

    2486 TSF:MSG:SEND,3-3-0-0,s=3,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
    2500 TSF:MSG:SEND,3-3-0-0,s=3,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
    2514 TSF:MSG:SEND,3-3-0-0,s=3,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
    2527 TSF:MSG:SEND,3-3-0-0,s=3,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
    2541 TSF:MSG:SEND,3-3-0-0,s=3,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
    2555 TSF:MSG:SEND,3-3-0-0,s=3,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
    2570 TSF:MSG:SEND,3-3-0-0,s=3,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
    2707 !TSF:MSG:SEND,3-3-0-0,s=3,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=NACK:



  • Has it ever received a pulse count?



  • When its about 2 metres far from gateway its received. Afterthat can be moved 10 metres away and it works. But after reset has to be moved close to gateway again.
    I run also power meter pulse sensor. This has got different issue. It falls asleep before receiving pulse count from gw.



  • @ladislav Sounds like a radio problem. Are you using a capacitor on the radio power supply pins? A capacitor on all radios in your network. I have a an Ethernet gateway in our basement and a node in our attic that is two floors above it and it works fine using a NRF24 for all radios and the radio power is on the default setting and it communicates fine.



  • I having problem to place the tcrt5000 on the correct place. Can anyone please show where to put it? Is it over the black (that spins every 0.5 l)?

    I have this type of water meter alt text



  • @smilvert I am afraid your water meter does not work. On many other watermeters the black spinning wheel is somewhat bigger and has a small mirror attached. The light from the IR LED is reflected by the mirror and the IR sensor picks up the reflection as a pulse every rotation (in your case 0.5 L). I suggest you buy another water meter that has a sensor build in and provides you with a direct signal. In my home I have separate water meters for each water consumer (such shower, hot water, kitchen, etc.).

    I am using a Honeywell C7195A2001B which has a hall sensor that pulses at 7 Hz per liter/min, so you will get 420 pulses per liter. These meters are typically used in boiler or central heating systems that also can provide hot water for your shower. You need to modify the source code a bit to handle the high pulse frequency, but the nice thing is that the measurement is very accurate.

    regards

    Bart



  • @smilvert You could try a magnometer. I successfully used one on my gas meter that didn't have a magnet in it. Look up "gas meter using a magnometer" in this forum. The code is much different than using the standard water meter sketch.



  • @smilvert @dpcr
    I really doubt this type of water meter having a magnet to sense. Gas meters often are prepared to use a special reed swich to be mounted somewhere outside on the enclosure, and the magnet comes pretty close to the enclosure to be sensed.

    I somewhere found a different solution approach using a modified TCRT5000 board with green LED and a specific lightsensor (see here for details, german).

    The idea behind it is to use complementary (green) light to one of the red pointer wheels to improve contrast when the small pointer passes.

    I recently did some first test wrt. to this, but different to the mentioned solution, I used the original LED/sensor places to connect these two parts (and also changed the resistors values). Unfortunately, I wasn't able to test it "at the right place" until now. As far as I can see, the TCRT5000 inside just also consist of two seperate parts inside a housing. So you may try to do it like that: just pull of the plastic housing, change the LED (see TCRT datasheet which one) with a green one, focus LED and sensor a little more than normal and see, if you get reasonable results whith the trimming resistor.

    Glad for feedback, if this works...



  • @rejoe2 A magnetometer doesn't need a magnet to work, my gas meter doesn't have a magnet and it works fine. Most all smartphones have magnetometers in them to sense direction. However your solution looks to work as well and probably with less code.



  • @dpcr Thanks for clarification.
    Today there was a new post that may be of interest wrt. to the "green" LED sensing modification: https://forum.fhem.de/index.php?action=post;quote=702342;topic=71341.0;last_msg=702342
    This one seems to be close to a "professional" solution also wrt. to the other parts used (but most likely not on a TCRT5000-Base)...



  • I have a question and need some advise,
    is it possible to expand the sketch to two meters.
    In my case I want to combine a this Water Meter with a Gas Meter.
    Can both meters use an interrupt, each?


  • Mod

    @rpunkt welcome to the MySensors community!

    it depends on which microcontroller you use, and what type of interrupt.

    Atmega328 can use pin 2 and 3 at the same time by merging the sketches. More/other pins can be used but that will require some code changes.



  • @smilvert
    I also have same meter as the picture. Yesterday I installed my sensor
    I took a TCRT5000 IR sensor, https://www.mysensors.org/store/water
    A cap from a soda bottle, cut it so it fits above left red wheel(X0,0001) which means one lap i 1 liter
    It works but it counts little bit wrong, I have change the

    if (interval<500000L)
    

    to

    if (interval<2500000L)
    

    but anyway it counts about 3 times to much. I will check it later today

    0_1518429857989_vatten.png
    0_1518429910010_water.png



  • @flopp
    This didn't worked so well, I got a lot of errors everytime nRF was sending data, then I got one pulse.
    Anyone know how to protect the digital input to NOT fall when nRF sends?
    Wait, when I was writing this text 🙂 I just remember that nRF is using Pin 2, is that correct?
    I will try to use pin 3 instead, as interrupt pin



  • @flopp
    tried pin3, didn't help

    Can it be something wrong with LM393(pcb)?



  • @flopp Nice. You don't use a green led? I tried that and it seems to work better but then I struggle with the mounting.

    Need to try this again!



  • @smilvert said in 💬 Water Meter Pulse Sensor:

    You don't use a green led? I tried that and it seems to work better but then I struggle with the mounting.

    I am using IR to detect movements. Green LED is flashing eveytime the IR detects movement and Red LED is power for PCB.
    I am using Digital Output from PCB to pin 2 or 3 on my UNO. I have tried both with INPUT_PULLUP and without, also tried 20K between Digital Output and GND. nothing is helping

    How do you use green LED with water meter?



  • Hi all i just wanna see The OUTPUT of Serial Monitor for this project sow i can see results .


  • Mod

    Just enable the my_debug



  • How can i get the pulses from SonOff.... i cannot find any digital pin 3 in sonoff... im new to this please guide me


  • Hardware Contributor

    Any one used this approach? From the text I see that the node sleeps! How does it measures the consumption if the node is sleeping?

    Thank you


  • Mod

    @soloam could you clarify what you refer to when saying "this"? Earlier posts discuss infrared, led, magnetometer and other solutions so it is a bit hard to answer your question.


  • Hardware Contributor

    @mfalkvidd hello!

    I was referring to this statement in the site:

    "Use this mode if you power the sensor with a battery. In this mode the sensor will sleep most of the time and only report the cumulative water volume."

    Thank you


  • Mod

    according to the sensor you use, each pulse should wake the node and add a count, then back to sleep.


  • Hardware Contributor

    That is nice! But I would have to test it out! Probably that would make the node all the time awake during a long bath! Ok, it would not use the radio all the time, but I would like to know who that would affect the battery!

    Thank you all for the feedback



  • @soloam
    We sometimes forgot about other circuit than Arduino.
    Use CMOS counter IC and wake up your Arduino for example every 20 impulse and read counter status.
    If you want Safe battery.


  • Hero Member

    @flopp Did you ever manage to stabilize the readings? Am I understanding you correctly that the readings were fine but the transmission got the reading scrambled?

    Did you try to find a magnetic field with the meter instead? I have a similar meter and I'm wondering how best to approach the problem. I've seen people hook up Raspberries and cameras to do OCR basically but that seems like way too complex for an easy problem.



  • @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 + OCR

    https://forum.mysensors.org/topic/1594/automatic-water-meter-reading-with-a-webcam
    https://blog.m.nu/vattenmatning-med-raspberry-pi-och-webkamera/


  • Hero Member

    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.



  • @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.



  • @bjacobse Another option perhaps to consider (if it is physically viable), is to insert a meter and sensor of your choice within your property, they are not expensive nowadays and easy enough to fit ?
    A simple meter and reed switch such as this link text or similar perhaps.



  • @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.



  • @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.org

    4: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


  • Mod

    it looks like it is can't find the radio module. Check cables and pins numering



  • 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.


  • Mod

    Don't you have another sensor to try?



  • @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



  • here 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++;
    }```


  • looks like the problem is the node is NOT sending initial value to gw
    need your help modifying the sketch accordingly
    thank you



  • Is it possible to get any help on this page or not?



  • @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?



  • @rejoe2 thank you. How do i trigger "the counter on Node side"?



  • ...just let the node count some pulses (your code states: FALLING). So just pull the counter PIN (here: D3) to ground several times.



  • @rejoe2 i did like you said, still no show in HA
    here is the serial log:

     __  __       ____
    |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
            |___/                      2.3.0
    
    16 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.3.0
    26 TSM:INIT
    28 TSF:WUR:MS=0
    34 !TSM:INIT:TSP FAIL
    36 TSM:FAIL:CNT=1
    38 TSM:FAIL:DIS
    40 TSF:TDI:TSL
     
     __  __       ____
    |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
            |___/                      2.3.0
    
    16 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.3.0
    26 TSM:INIT
    28 TSF:WUR:MS=0
    34 TSM:INIT:TSP OK
    36 TSM:INIT:STATID=6
    38 TSF:SID:OK,ID=6
    40 TSM:FPAR
    77 TSF:MSG:SEND,6-6-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    532 TSF:MSG:READ,0-0-6,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    538 TSF:MSG:FPAR OK,ID=0,D=1
    624 TSF:MSG:READ,31-31-6,s=255,c=3,t=8,pt=1,l=1,sg=0:1
    1267 TSF:MSG:READ,21-21-6,s=255,c=3,t=8,pt=1,l=1,sg=0:1
    1546 TSF:MSG:READ,41-41-6,s=255,c=3,t=8,pt=1,l=1,sg=0:1
    2088 TSM:FPAR:OK
    2088 TSM:ID
    2091 TSM:ID:OK
    2093 TSM:UPL
    2097 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2103 TSF:MSG:READ,0-0-6,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2109 TSF:MSG:PONG RECV,HP=1
    2113 TSM:UPL:OK
    2115 TSM:READY:ID=6,PAR=0,DIS=1
    2119 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    2127 TSF:MSG:READ,0-0-6,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    2138 TSF:MSG:SEND,6-6-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.0
    2148 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    2242 TSF:MSG:READ,0-0-6,s=255,c=3,t=6,pt=0,l=1,sg=0:M
    2250 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=11,pt=0,l=11,sg=0,ft=0,st=OK:Water Meter
    2260 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.1
    2273 TSF:MSG:SEND,6-6-0-0,s=1,c=0,t=21,pt=0,l=0,sg=0,ft=0,st=OK:
    2281 MCO:REG:REQ
    2289 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    2297 TSF:MSG:READ,0-0-6,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    2304 MCO:PIM:NODE REG=1
    2306 MCO:BGN:STP
    2310 TSF:MSG:SEND,6-6-0-0,s=1,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
    2318 MCO:BGN:INIT OK,TSP=1
    32319 TSF:MSG:SEND,6-6-0-0,s=1,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
    


  • @bereska said in 💬 Water Meter Pulse Sensor:

    32319 TSF:MSG:SEND,6-6-0-0,s=1,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:

    Logparser states: there was nothing counted (empty payload). So make sure, there really was counted anything.
    (I didn't check your sketch, just assuming, it's the default one and everything is wired correctly; if that's the case, you should be able to see a different payload than nothing or "0", that your controller might treat as non existent).



  • @mfalkvidd how looks the sensor now with the modifications? and how to wire this?


  • Mod

    @stevefury sorry, I don't understand. Which modifications are you referring to?



  • I'm just getting this....

    16:57:15.660 -> 10091 TSM:FAIL:RE-INIT
    16:57:15.660 -> 10093 TSM:INIT
    16:57:15.660 -> 10101 !TSM:INIT:TSP FAIL
    16:57:15.660 -> 10103 TSM:FAIL:CNT=2
    16:57:15.660 -> 10107 TSM:FAIL:DIS
    16:57:15.713 -> 10111 TSF:TDI:TSL



  • @ibibiuooui said in 💬 Water Meter Pulse Sensor:

    !TSM:INIT:TSP FAIL

    See https://www.mysensors.org/build/parser: There's a problem in the initialisation of your transceiver (whatever it may be). So first check wiring, see https://forum.mysensors.org/topic/666/read-this-first-it-could-save-you-a-lot-of-time for further details. If that doesn't help, imo you should open up a seperate thread.



  • I am finally getting around to trying this out. I was playing with just trying to see if i can get the pulses. First thing i did was take an old compass and put it beside the meter and had someone turn on the water. I could definitely see the compass needle pull a little as the water was flowing. So I assumed that pull was enough to be detectable with my hall effect sensor. I have tried a couple, and just can't seem to get it to pick up.

    If i use a magnet, simple code will detect the pulse and the green led on the sensor lights up.

    But no matter where I put that sensor near the meter it just doesn't seem to detect it. Not quite sure what's happening.

    The meter i have is this one.
    https://www.badgermeter.com/resources/add29b88-1ffb-49c9-80ab-bb8697bd6d1a/absolute digital encoder product data sheet ade-ds-00183-en.pdf/

    Not sure if anyone has any recommendation on which hall effect sensor would be the best for this but ill take suggestions lol

    My sensor I am testing with is
    3144E Hall Effect Sensor

    Doesn't have a sensitivity dial but the recommended one on this build page didn't either.



  • @bart59 Can you post full circuit diagram for the modified code you made?



  • I made some improvements on this sketch. Please review them here: https://github.com/mysensors/MySensors/pull/1540

    with these changes you will have:
    1 - factory reset
    2 - automatic home assistant entities creation
    3 - counter correction from home assistant using service notify.mysensors
    4 - fixed counter automatically incremented by 1 at each device restart (due to arduino library interrupt bug)
    5- other tiny improvements



  • Thanks for the feedback

    For those who think MySensors is finished, the proof is in the pudding, thousands of systems are functional 🌏



  • I really like the update you did for Home Assistant integration.

    But: I do not really understand, how to correctly send the VALUE_TO_ADD.

    This is what I tried to add 967.067 m³:

    service: notify.mysensors
    data:
      message: VALUE_TO_ADD
      target: text.water_meter_100_2
      data: 967067
    

    But I just get this error message:

    Fehler beim Aufrufen des Diensts notify.mysensors. expected dict for dictionary value @ data['data']. Got None
    

    These are my newly found entities:
    4a37f961-0218-41b2-9a4d-c368e42e9e2d-image.png

    What is wrong here?



  • I finally got this to work. Unlike what the description here says, this is how to update the value:
    In Home Assistant, go to Developer->Service->YAML mode:

    service: text.set_value
    data:
      value: "967067"
    target:
      entity_id: text.water_meter_100_2
    

    (change 967067 with the value you want to add to the current counter)

    The service "notify.mysensors" seems to be deprecated by Home Assistant.


Log in to reply
 

Suggested Topics

  • 3
  • 164
  • 2
  • 347
  • 2
  • 109

0
Online

11.4k
Users

11.1k
Topics

112.6k
Posts