- I am Soumya Ranjan Swain, this is a project that covers my entire IoT training with different modules like Building an IoT Monitoring System, Controlling Devices Over the Internet, Cloud, APIs, and Alerts through Bolt module.
In this project, we require you to build a proof of concept of the Thief Motion Detection System which uses the data from the Passive Infra-Red(PIR) sensor as well as Bolt IoT cloud features. We need to use the PIR sensor to collect data and to decide the state of the motion in a room:
a) Someone Entered to your Home: Sensor value 'HIGH'
b) No movement: Sensor value 'LOW'
In the code, send an SMS when the current state of the room changes from "No movement" to "Someone Entered To your Home".
Components1. Bolt WiFi Module
2. PIR Sensor ( Passive Infrared Sensor )
1. Make sure you have not powered on your Bolt Module while connecting the circuit. This will ensure that in case we make any mistake, it will not short circuit your device. Switch off the power if it is connected.
2. Connect one end of the OUT pin of PIR to the 0 (Digital) pin of the Bolt device and other ends of the PIR to the 5v pin and GND pin of the Bolt as shown in the image below
From the given problem statement, I connected the PIR sensor to the Bolt Cloud module. The connections are clearly mentioned in schematics. I did this entire project in python(3.5.4). You can run Python files on either Pycharm on Windows platform. Here you can learn how to install python 3 and setup local programming environment on Pycharm, first I installed BoltIoT library using pip
(venv) C:\Users\ASUS\PycharmProjects\Alert system>pip install boltiot
Requirement already satisfied: boltiot in c:\users\asus\pycharmprojects\alert system\venv\lib\site-packages (1.11.2)
Requirement already satisfied: twilio in c:\users\asus\pycharmprojects\alert system\venv\lib\site-packages (from boltiot) (6.41.0)
Requirement already satisfied: requests in c:\users\asus\pycharmprojects\alert system\venv\lib\site-packages (from boltiot) (2.23.0)
Requirement already satisfied: six in c:\users\asus\pycharmprojects\alert system\venv\lib\site-packages (from twilio->boltiot) (1.15.0)
Requirement already satisfied: pytz in c:\users\asus\pycharmprojects\alert system\venv\lib\site-packages (from twilio->boltiot) (2020.1)
Requirement already satisfied: PyJWT>=1.4.2 in c:\users\asus\pycharmprojects\alert system\venv\lib\site-packages (from twilio->boltiot) (1.7.1)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\asus\pycharmprojects\alert system\venv\lib\site-packages (from requests->boltiot) (1.25.9)
Requirement already satisfied: chardet<4,>=3.0.2 in c:\users\asus\pycharmprojects\alert system\venv\lib\site-packages (from requests->boltiot) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\asus\pycharmprojects\alert system\venv\lib\site-packages (from requests->boltiot) (2020.4.5.2)
Requirement already satisfied: idna<3,>=2.5 in c:\users\asus\pycharmprojects\alert system\venv\lib\site-packages (from requests->boltiot) (2.9)
After installing the requirements, create an account in Twilio It provides API to send SMS for free. It will provide a private API key. Create a 'conf' file in python with the following code and replace it with your credentials.
SID = "You can find SID in your Twilio Dashboard"
AUTH_TOKEN = "You can find on your Twilio Dashboard"
FROM_NUMBER = "This is the no. generated by Twilio. You can find this on your Twilio Dashboard"
TO_NUMBER = "This is your number. Make sure you are adding +91 in beginning"
Core LogicIt will send SMS through Twilio API when the PIR sensor states changes from LOW to HIGH.
If PIR value is HIGH - "SOMEONE ENTERED TO YOUR HOME"
If PIR value is HIGH - "NO MOVEMENT IN THE ROOM"
NOTE:
1. Replace the red line value in the code with your Bolt API.
2.Replace BOLT red line with your bolt wifi module number.
Receiving SMS
Comments