Hemant Bhati
Published © GPL3+

IOT Based-Multi Alert! Smart Door Lock Security System

By instructing google assistant we control our Door Lock Security System. If the Door Lock is active it will send an alert if breach detects.

AdvancedFull instructions provided3 hours877
IOT Based-Multi Alert! Smart Door Lock Security System

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
Breadboard (generic)
Breadboard (generic)
Hall Effect Sensor
Hall Effect Sensor
LED (generic)
LED (generic)
Capacitor 10 µF
Capacitor 10 µF
Resistor 10k ohm
Resistor 10k ohm
Round Magnet
Jumper wires (generic)
Jumper wires (generic)
USB-A to Mini-USB Cable
USB-A to Mini-USB Cable

Software apps and online services

IFTTT Google Assistant
IFTTT Webhooks
Bolt Cloud
Bolt IoT Bolt Cloud
VmWare Virtual Private Server
Ubuntu Server(ISO Link)
Telegram Channel/Bot

Hand tools and fabrication machines

Artifical Home Door


Read more


Circuit diagram for Mutli alert door security alarm


Complete Code for IOT Based-Multi Alert!Smart door lock Security System.

#Program by Hemant Bhati

import time #Import time to peform delay operations
import requests#use requests to send mail via webhooks IFTTT
import json#library to handle json data
from boltiot import Bolt #Import boliot to control GPIO pins through API

api_key = "4749fe75-6c61-45f1-bee5-f9a6a1bd9103" #Get your API key from Blot Cloud Website  
device_id  = "BOLT11691968" #Get your Bolt device ID form Bolt Cloud Website
mybolt = Bolt(api_key, device_id)

telegram_chat_id = "@XXXX" # This is the channel ID of the created Telegram channel.Paste after @ symbol.

telegram_bot_id = "botXXXX"  # This is the bot ID of the created Telegram Bot. Paste after bot text.

HIGH = '{"value": "1", "success": "1"}' #This will be returned by bolt API if digital read is high 
LOW = '{"value": "0", "success": "1"}'#This will be returned by bolt API if digital read is low

def send_telegram_message(message):
    """Sends message via Telegram"""
    url = "https://api.telegram.org/" + telegram_bot_id + "/sendMessage"
    data = {
        "chat_id": telegram_chat_id,
        "text": message
        response = requests.request("POST",url,params=data)
        telegram_data = json.loads(response.text)
        return telegram_data["ok"]
    except Exception as e:
        print("An error occurred in sending the alert message via Telegram")
        return False

alarm = 0 #Alarm is turned off by default 
while True: #Infinite loop

    while alarm == 0: #If alarm is off
        response = mybolt.digitalRead('3') #check if it is being activated
        if (response == HIGH):
            print("Security System is activated")
            mybolt.digitalWrite('2', 'HIGH')  #Turn on LED to indicate Alarm is activated
            mybolt.digitalWrite('4','LOW') #Turn off the capacitor of the 4 pin
            alarm = 1
        elif (response == LOW):
           print ("Waiting for Security System to be activated....")
           print ("Problem in getting value form pin 3")
        time.sleep(2) #check once in every 2 seconds to avoid exceeding API rate limit

   while alarm == 1: #If alarm is on
        response = mybolt.digitalRead('4') #check is it is being de-activated
        if (response == HIGH):
            print("Security System is De-activated")
            mybolt.digitalWrite('2', 'LOW')#Turn off LED to indicate Alarm is De-activated
            mybolt.digitalWrite('3', 'LOW')#Turn off the 3 GPIO pin.
            alarm = 0
        elif (response == LOW):
            print ("Security System is currently active can be deactivated from google assistant")
            print ("Problem in getting value form pin 4")

        response = mybolt.digitalRead('0') #check if hall sensor is triggered
        if (response == HIGH): #if magnet is not present     
            print ("Alert! Security breach Buzzer ON")
            mybolt.digitalWrite('1', 'HIGH')
            requests.get('https://maker.ifttt.com/trigger/Breach/with/key/i6nPcZ5ZlzaVdbYITw6VGcpMkrVO5GqAX049cHEBDt') #webhook link to trigger mail through IFTTT
            telegram_status=send_telegram_message("Alert!Someone opens your secret door")
            print("This is the telegram status: ",telegram_status)
            mybolt.digitalWrite('1', 'LOW')
            print ("Buzzer OFF")
        elif (response == LOW):
            print ("No problem, all good!")
            print ("Problem in reading the value of button")


Hemant Bhati

Hemant Bhati

3 projects • 1 follower