Thats a good idea- will try that.
This is the schematic
I was thinking the same. An rttl buzzer has Vcc gnd and io.
Not sure now. The D5, D6, D7, D8 look like alternatives. D5 has a solder link in the picture on the WeMos page, change the link to to change the GPIO.
To get a translation of D numbers to GPIO see ESP8266 Pinout Reference: Which GPIO pins should you use? | Random Nerd Tutorials
Can you recommend an appropriate buzzer?
switch:
- platform: gpio
pin: 5
id: buzz
name: "buzzer"
on_turn_on:
- delay: 5ms
- switch.turn_off: buzz
- delay: 5ms
- switch.turn_on: buzz
- delay: 5ms
- switch.turn_off: buzz
- delay: 5ms
- switch.turn_on: buzz
- delay: 5ms
- switch.turn_off: buzz
You could treat it as a switch and turn it on and off a few times quickly.
This is a passive buzzer module
But looking at the driving circuit above from the site only ground connection and transistor supplying + voltage. Sorry not + but -. Is that a NPN transistor?
Yep I revised above.
Some research reveals using this device with rttl
You have now totally lost me.
So should it have worked with the above?
The sample code is here D1_mini_Examples/examples/04.Shields/Buzzer_Shield/Do_Re_Mi at master · wemos/D1_mini_Examples · GitHub
The link on the WeMos page is wrong, but close.
Show your whole yaml , just in case a simple error.
That is in Arduino? I struggle with ESP never mind ARD.
Yes it should work. Maybe the pin needs to be inverted.
Looking again of course the signal is present in the pic. Don’t know why I didn’t see that.
substitutions:
name: esphome-web-6f71c4
friendly_name: buzz
esphome:
name: ${name}
friendly_name: ${friendly_name}
name_add_mac_suffix: false
project:
name: esphome.web
version: '1.0'
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
#api:
# Allow Over-The-Air updates
ota:
# Allow provisioning Wi-Fi via serial
improv_serial:
wifi:
# Set up a wifi access point
ap: {}
# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:
output:
- platform: esp8266_pwm
pin: 14
id: rtttl_out
inverted: True
zero_means_zero: True
frequency: 1000.0
rtttl:
output: rtttl_out
on_finished_playback:
- logger.log: 'Song ended!'
api:
services:
- service: play_rtttl
variables:
song_str: string
then:
- rtttl.play:
rtttl: !lambda 'return song_str;'
- output.turn_off: rtttl_out
Should be 5
I thought pin was the GPIO and not the D number?
You can try D1,GPIO5 or 5.
When installing the code it does all and then stops
[23:30:57][C][esp8266_pwm:023]: Pin: GPIO5
[23:30:57][C][esp8266_pwm:024]: Frequency: 1000.0 Hz
[23:30:57][C][rtttl:029]: Rtttl
[23:30:58][C][captive_portal:088]: Captive Portal:
[23:30:58][C][mdns:115]: mDNS:
[23:30:58][C][mdns:116]: Hostname: esphome-web-6f71c4
[23:30:58][C][ota:096]: Over-The-Air Updates:
[23:30:58][C][ota:097]: Address: esphome-web-6f71c4.local:8266
[23:30:58][C][ota:103]: OTA version: 2.
[23:30:58][C][api:139]: API Server:
[23:30:58][C][api:140]: Address: esphome-web-6f71c4.local:6053
[23:30:58][C][api:144]: Using noise encryption: NO
[23:30:58][C][improv_serial:032]: Improv Serial:
Is this correct?
Looks ok. Now go to developer tools and run the service remembering to put in the string as shown earlier