I'm Sai Rohit Uddagiri, this is a project that cover 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.
Problem StatementIn this project, we require you to build a proof of concept of the Intrusion 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 : 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".
Gathering all required componentsThese are the components required
1. Bolt WiFi Module
2. PIR ( 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 LDR, push-button and LED to 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 Digital Ocean or on Ubuntu server virtual machine. Here you can learn how to install python 3 and setup local programming environment on Ubuntu OS. After successful installation of Python 3 on your Digital Ocean Droplet or Ubuntu server, first I installed BoltIoT library using pip.
sudo pip3 install boltiot
After installing the requirements, create an account in Twilio It provides API to send SMS for free. It will provide private API key. Create a 'conf' file in python with following code and replace 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'
Step 3: Core logic
It will send SMS through Twilio API when PIR sensor state changes from LOW to HIGH.
If PIR value is HIGH - SOMEONE ENTERED
If PIR value is HIGH - NO MOVEMENT IN THE ROOM
NOTE:1. Replace the xxxx-xxx-xxxx-xxx value in the code with your Bolt API.
2.Replace BOLTxxxx with your bolt wifi module number.
Step 4: Receiving SMS
Comments