ESP8266 - IO settings for an Impulse Sensor

Hi there,

this should be a very simple topic - but somehow, I just don’t see what’s wrong right now.

I have a couple of Water Meters, which are equipt with an Impulse Device.
This Device has it’s own Power Source (battery).

I want to read the impulse signal with an ESP8266 …

So, here are the basics of the impulse device:

Type of Pulse: S0
PowerSupply: internal battery
Parameters: 12-27 VCD, 30mA
Internal Resistance: >200 ohms
Pulse lenght: >45ms
permanently short-circuit proof: up to 6V
Pulse value: 1 liter / pulse

Wires:
S0 + (white)
S0 - (brown)

So…
I have set up my ESP8266…
and two of these meters (same specs)
I am using GPIO14 (meter1) and GPIO15 (meter2)

GPIO 14 is “high” when the device boots up
GPIO 15 is “low” when the device boots up

S0- is connected to GND
S0+ is connected to GPIO 14 for meter 1 and GPIO 15 for meter2

this config should be a simple test if I actually get a signal

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO14
      mode: INPUT_PULLUP
    name: "Sensor 1 Test"
    # default: high

  - platform: gpio
    pin:
      number: GPIO15
      mode: INPUT_PULLUP
    name: "Sensor 2 Test"
    # default: low

So - now the question for which I am too stupid right now:

  1. is it right to connect the impulse-thighy in this way (S0- to GND?)

  2. how can I configure GPIO14 to be low, just like GPIO15 ?

Gpio15 is pulled down, use some other pin like 12 or 13.
Or if it works on your circuit, gpio 14 needs pulldown as well.

Post some simple scheme/drawing of your circuit to understand better.

thanks.
this is a “roughtly” sketched layout…

As said, the impulse-thingy on the meter has its own power… therefore, the S0- is connected to GND.

Sry - regarding the IO pins:
GPIO15 is low, when the ESP boots up.
This should be correct, as it should be high, when the impulse from the meter comes.
So, I should use a different pin for GPIO14, right?
Or do I have any way to “pull this one down” by default?

Also, I just found some references about adding this to the config:

  count_mode: 
    rising_edge: DISABLE
    falling_edge: INCREMENT

Or vice versa

  count_mode: 
    rising_edge: INCREMENT
    falling_edge: DISABLE

I think, I have too many things ongoing atm… somehow, getting confused and can’t think anymore…

No.
Gpio14 is pin that you can pull down or up. Gpio15 is hardwired to down.
It’s not easy to follow your your scheme or your description, but likely you need pins pulled down. Try with pins 12/13/14 and 10k resistor to GND.


Follow common collector setup.

Ps. If you have Esp32 board available, it would be easy to accomplish without hardware resistors.

Thanks :slight_smile:

I have some esp32, as well as some esp32s3 (Zero) and ab esp32c6 (Zero) left…

Right now, the esp8266 was the one I had left and was the smallest size (before I got the s3 and c6 to Play around with it)…
And from the Hardware Itself, it should still be fine fir thus Job.

I have to create some more of those for several other Meters, there, I will probably use the other esps.

I will Setup another Prototype Board and redo my Sketches.
Haven’t had a good day, Yesterday … ^^

Try it like this:

Be aware, that it’s not guaranteed to work if your impulse “device” specs are 12-27V.

yeah. thank you.
I need to measure the Voltage of it.

If it is too high for the esp, I’ll probably need something to step it down… :thinking:

Else, I need to consider another way to get my water meter readings done…

There is no voltage on S0 contacts. It’s NPN-circuit, you need to provide the voltage.
On the image I posted, it’s 3.3V and if that works, pulldown resistor is all you need.

ok, based on the specs of the meter, the hardware that will give the impulse, does have its own pwr supply via battery.

here’s the specification sheet, unfortunately, it is in german and I haven’t found a translation yet.

Yes but it doesn’t output any voltage from that power supply.
The datasheet says clearly it’s open collector output.

hm… ok, all right - thank you :slight_smile: