Did you ever gave your hall on lease and wondered how people are using it? Or worried about mistakenly leaving the lights ON? Maybe you want to impress your friends or colleagues with your tech-savviness. In all of these cases, we got you covered!
In this project, you will learn how to build a device which turns ON the lights when someone enters the room and turns it OFF when they leave. You can also get an on-demand notification through your email informing you about the number of people inside the hall.
Step 1: ImportantDo note, this is an intermediate tutorial and assumes that you know the basics of Bolt IoT module and also how to set up your Virtual Private Server (VPS) for using alongside Bolt Cloud.
If you’re unaware about Bolt IoT and VPS, follow the link below:-
https://docs.boltiot.com/docs/introduction
https://docs.boltiot.com/docs/python-library
Produce the circuit as shown in the schematics. Always remember to complete the circuit before supplying power to your electronic device.
Step 3: Writing the CodeWrite the given python code in your Virtual Private Server. My VPS works on Ubuntu Server Edition.
Before executing the code, you need to put one sensor on the door-frame of the Entry door and one on the door-frame of the Exit door.
Now every time someone enters, the sensors would send the information to us and the code will increase the number of people in the hall by 1. Similarly, when someone leaves, the code will decrease the number of people in the hall by 1. And accordingly, the lights will be switched ON or OFF.
Step 4: Making the Web AppHere, we will learn to build a web app using Bubble Visual Programming Platform which will make the device send an Email informing us about the number of people in the hall.
If you’re unaware Bubble Visual Programming, follow the link below:-
https://docs.boltiot.com/docs/creating-app-from-basics
When you’re done with that, create an app that has a single button which on being pressed turns pin-2 of Bolt IoT module HIGH. This would be the signal for the device to send the email.
Step 5: ExecutionWhen you have set up the Bolt IoT module with sensors at the designated places and loaded the VPS with your code, it is time for some action!
Execute the code on your virtual private server. Put your fingers in front of the sensor to test whether it is working or not. VPS would show “People = 1”. Do the same thing with the other sensor and VPS would show “People= 0”.
Open the web app you just created and press the button. An Email with information regarding the number of people in the hall will be sent to your email address.
Comments