All Projects → tIsGoud → Doorbell-via-Wemos-and-optocoupler

tIsGoud / Doorbell-via-Wemos-and-optocoupler

Licence: MIT license
Digital version of my "analog" doorbell project to determine if the doorbell was pressed.

Projects that are alternatives of or similar to Doorbell-via-Wemos-and-optocoupler

esp8266-arduino-wifirgb
A RESTful API implementation to control an RGB LED Strip using an ESP8266 microcontroller.
Stars: ✭ 31 (-43.64%)
Mutual labels:  home-automation, wifi
arduino-primo-tutorials
Here some tutorials to explain and show how to make use of the new features of the Arduino Primo and Arduino Primo Core, such as Wifi, BLE, NFC, InfraRed and various sensors. Hope you can find this helpful to create amazing stuff, save the planet or make a cool project to look smart at the dinning table with your uncles.
Stars: ✭ 12 (-78.18%)
Mutual labels:  wifi, arduino-sketch
ESPShaker
ESP8266 interactive serial command processor via Arduino core.
Stars: ✭ 24 (-56.36%)
Mutual labels:  wifi, arduino-sketch
issues
Issue Tracker for ESPHome
Stars: ✭ 182 (+230.91%)
Mutual labels:  home-automation, wifi
Homepoint
Espressif ESP32 Based Smarthome screen for MQTT
Stars: ✭ 391 (+610.91%)
Mutual labels:  home-automation, wifi
Feature Requests
ESPHome Feature Request Tracker
Stars: ✭ 160 (+190.91%)
Mutual labels:  home-automation, wifi
Dasshio
Hass.io add-on to easily use Amazon Dash Buttons with Home Assistant
Stars: ✭ 140 (+154.55%)
Mutual labels:  home-automation, wifi
hfeasy
HFeasy - firmware for HF-LPx100/LPx30 based devices
Stars: ✭ 35 (-36.36%)
Mutual labels:  home-automation, wifi
home-assistant-config
My configuration for Home Assistant
Stars: ✭ 63 (+14.55%)
Mutual labels:  home-automation
homebridge-plex
Plex plugin for homebridge: https://github.com/nfarina/homebridge
Stars: ✭ 58 (+5.45%)
Mutual labels:  home-automation
ApeX
Using Social Engineering To Obtain WiFi Passwords
Stars: ✭ 87 (+58.18%)
Mutual labels:  wifi
WiFi-View
在 Android 设备上快速查看与管理保存的 WiFi 密码
Stars: ✭ 15 (-72.73%)
Mutual labels:  wifi
RoverController
LoRa/WiFi remote controller for driving my rover
Stars: ✭ 87 (+58.18%)
Mutual labels:  wifi
unifi2mqtt
A unifi controller device status to mqtt bridge process
Stars: ✭ 14 (-74.55%)
Mutual labels:  home-automation
linux-control
Control your Linux laptop/desktop via Google Assistant
Stars: ✭ 46 (-16.36%)
Mutual labels:  home-automation
adb-interface-vscode
🔌 A tool that allows you to execute ADB.exe commands/actions without having to interact with the terminal.
Stars: ✭ 26 (-52.73%)
Mutual labels:  wifi
home assistant-ble
Companion application for home-assistant, sending bluetooth low energy detection
Stars: ✭ 21 (-61.82%)
Mutual labels:  home-automation
alarmserver
IP Camera Alarm Server to MQTT
Stars: ✭ 73 (+32.73%)
Mutual labels:  home-automation
ESP8266 WiFi v2.x
ESP8266 WiFi for OpenEVSE Version 2.x
Stars: ✭ 72 (+30.91%)
Mutual labels:  wifi
airkissOpen
腾讯airkiss协议解析库
Stars: ✭ 33 (-40%)
Mutual labels:  wifi

Doorbell via Wemos and optocoupler

This is the new version of my initial doorbell project.
The main goal is to determine if the doorbell was pressed and perform some actions based on it.

I could have made a version 2.0 of the initial setup but that did not feel right. The hardware and the software are very different.

The setup for this version was inspired by an article in the German c't magazine (2017/17). In the German magazine an optocoupler is used to separate the doorbell from a Raspberry Pi.

In version 1 I used the analog port(A0) on the Wemos to read out the voltage, this version receives a signal from the optocoupler that is read on a digital port. A nice galvanic separation between the two circuits, thereby protecting the Wemos.

As in the previous version the main requirements is that I do not want to mess with the existing doorbell installation or have a dependency on extra components.

The standard Dutch doorbell installation:

Dutch standard doorbell installation

Once the doorbell-button is pressed, the "signal" is send to the Wemos. The Wemos is connected to MQTT via the local Wi-Fi. Home Assistant picks up the signal from MQTT. From there it's up to your imagination what you want to do with the input. For now I send a message to a Slack-bot to notify me.

From button press to HA via MQTT

Hardware v2.0

For the initial setup we need the following parts:

  • Resistor, 330Ω
  • Diode, 1N4148
  • Optocoupler, PC817

The resistor lowers the voltage, the diode "flattens" the signal and the optocoupler sends the signal to the Wemos on port(D3/GPIO0).

Hardware setup v2.0

The value read on port D3 is by default 1, pressing the doorbell drops the signal to 0. Not what I initially expected but this is how it works.

Another learning point was how to connect the optocoupler. On the surface there is a "dot", this indicates port 1, the anode that connects to the doorbell. The emitter and collector are connected to the Wemos.

Optocoupler

On the breadbord the setup is nice and simple.

Breadbord 2.0

Software v2.0

On the Wemos I use Homie for ESP8266 to:

  • Connect and stay connected to the Wi-Fi
  • Connect and stay connected to MQTT
  • Send data to MQTT

The Wemos D1 mini BasicIO example shows how to read the input pin (D3). In the example the input pin is set to INPUT, this could lead to a "floating" signal. To prevent that we set it to INPUT_PULLUP.

Pressing the doorbell button lights up the Wemos onboard led. A nice visual feedback, convenient during development.

The input pin D3 is read in a loop with a delay defined in the variable "readDelay". Otherwise it would be polling constantly. The readDelay with a value of 50 works fine, with higher values and pressing the button multiple times or constantly somehow destabilizes the system. Annoying, although only temporary.

To prevent multiple triggers when the button is either pressed very long or multiple times I use the "buttonPressDelay" variable. Setting "buttonPressDelay" to a value of 3 to 5 seconds works fine and results in just one trigger.

The readDelay and buttonPressDelay values are set in milliseconds.

Home Assistant configuration

I use Home Assistant for home automation. Below are the parts of the Home Assistent configuration that handle the MQTT message and send me a notification via Slack:

automation:
- alias: "Doorbell pressed"
  hide_entity: True
  trigger:
    platform: mqtt
    topic: wemos/doorbell/button/pressed
    payload: 'true'
  action:
    service: notify.Slack
    data:
      message: "Someone at the door!"
      title: "Doorbell says ..."
notify:
 - name: Slack
   platform: slack
   api_key: !secret Slack_API-key
   username: !secret Slack_Username
   default_channel: '#hass'
   icon: ':house:'
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].