Dumb Doorbell come smart by a sound technique. 'Weirding Way'

I have an old Videx intercom that acts as a doorbell by the speaker end of the handset buzzing. It’s difficult to hear it in other parts of the house. I had put an esp32 with a 5V dry contact relay in the handset so I could open the gate remotely. I didn’t fancy connecting anything directly to the buzzer. So I attached a KY-038 to the esp32 as well.

Added a biniary sensor by gpio to the ESPhome bin.
Setup an automation to notify me by telegram bot when KY-038 detected a loud sound like the buzzer right next to it going off. The problem was it also alerted me when it picked up doors slamming in the hall where the buzzer was.

Noise Intercom

The first 2 readings are doors and the 3rd reading is the longer buzzer.
The binary sensor of the KY-038 would fire off multiple times on/off for a door slam and several times more for a buzzer.

  - platform: gpio
    pin: 2
    name: "Sound level"
      - delayed_off: 35ms

I started trying different filters for the binary sensor. I found at 35ms a door slam would generate 2 or 3 on/off’s and a few more for the buzzer. Adjusting potentiometer on KY-038 is too difficult to useful.
I then setup an automation to count the on/off’s and only send a telegram when got more than 4. I set it to reset the count every minute

In configuration.yaml

      name: loudnoise
      icon: mdi:clock-start
      initial: 0
      min: 0
      max: 6
      step: 1

in automations.yaml

- alias: 'Automation to increment input_number when sensor is turned on'
  - platform: state
    entity_id: binary_sensor.sound_level_2
    to: 'on'
    from: 'off'
    - service: input_number.increment
        entity_id: input_number.loudnoise

- alias: 'Reset input number after 1 minute after the sensor is triggered for the first time (after sensor triggering the input number becomes 1)'
  - platform: numeric_state
    entity_id: input_number.loudnoise
    above: '0'
    below: '2'
  - delay: 00:01:00
  - service: input_number.set_value
      entity_id: input_number.loudnoise
      value: '0'

- alias: 'Turn on switch when input_number.loudnoise reaches 4'
    platform: numeric_state
    entity_id: input_number.loudnoise
    above: 3
    below: 6
    - service: notify.telegrambot   
        message: Doorbell 

Seems to work so far.

1 Like

Hello, I noticed nobody commented on this. Just wanted to say that this is brilliant. I am finding more and more people don’t know how to get answers to problems, so they quit. This is why I teach my child the importance of being bored. You become very creative this way. This is a result of creativity!!

Now I am going to try this on my intercom, thank you!

Yes it was a good way to spend a long day at home. I later was brave and connected a sensor directly to the buzzer. Videx buzzer by INA219 voltage sensor No false positives. Good luck with the project. :+1: