Inductive npn sensor and raspberry pi

Someone familiar with connecting a sensor to read the water meter using an ‘npn sensor’.
In the link there is an explanation but it is not for this platform. Would like the same.

https://ehoco.nl/watermeter-uitlezen-in-domoticz-python-script/

It outputs a pulse every litre.

Use a GPIO binary sensor to trigger an automation to increment a counter. That will show the total volume in L.

oké, will try that.
don’t know how to start but, will find a way.
also I have to find a way to make a history of water consumption.
is there anyone how already Re-inventing the wheel?

ESPhome and the PulseCounter Sensor and an ESP32 or ESP8266 microprocessor make this a fun and relatively simple project.

With the ESP micro, connecting the NPN inductive sensor is very similar to connecting with the Raspberry Pi. Blue wire to GROUND/GND, black wire to any of the IOnn GPIO pins, and the brown wire to 5VDC power. Then, in the ESPHome plugin, the yaml would look similar to this:

esphome:
  name: water_meter
  platform: ESP8266
  board: d1_mini

# Enable logging
#
logger:
  level: DEBUG

 sensor:
  - platform: pulse_counter
    pin: GPIO5
    unit_of_measurement: 'litre'
    name: 'Water Meter'
    filters:
      - multiply: 0.06

wifi:
  ssid: "YOUR_SSID"
  password: "YourWifiPassword"
  fast_connect: true

# Enable Home Assistant API
api:
  password: "another_password"

ota:
  password: "another_password"

This example shows the black sensor/signal wire connected on GPIO5/IO5 on a Wemos D1 ESP8266 microprocessor. You should adjust the filters/multiply decimal value to match the actual results for your specific water meter.

Hope this helps!!

2 Likes

This my config in ESPhome

sensor:
  - platform: pulse_counter
    pin: GPIO5
    unit_of_measurement: 'Liter'
    name: 'Water Meter'
    update_interval: 60s
    filters:
      - multiply: 0.1

I als want to count the daily use of water. And a beautify graph to show the use of water for a longer periode.

Can someone share his config? Basic config will be fine.

strange graphic.
so the above config is not perfect.
some any Idea how to solve the issue

Is there someone how can share his config for the dutch water meter?

My code at the moment. And its not working :hot_face:

esphome:
  name: sensor_01
  platform: ESP8266
  board: esp12e

wifi:
  ssid: "#####"
  password: "####"

# Enable logging
logger:
  level: DEBUG

# Enable Home Assistant API
api:
  password: "####"

ota:
  password: "####"

sensor:
  - platform: pulse_counter
    pin: GPIO5
    unit_of_measurement: 'Liter '
    name: 'Water meter'
    id: pulse
    update_interval: 60s
    filters:
      - multiply: 0.0001

  - platform: template
    name: "Water meter totaal"
    unit_of_measurement: 'Ltr'
    lambda: |-
      static float total_value = 0.0;
      total_value += id(pulse).state / 1000;
      return total_value;

  - platform: integration
    name: "Water total"
    sensor: pulse
    time_unit: min
 
  - platform: pulse_counter
    id: water_pulse
    pin: GPIO5
    internal: true
    name: "Water Counter 2"
    update_interval: 60s
    filters:
      lambda: |-
        static float total_pulses = 0.0;
        total_pulses += x * 1 / 60.0;
        id(lifetime_counter).publish_state(total_pulses / 17);
        return x ;
  
  - platform: template
    id: lifetime_counter
    name: "Water Total 2"
    unit_of_measurement: "L"
    
  - platform: template
    name: "Water Flow 2"
    id: water_flow_rate
    accuracy_decimals: 1
    unit_of_measurement: "L/min"
    icon: "mdi:water"
    lambda: return (id(water_pulse).state /17);
    update_interval: 60s

 

Needed:

  • Daily Ltr
  • M3 overall

Don’t need any use per min
Just want to check how many my family is using.
Or how much water is used to fill up the swimming pool

let’s kick an verry old topic :smiley:
But did you solve this ? Running against the same troubles

It is still not working yet in my case.
My code is not working.
Any solution?

haha busy for years now :slight_smile: i’ve got no solution.
I was looking for a code like your’s , but if it’s not working i can’t use it .
tried a few thing to solve it.
What’s the lastest code you’re using nowdays ?

The code I posted about years ago… approximately 17-sept-2019 :rofl:

sept 17
17 sept
:innocent:

and nothing changed :stuck_out_tongue: you’ve got a wong / not working code for year’s :smiley:

hope somebody can / will help us ?

There are other threads about pulse driven meters. Use the search.