esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 36 forks source link

Pulse counter counts when input remains high #4445

Closed dansity closed 1 year ago

dansity commented 1 year ago

The problem

If I'm missing something please let me know, but I have this frustrating scenario: I want to build a wind speed meter (anemometer) which has a reed switch with a magnet. Sometimes the wind stops and the magnet is in a position when the input remains high and the pulse counter keeps counting pulses. For me it seems like it is checking the pin every cycle and if it is high it adds a count. However it should only count if the state of the pin changes from low to high. This is what I'm experiencing: L H H H H H - > 5 count registered however it should be only one when low goes high

Which version of ESPHome has the issue?

2023.4.0

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

No response

What platform are you using?

ESP8266

Board

Wemos D1 mini

Component causing the issue

Pulse counter

Example YAML snippet

sensor:
- platform: pulse_counter 
  pin:
    number: GPIO5
    mode:
     input: true
     pullup: false
     inverted: false
  id: wind_speed
  unit_of_measurement: 'm/s'
  name: "WS"
  icon: 'mdi:weather-windy'
  internal filter: 13us
  filters:
  - multiply: 0.005560619
  - sliding_window_moving_average:
     window_size: 20
     send_every: 20

Anything in the logs that might be useful for us?

Log shows 900+ pulses if the pin remains high

Additional information

No response

fran6120 commented 1 year ago

Something similar happened to me and the problem was caused by a buck/boost DC converter that I used to feed a rail on the breadboard and it generated a lot of noise.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.