Home Assistant Switch for 120dB Siren on GPIO5
- Code can compile on ESP8266/32
- Uses WiFiManager to get WiFi/MQTT info from users
- Gets auto-discovered by Home Assistant as a MQTT switch
- Web-Server/WebSockets to control alarm
- REST-API to control alarm
- 120dB Siren is connected to D1/GPIO5
- GPIO0/FLASH_BUTTON acts as "test"
platformio.ini is included, use PlatformIO and it will take care of installing the following libraries.
Library | Link |
---|---|
MQTT | https://github.com/256dpi/arduino-mqtt |
Bounce 2 | https://github.com/thomasfredericks/Bounce2 |
ArduinoJson | https://github.com/bblanchon/ArduinoJson |
WiFiManager Develop | https://github.com/tzapu/WiFiManager/archive/development.zip |
Arduino WebSockets | https://github.com/Links2004/arduinoWebSockets |
UpdateUploadServer (ESP8266) | https://github.com/debsahu/DDUpdateUploadServer |
- ESP8266 (aliexpress) / ESP32 (aliexpress)
- 120dB 12V Siren (amazon)
- IRLB8721 N-channel MOSFET (adafruit)
- 3S Battery (amazon)
- B3 Charger (aliexpress)
- Project Box (amazon)
- Use N-channel MOSFET, exact one used here is IRLB8721: works with 12V, gate can be controlled by 3.3V signal
- Connect the gate of MOSFET to D1/GPIO5, source to GND, drain to -ve of siren, +ve of battery to +ve of siren
- Use 300k and 100k voltage divider for checking battery voltage of 3S battery