Introduction: Door Bell Push and Temperature Sensor

This enhances a standard hard wired door bell with an esp-12F (esp8266) module.

It installs in the bell unit itself to avoid any change to wiring. It provides the following functions

  • Detect door bell pushes
  • Sends notifications to phone via IFTTT
  • Stores door bell activity in an easyIOT server (optional)
  • Trigger other activity via a URL when door bell pushed
    • I capture a snapshot on a webcam by the door and can view recent door bell captures on my phone
  • Optional embedded temperature sensor (DS18B20) which forms part of my house temperature monitoring

Step 1: Hardware and Materials

Following materials are needed

  • ESP-12F (ESP8266) wifi / cpu module
  • DC Buck converter for 3.3V supply
  • Rectifier diode (e.g. 1N4001)
  • Electrolytic capacitor 220uF 35V
  • Electrolytic capacitor 220uF 16V
  • Zener diode 3.3 or 2.6V
  • Resistors
  • Piece of strip board
  • Connectors if required
  • DS18B20 digital temp sensor if required

The schematic shows the circuit used. It assumes a low voltage AC powered bell which is most common type of hard wired simple bell.The bell unit gets power from an external bell transformer typically around 10V AC. This is not critical with the only constraint being the maximum voltage into the buck converter. The one I use is MP2307 based with a maximum input of 23V dc (~16V AC).

There are normally 3 active terminals. With the bell push making the connection from one side of the AC supply to the bell solenoid. The module uses the two AC terminals to produce the DC power through a simple half wave rectifier. The bell push sensing is by monitoring the voltage across the actual solenoid. This will normall be ground, but when the bell is activated will be the full AC. A resistor / zener diode clips this so a 0 - 3.3V 50 Hz pulse is fed into a GPIO pin. The software processes this to provide a single activation per bell press.

I constructed the circuit on a bit of strip board and this is small enough to fit easily into the bell unit. I use simple jumper connectors to make it easier to install and include on specifically in line with the main AC supply so that it can be power reset easily if required.

The schematic as shown includes a DS18B20 temperature sensor. This is optional. I use it as part of a network monitoring most areas in my house. If included it is good to cable the sensor in with a few centimetres of cable to allow it to be isolated from any local heating effects.

Step 2: Software

The door push unit uses an Arduino sketch available on github

This needs to adjusted to suit local conditions and then compiled in a esp8266 Arduino environment. The following libraries needed, they are standard or can be added.

  • ESP8266WiFi
  • WifiClient
  • ESP8266WebServer
  • ESP8266mDNS
  • ESP8266HTTPUpdateServer
  • ArduinoJson
  • WifiClientSecure
  • IFTTTMaker
  • DNSServer
  • WiFiManager (optional use)
  • OneWire
  • DallasTemperature

Items in the sketch to be changed include

  • Local wifi access details (ssid, password) if not using WifiManager
  • Authorisation code for web access AP_AUTHID. It is good to make this a decent length. It can contain alphanumeric characters.
  • firmware OTA password update_password
  • WifiManager password WM_PASSWORD
    • Wifi can be manually set up by commenting out WM_NAME
  • IFTTT maker key (see the notification step)

Optional changes include

  • Changing input pin for Doorbell detector
  • Changing pin for temperature sensor
  • Changing Web access port from default 80

Once this is done then it should first be compiled and uploaded using conventional serial upload. Subsequent update may be done by compiling an export binary in Arduino environment and then accessing the OTA interface at ip/firmware.

The door bell push is detected in the software by interrupt sensing the rising edge of the first pulse from the detector circuit. All subsequent interrupts are ignored. A timeout is used to reactivate the detector after the BELL_MIN_INTERVAL which is set to 10 seconds.

Other activities may be accessed on the esp8266 web server

  • ip/recent shows recent door bell activity
  • ip/reloadConfig reloads espConfig
  • ip/bellPush simulates a bell push

Step 3: Configuration

As constructed the software gets its configuration from a local web server. The module loads configuration data based on its Mac Address. This makes it very convenient to run multiple modules using the same binary, and also makes it easier to update the configuration without recompiling. It would be possible to skip this and put the config data directly into the code.

I store the config file on my EasyIOT server which has a folder at easyIOT/html where the config file may be retrieved easily.

The file is called espConfig and is a simple text file storing a number of parameters (12) for each possible Mac address. A module only loads the parameters set for its Mac address.

An example from the file is

#Hall

#Mac address
123456ABCDEF

#module name

esp8266-hall

#server mode mask (1=temp sense, 4 = boilermode, 4 = doorbell)

9

#EIOT node for temperature

N9S0

#unused

-1

# minimum temperature interval in seconds

60

#maximum temperature interval in seconds

300

#boiler power interval

0

#EasyIOT boiler power node

-1

#EasyIOT bell push node

N10S0

# IFTTT notify value

front

#IFTTT notify eventname

doorbell

#action URL

192.168.0.2/snap.php

Any line beginning with # is ignored. All lines must be present. -1 is used for parameters to be ignored.

The config file is read when the module first starts up. It may also be reloaded in a running system (when the config has been changed) by accessing ip/reloadConfig

The boiler mode part of the config is not relevant here but used in my temperature sensors attached to central heatin pipe output as it detects when the boiler is heating and can calculate average power consumption.

Step 4: IFTT Notification

When a door bell push is detected then it tries to notify this by IFTTT.

To use this you need an IFTTT account and activate the Maker WebHoooks channel. The MakerKey from this channel needs to be compiled into the code.

Set up an IF action using Maker WebHooks and use event name of same name as in the config (e.g. doorbell). The THEN action should be IFTTT notification. You can add value1 to the notification which will be in the config file. This can be useful if you have 2 or more detectors.

You need to install the IFTTT app on your phone and then notifications will appear whenever the doorbell is triggered.

Step 5: EasyIOT Integration

The software can send temperature and Doorbell push reports to an EasyIOT server. EasyIOT automation may be used to take additional actions based on these report.

Set up an EasyIOT server (e.g. on a Raspberry Pi). Configure ip address and username password into the esp8266 software and compile.

Now add a Virtual driver in the EASYIOT configuration. Choose Temperature Analog Input and note the EasyIOT node name. This should be put into the temperature node name part of the espConfig file.

Add a second virtual driver. Choose Door digital input, note the node name and put into espConfig file.

Step 6: Other Bell Push Actions

The software has a routine called actionBellOn. As written this can do 3 things

  • IFTTT notify
  • EasyIOT report

  • Perform an action URL

The URL can be used to trigger other activity from other web servers. The URL used is in the espConfig file.

If the server of the URL is authenticated then the username and password need to be configured and compiled into the code.

I use this to access a URL called snap.php on a camera next to the door. This takes a jpg when the bell is pushed. The last 4 are kept and can be viewed remotely on the cameras web server.

I use raspberry Pi based cameras which male this operation very easy. camera

Comments

About This Instructable

153views

4favorites

License:

More by btidey:Two Way Speaker SwitchRelay Module Input ModifiedDoor Bell Push and Temperature Sensor
Add instructable to: