Let's say you don't want anybody come into your when you're away. So this project might help you.
This project will help you how to set up a system which will send you an alert sms on your phone when someone or anyone enters your room and switches on the light. We will be using Light Sensor and Z - Score analysis to detect any sudden change in light inside the room (of course if someone comes into your they will turn on light which will be an anomaly) this will trigger our system to send an sms while you are away.
Step 1: Make the Connections.Get your Bolt device
It should look like this if it isn't then maybe you got the wrong package (pun intended)
Now, get your LDR senor and 10K Ohm resistor
Now, put one leg of LDR in 3V3 pin of Bolt Module and the other leg in A0 pin. For the resistor, put one leg of resistor in GND pin of bolt device and the other also in A0 pin. Please check that in no case the GND pin of resistor is touching the 3V3 pin of the LDR sensor. Connection should look like this.
Note: Check Schematic Diagram for detail connection.
Twilio is just basically a website which will give you a phone number so that your device will use that phone number to send you alert messages when someone enters your room. Go to Twilio.com to create an account. They will ask your email and phone number for verification. This will give you a trial account which we need. After creation of the account you will get a dashboard like below you just need to click on "get a trial number" to get a number. Now it will look like this.
Here are three important things.
1. Trial Number
2. Account SID
3. Auth Token
To get Auth Token you just need to click on show and it will start showing you your auth token. Make sure to save these three things somewhere like notepad. Because we will need them. Also you need Bolt API key and Bolt Device ID which you can get on your account on cloud.boltiot.com
Step 3: Install Python and Boltiot LibraryIf you do not have python install on your computer click on this link and download it's latest package. When the installation is complete open cmd and type
pip install boltiot
This will install Boltiot library on your computer.
Step 4: Coding....Go to code section. create a txt file on your computer and save it as conf.py file with configuration code inside it. Similarly do it for Main file and save it as main.py
Step 5: ExecutionPower your Bolt Device. Now, to run your code go to the folder where you have saved your python files and click on the address bar and type cmd and press enter to open command prompt.
python main.py
Type this above command in cmd and hit enter the code will start running. If everything went correct it should look like this.
It will say that it needs 10 more data point to compute z - score analysis. Just let it run for about 100 seconds and after you can leave the room and wait. If someone enters your room and switches on the light you will get an sms like this.
Comments
Please log in or sign up to comment.