Random Nerd Tutorials

Door Status Monitor using the ESP8266


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 Home Automation Using ESP8266.

Let’s get started!

First, watch the video demonstration below


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 top 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.

Open the Applet

I’ve created an Applet that integrates perfectly in this project and you can also use it.


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

Press the “Turn on” button:

Next, you need to grant access permissions:

Let your IFTTT account connect to your Gmail account. A new page loads when you finish connecting your Gmail.

Complete the Applet

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

  1. Type “door_status” in your event name
  2. Add an email address
  3. Edit the subject and body of your email. Do not delete the Value1 in the subject
  4. Press the “Save” button

Now, go to this URL: https://ifttt.com/maker_webhooks and open the “Settings” tab.

Copy you secret key to a safe place (you’ll need them later in this project). In my example my secret key is: b6eDdHYblEv2Sy32qLwe

Test Your Applet

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


With your API KEY:


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!


Parts List

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

You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!

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.

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”.

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


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

Learn ESP32 with Arduino IDE

This our complete guide to program the ESP32 with Arduino IDE, including projects, tips, and tricks! The registrations are open, so SIGN UP NOW »

Leave a Comment:

Add Your Reply

⏰ Registrations are open ⏰
Sign up for "Learn ESP32 with Arduino IDE" Course