Author Topic: Digital input pin - measuring frequency?  (Read 347 times)

Lukapple

  • Full Member
  • ***
  • Posts: 177
Digital input pin - measuring frequency?
« on: January 30, 2020, 04:32:29 PM »
Hi,
can anyone recommend a simple lightweight library for measuring frequency of digital input pin signal?

I want to do a simple garage door status detector. Garage door opener has a contact, which is:
- open when door is closed,
- 0.5s open and 0.5s closed (repeating signal) when door is closing,
- 1s open and 1s closed (repeating signal) when door is opening and
- closed contact when door is open

I connected that contact to Moteino (Digital pin and GND pin) and now I want to detect the state of the door.

TomWS

  • Hero Member
  • *****
  • Posts: 1924
Re: Digital input pin - measuring frequency?
« Reply #1 on: February 01, 2020, 06:50:03 PM »
There is an Arduino library called FreqCounter that I've used for moisture sensors, but I think the sensing frequency range is higher than what you're looking for.  You might be able to create a couple of Bounce2 objects (using Bounce2 library), using the same pin as the input, but different bounce characteristics to filter out each type of signal.

Lukapple

  • Full Member
  • ***
  • Posts: 177
Re: Digital input pin - measuring frequency?
« Reply #2 on: February 03, 2020, 03:57:03 AM »
Thanks for the suggestion Tom. Iíll try with to solve that problem with Bounce lib.