Shares

Door Status Monitor using the ESP8266

Shares

In this project you’re going to monitor the status of a door using an ESP8266. The goal of this project is to show the endless possibilities that this $4 WiFi module offers when integrates with a free platform that I’m about to show you.

Before continue reading this project, please complete the following tutorials or use them as a reference:

If you like the ESP and you want to do more projects you can read my eBook Password Protected Web Server Accessible from Anywhere using ESP8266 and Arduino IDE.

Let’s get started!

First, watch the video demonstration below


About IFTTT

In order to accomplish this task you have to sign up for one free service called IFTTT which stands for “If This Then That”.

IFTTT is a platform that gives you creative control over dozens of products and apps.

You can make apps work together. For example when you send a request to IFTTT, it triggers a recipe that sends you an email alert.

Creating Your IFTTT Account

Creating an account on IFTTT is free!

Go the official site: https://ifttt.com/ and click the “Sign Up” button in the middle of the page.

Complete the form with your personal information (see Figure below) and create your account.

ifttt signup

After creating your account, follow their getting started tutorial by clicking the word “this”. Then click the “Continue” button that appears on your screen a few more times to complete their introductory tutorial.

Open the Recipe

I’ve created a recipe that integrates perfectly in this project and you can use it.

If you’re logged in at IFTTT and you open this URL below to use my recipe instantly:

Next scroll down that page and follow these instructions to make it work for you:

  1. Connect your account to the Maker Channel
  2. Then connect your account to your Gmail Channel

A new page loads when you finish connecting your account to Maker Channel and Gmail Channel.

Complete the Recipe

Fill the recipe with your own information. Follow these instructions:

  1. Type “door_status” in your event name
  2. Edit the text that you want to your ESP8266 to send out in your email. Do not delete the Value1 in the subject
  3. Press the “Add” button

ifttt email

Now go to this URL: https://ifttt.com/maker. Copy you secret key to a safe place (you’ll need them later in this project). In my example my secret key is: b6eDdHYblEv2Sy32qLwe

api

Test Your Recipe

Let’s test if your request is working properly. Replace YOUR_API_KEY from the following URL:

https://maker.ifttt.com/trigger/door_status/with/key/YOUR_API_KEY

With your API KEY:

https://maker.ifttt.com/trigger/door_status/with/key/b6eDdHYblEv2Sy32qLwe

Open your URL with your API KEY in your browser.

ifttt triggered

You should see something similar to the preceding Figure. Then go to your email client and new email should be there!

email

Parts List

Here’s the hardware that you need to complete this project:

Schematics (3.3V FTDI Programmer)

The schematics to upload code to your ESP8266 are very straight forward. You only need to establish a serial communication between your FTDI programmer and your ESP8266 to upload some code.Flashing Firmware - FTDI Programmer

Uploading your ESP8266 code

Having the ESP8266 add-on for the Arduino IDE installed (How to Install the ESP8266 Board in Arduino IDE).

Go to Tools and select “Generic ESP8266 Module”.

Arduino IDE select esp8266

Copy the sketch below to your Arduino IDE. Replace the SSID, password and the IFTTT API Key with your own credentials.

After modifying my sketch upload it to your ESP8266 (If you can’t upload code to your ESP8266, read this troubleshooting guide).

Final Circuit

Now follow the schematics below to create your Door Status Monitor.

magnetic contact switch_bb

Demonstration

For prototyping/testing you can apply the magnetic reed switch to your door using Velcro.

esp8266 featured image

Now when someone opens/closes your door you get notified via email (watch the video at the beginning of this project for a live demonstration).

Wrapping Up

Do you have any questions? Leave a comment down below!

Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog.

P.S. If you got stuck during this tutorial make sure you read “ESP8266 Troubleshooting Guide

Leave a Comment:

Add Your Reply