In this new year, there was a strange thing happened in our hostel, a laptop was stolen from one of our batchmates room. A few days later someone's purse was also stolen. I heard all this and went to my room thinking whole night about those frequent incidents and thought how can it be stopped. Then as I was learning IoT, I thought why not those knowlegde is used in real life for our own stuffs. But due to shortage of time I could not make this project then but I completed it in lockdown during COVID-19.
Hardware & software connections and configuration.Step 1: Building the circuit
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
Step 2: Testing Hardware and Software
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
Please log in or sign up to comment.