Intro: Built on Bolt : Smart Alerts Via Social Media Using Proximity Sensor
This project is made on the BOLT IOT (Internet of Things) platform .
Wont it be amazing if all our day to day things like a door or a chair could send us notifications about some event taking place ?
This may sound absurd but it is possible !
For this project we will need the BOLT IOT kit and an account in the IFTTT site (https://ifttt.com).
IFTTT is a free web-based service that people use to create chains of simple conditional statements, called applets. An applet is triggered by changes that occur within other web services such as Gmail, Facebook.
We will make use of the proximity sensor that is available in the bolt iot kit. We will connect it to our bolt board and whenever we move our hand over the sensor we would receive a notification in our mail.
Uses : - It can be used as a thief detector ! The proximity sensor can be replaced by some other sensor and we can then use it for some other purpose.
To execute this we need to follow some steps.
Step 1: Configure BOLT
First connect the BOLT to a Wi-Fi network.
- The BOLT creates its own hotspot when you power it on for the first time using a 5V USB power adapter.
- The name of the hotspot is BOLT followed by its ID.
- Download NetPlug App from playstore.
- Now switch on your BOLT.
- First time it will create its own Wi-Fi hotspot.
- Connect your mobile Wi-Fi to BOLT hotspot.
- Open NetPlug app and click on the BOLT icon.
- Then click on configure button and it will take you to the BOLT setting page where u have to put the details of the Wi-Fi network to which you want to connect your BOLT.
- Click on save and restart.
- Now BOLT will restart and try to connect to the Wi-Fi network.
- If BOLT is properly connected then the blue light will stop blinking and it becomes stable.
- Now we have to find the IP address of the BOLT.
- Advanced IP Scanner can be used to do that.
Step 2: Setting Up Proximity Sensor
Interfacing Proximity Sensor (IR Sensor)
A proximity sensor is used to detect whether an obstacle is present in front of it.
The sensor emits IR light and gives a signal when it detects the reflected light. An IR sensor consists of an emitter, detector, and associated circuitry.
The circuit required making an IR sensor consists of two parts: the emitter circuit and the receiver circuit.
The emitter is simply an IR LED (Light Emitting Diode) and the detector is simply an IR photodiode which is sensitive to IR light of the same wavelength as that emitted by the IR LED.
When IR light falls on the photodiode, its resistance and correspondingly, its output voltage, change in proportion to the magnitude of the IR light received.
This is the underlying principle of working of the IR sensor. It provides HIGH(5V), which is represented as logical 1 when there is no obstacle in front of it and it provides LOW(0V), which is represented as logical 0 when there is an obstacle in front of it.
The sensor has three pins:
Vcc and GND pins are used to provide power to the sensor.
The output pin is the pin which provides the sensor output.
Steps for connection : -
- Connect Vcc of the sensor to 5V Pin
- Connect GND to GND pin of BOLT.
- Connect output pin to the GPIO on which you monitor to sensor data
- Let us connect output pin to GPIO-4.
- Now if you take your hand near the sensor you will see a red light glowing up indicating obstacle detected.
Step 3: BOLT With IFTTT
Make an account in the IFTTT site (https://ifttt.com/).
- Create a new applet. After clicking on new applet Click on 'this ' icon for choosing input.
- Now search for maker and after getting search results , click on Maker icon. Images has been uploaded for reference.
- Next step is to choose and create the Trigger.
- After that we have to choose the output. Click on that for choosing the output of the event ! The output is nothing but the action that will take place.
- Here we have to select Action Service which could be either Facebook , Gmail , Twitter etc.
- We will be using Gmail for this project . After clicking on Gmail we need to specify the action .
- For the Action part we have to enter the gmail address where we want the mail to be sent .
- Next job is to find our key !
- Go back to the home page of the IFTTT site and click on search and search for maker channel again.
- After finding the maker channel click on Documentation where you will find your unique key.
- Copy this key in some place because we are going to need it later.
Step 4: Code and Execute !
After connecting the proximity sensor we have to write the necessary code and upload it on BOLT .
The next step is to write HTML code.
- Open notepad, type the code that I have attached (indexpage.txt) here and upload it on BOLT.
- Save the filename as "index.htm".
- Now its time to test it !
- For this purpose we have to use the key that we have got through the IFTTT site .
- If you have not copied the key then you can again open you IFTTT account and then go to the maker service and click on DOCUMENTATION where you can find the key .
- Once you have done this , the next thing that you need to do is to simply fill up the boxes of your index.htm file .
- You have to use your BOLT IP address to go the index page . Open Chrome web browser and type the IP Address of BOLT that you got from the Advanced IP Scanner .
- Then enter the pin number in which your proximity sensor's output pin is connected which is 4 in our case.
- Then enter the state of the proximity sensor which will trigger the event e.g. 1 is for high and 0 is for low.
- Then finally we have to enable the IFTTT so enter 1 in the last box .
- After all this is done click on the submit button and move your hand over the proximity sensor and check your email and you will see that you have received a mail regarding the event .
Step 5: Check Gmail
This is the easiest step of all .
Open your Gmail account to see the mail that you have received regarding the event that took place.