Swapnil Sawant
Published

alarm_system

Alarm system for your vault at home

BeginnerWork in progress1 hour479
alarm_system

Things used in this project

Hardware components

LDR, 5 Mohm
LDR, 5 Mohm
×1
Buzzer
Buzzer
×1
Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

IFTTT google-assistant
SMS Messaging API
Twilio SMS Messaging API

Story

Read more

Schematics

Alarm_system_circuit

Alarm system circuit that turns on buzzer when LDR detects change in light and sends SMS.

Code

Alarm_system

Python
Logic
from boltiot import Bolt,Sms
import json, conf, time

mybolt = Bolt(conf.api_key,conf.device_id)
sms = Sms(conf.SID,conf.AUTH_TOKEN,conf.TO_NUMBER,conf.FROM_NUMBER)

threshold = 10

#function to turn on buzzer
def intruder():
        mybolt.digitalWrite('1','HIGH')
        mybolt.digitalWrite('2','LOW')

while True:
        #reading LDR data
        response = mybolt.analogRead('A0')
        data = json.loads(response)
        current_voltage = int(data['value'])
        print(current_voltage)
        try:
                if current_voltage < threshold:
                        print('current voltage dropped')
                        intruder()
                        print('Sending SMS via twilio')
                        response = sms.send_sms('ALERT....Vault opened')
                        print(str(response.status))
        except Exception as e:
                print('Error: ', e)
        time.sleep(2)

Alarm_system

Python
Configuration
#device config
api_key = '<your_apiKey>'
device_id = '<your_deviceId>'

#SMS config
AUTH_TOKEN = '<your_authToken>'
SID = '<your_SID>'
FROM_NUMBER = '<from_number>'
TO_NUMBER = '<to_number>'

Alarm_system

https://github.com/swapnilravi10/alarm_system

Credits

Swapnil Sawant
1 project • 0 followers

Comments