IoT based Door Security Alarm Project with Blynk


Today security is one of the prime aspect in our society. Securing our home and family is important. In this article we will see how to make a IoT based Door Security Alarm using Blynk. This is a simple but effective door security system.

IoT based Door Security Alarm consists of simple, easy to find components and modules. You can get these form local market and start building it by your own.

Parts List

This project requires simple components and modules. These are easily available in the market.

  • WeMos D1 Mini x 1
  • Magnetic Door Sensor x 1
  • Buzzer 5V x 1
  • Transistor BC547 x 1
  • Resistor 330Ω x 3
  • LED x 2
  • 2 Pin Screw connector x 1
  • Male/Female berg strip x 1 (Each)
  • Dotted PCB small x 1

How it Works?

WeMos D1 Mini wifi module constantly checks the status of magnetic door sensor. If there is a change in door sensor the alarm gets activated and buzzer beeps. IoT based Door Security Alarm will also notify you through your smartphone using blynk app.

IoT based Door Security Alarm

There are two modes available to set. You can enable the alarm when you are not at home or when you think it should be enabled.

  1. Alarm ON – In this mode if door is opened buzzer will start beeping and you will be notified via Blynk app.
  2. Alarm OFF – In this mode there will be no buzzer beeps neither blynk notification.

Sensors and Modules Functions

WeMos D1 Mini

WeMos D1 mini

This wifi module is used to connect with internet and send data to blynk app. This also controls buzzer and Led’s as per the code.

Magnetic Door Sensor

magnetic sensor

Magnetic Door sensor is used to detect the movement of the door. These sensors are available in two types.

  1. Normally Open
  2. Normally Closed

In this project we are using normally open type.

Circuit Diagram

This is the circuit diagram of IoT based Door Security Alarm. You can connect all these components in a normal PCB and solder it. Use USB to power WeMos D1 Mini

IoT based Door Security Alarm

Must Read:

IoT based Temperature and humidity Monitoring

Smart Wi-Fi Switch

IoT Based Water level Indicator

Blynk Setup

Open Blynk app and tap on New Project

Blynk config

Give a name of the Project, Select Device as WeMos D1 Mini, Connection Type Wi-Fi and tap on Create

IoT based Door Security Alarm

You will receive an email with Auth Token. Tap on OK

Auth Token

Tap on + Button to add widgets Labeled Value

Blynk config

Add Notification Widget

Blynk config

Add Segmented Switch

Blynk config

Configure Labeled Value Setting as per below

Blynk config

Configure Segmented Switch Setting as per below

IoT based Door Security Alarm

Configure Notification Setting as per below

Blynk config

Finally the complete setup

Blynk config


The code is simple and easy to understand. Just update the Auth Token, Network SSID and Password. You can download the code from this link and upload the code in wifi module using Arduino IDE.



As per the circuit diagram we have placed the components on a PCB. Here we have use USB socket to power up WeMos D1 Mini wifi module. For testing purpose you can build this on a bread board as well

IoT based Door Security Alarm


This is a complete video of the project.


IoT based Door Security Alarm is a economical project which can be built by beginners. This project will help you to interface magnetic door sensor with WeMos D1 Mini. Also you will be able to learn interfacing blynk to make the project IoT based.

9 thoughts on “IoT based Door Security Alarm Project with Blynk”

  1. Hi,
    Thanks for the project.
    When the alarm is on, as long as the door is open, the siren will sound and send messages. How can set the siren to sound for only one minute and only send a message if the door stays open?

    • Yes, It will be same just need to select the correct board in Arduino IDE while compiling and uploading the code.


Leave a Comment