Doorbell with a passive buzzer

I am interested in incorporating a passive buzzer into my project so that when the doorbell rings, the buzzer emits a corresponding sound. However, for unknown reasons, this function is not operating as expected. Additionally, I am unsure if I need to assign a new GPIO for this purpose. Any suggestions or recommendations to solve this issue?

esphome:
  name: "esp32-cam-esphome"

esp32:
  board: esp32dev
  framework:
    type: arduino

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
 
logger:
  level: INFO
 
# Enable Home Assistant API
api:
  encryption:
    key: "K+CDI+ql4NGjAvZ4OTGbtnYuVdAcAWSVKC2IsrZ6/0I="
 
ota:
  password: !secret ota_password

text_sensor:
  - platform: wifi_info
    ip_address:
      name: Doorbell IP
 
esp32_camera:
  external_clock:
    pin: GPIO0
    frequency: 20MHz
  i2c_pins:
    sda: GPIO26
    scl: GPIO27
  data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
  vsync_pin: GPIO25
  href_pin: GPIO23
  pixel_clock_pin: GPIO22
  power_down_pin: GPIO32
  name: "Camera da entrada"
  
  # Image settings
  resolution: 800X600
  jpeg_quality: 10
  max_framerate: 10 fps
  idle_framerate: 0.1 fps
  vertical_flip: false
  horizontal_mirror: false
  brightness: 2 
 
esp32_camera_web_server:
  - port: 8080
    mode: stream
  - port: 8081
    mode: snapshot

switch:
  - platform: gpio
    pin: GPIO4
    name: "Doorbell LED"
  - platform: restart
    name: "Doorbell Restart"

output:
  - platform: ledc
    pin: GPIO15
    id: rtttl_out
    inverted: True
    
rtttl:
  output: rtttl_out

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO13
      mode:
        input: true
        pulldown: true
    name: "Doorbell"
    filters:
      - delayed_on: 25ms
      - delayed_off: 2s # prevents from re-ringing within 2 seconds
    on_press:
      - rtttl.play: "ding_dong:d=8,o=4,b=70:d,e,d,e"

  - platform: status
    name: "Status Doorbell"

Ok - what is it doing? Is the rtttl.play not working? Or something else?

Can you post the logs?

2 Likes

Did you try it without this?

The test set-up can be handy for debugging.

You should probably avoid gpio15.

1 Like

did you verify it was working before you added it to your door bell cam project? These things are so hard to hear when they’re sitting 4’ away on your workbench. You’ll never hear it if it’s inside some outdoor enclosure. As far as changing gpio’s, you’re probably fine with 15 but, it is a strapping pin and outputs pwm signal on boot so if you have other options, I would change it just to avoid other issues or chirping sounds on boot.

I suspect the actual problem has to do with using multiple outputs with the esp32-cam while sharing a single output. You see this a lot with people trying to add servo motors to an esp32-cam. The camera for whatever reason, it doesn’t play nice or like to share it’s timer with other outputs. Try manually changing your output channel for the buzzer like this.

output:
  - platform: ledc
    pin: GPIO15
    id: rtttl_out
    inverted: True
    channel: 2

1 Like

Indeed, the distance from the project, low volume, and external noise made me not notice the melody. Additionally, there was a small compilation error, which has already been corrected. Nonetheless, I attempted to increase the volume by adjusting the frequency with different values, but it had no effect

Ya, ive been there too. I had a cool idea way back for one and could hardly hear it without getting right up next to it. Ive never looked but there may be better or more powerfull ones. The other option is esphome has really handy components for playing media. Get yourself a DAC and a small amp and speaker. Hell if your going to go through the trouble of adding sounds to your doorbell, go big!

What do you make of all these people who build large projects and incorporate a buzzer? I can only assume they didnt test first either and now its purely decorative or the disappointment is delayed untill they do try it.

Mine are all definitely loud enough for my applications. But they’re basically “same room” reach.
I tend to make a small hole through my enclosures and hot glue gun them in position within.

If you have a “mesh network” of them around your place they would work ok for a doorbell. But yeah not going to work well across a house! I think you can get higher voltage ones.

My interest in a buzzer doesnt go beyond playing with the ones that come in a sensor kit but, i agree you can probably find better quality ones. Personally, id look for other ways to produce tones/beeps. Something about that sound, its like having a blown speaker on your commercial paint mixer, its very unpleasant when you can hear it.

I like them in a twisted way. My coffee machine plays Sweet Child of Mine if I go near it, it’s on, and the water is low. Mario Bros end-of-life sound if CO2 levels are high. RF reciever/transmitter makes a beep so I know things are working. Could do tones over my multi-room smart speakers etc, but like the retro ringtone vibe.

I just use these Ali Express cheapies at 10c a pop…

I only use them for button acknowledgment, and patterns of beeps to confirm a setting has changed. All stuff where you are standing in front of the panel.

Any further away I find they are pretty useless.

The rtttl component apparently supports an I2S interface now, they usually have a built in amp. I am going to try that for timer device with a small speaker - hopefully it will be appreciably louder.

1 Like

So your going to use a speaker but keet rtttl and stay limited to playing the same cringy beep sounds but louder? If thats what floats your boat, go for it

What would you recommend for a standalone device (not always connected to HA or the network)? Can I use wav files stored on the ESP?

Sorry - getting off-topic here…

I noticed these recently and have a few on the way.

Might be able to make a wider range of louder cringy beeps;)

AU$1.07 | 1PCS Mini MP3 Player Module TF Card U Disk Mini MP3 Player Audio Voice Module Board For Arduino DF Play Wholesale
https://a.aliexpress.com/_mrfmzEg

1 Like

mp3 files stored on an sd card and a dfplayer. It can be used stand alone or with esphome or HA automations. Lot’s of possibilities! You could even record those cringy buzzer tunes, convert them to .mp3 and then you can have the best of both, clean audio and those beeps you like.

May be a bit of overkill for a proofing cupboard where the use case is just to hear an alarm from a 10 metres away. The hardware is also pre-existing.

They are pretty cheap though, a couple of dollars plus an sd-card.

I thought you were the one that said you put a buzzer in your coffee maker and it plays tones from Mario Brothers but, it was another person. I would definitely agree that its overkill but, some people have a much higher threshold for their overkill obviously.