The project includes a PIR (Passive Infrared) Motion Sensor which is used for motion detectors. Security systems, alarms and home automation projects include it also. With building this sensor circuit, more advanced system can be made. When PIR sensor detects motion a mail and a Telegram message will be sent to the authority immediately. Mail is sent using smtp library in python.
HOW IT WORKSSuppose it is placed in a room. The sensor output value is normally low. When someone enters in the room the sensor detects motion then sensor output value becomes high. Then mail will be sent to the authority.
ALL REQUIRED COMPONENTS1. Bolt Wifi Module
2. PIR Sensor
Step-1: Connect all three female pins to the PIR Motion Sensor.
step-2: Connect the positive (+) pin of the sensor to 5 volt of the Bolt Module
step-3: Connect the ground (-) pin of the sensor to GND pin of the Bolt Module
step-4: Connect the output pin of the sensor to the digital 0 (D0) on the Bolt Module
After making the circuit ready two python files are needed to run the project successfully. Here I used linux in virtual box. You can run python files in Digital Ocean also.
First install boltiot module using the following command. Run this in terminal.
sudo pip install boltiot
Then create a python file. I named it conf.py. The code is given below. Replace the values with your credentials
bolt_api_key = "XXXX" #This is your Bolt Cloud API Key
device_id = "XXXX" #This is the device ID of BOLT module
telegram_chat_id = "@XXXX" #This is the channel ID of the telegram channel.
telegram_bot_id = "botXXXX" #This is the bot ID of the created bot.
Normally PIR output value is 0. When the PIR sensor detects motion i.e. detects some one the output value of PIR sensor will be high i.e. 1. Now when the sensor output become 1 using the python code mail will be sent using smtp library and also Telegram message will be sent.
The python code for the above logic is given in the code section named alert.py
In the bolt cloud create a new product. Here I used digiital 0 pin. I wrote a small html code in the code section within the configuration section which is given below.
<!DOCTYPE html>
<html>
<head>
<title> MOTION DETECTOR </title>
</head>
<body>
<h> This is a project to detect someone in a security zone </h>
<h> When someone gets detected an alert mail will be sent </h>
</body>
</html>
Now connect the product with the bolt device.
Receiving Mail and MessageWhen someone is detected mail and telegram message will be sent. Here are samples which I received in mail and Telegram.
Comments