Introduction
Circuit
Step 3:
Step 4:
Step 5:
Step 6:
Step 7:
Step 8:
Step 9:
Step 10:
Step 11:
Getting the HTTP GET request URLStep 1:
Step 3:
Uploading and testing
Read moreIn this project, we are going to learn how to make an Internet of things motion sensor which will give us alert on our phone when motion is detected at the place we installed the sensor. Everything works through the internet so there is no limitation of the distance between sensor and the phone.
Originally posted in
https://diyusthad.com/2019/09/iot-motion-sensor-esp-01-pir.html
- We have connected the PIR motion sensor to one of the GPIO pins of the ESP 8266 – 01.
- Whenever the PIR detects motion then the output sates of the PIR sensor will change which will be detected by our ESP 8266 – 01 controller.
- We have programmed the ESP to make an HTTP GET request to our IFTTT webhooks applet.
- Whenever the HTTP GET request has been made then it will trigger an notification alert on our mobile phone.
- Connect the GND of ESP 01 and PIR sensor to the negative of the power supply
- Connect the 3.3v of the power supply to the VCC of both ESP 01 and PIR sensor
- Connect the OUT of PIR sensor to the GPIO 2 pin of ESP
- Before creating Applet in IFTTT you need to create an account in the IFTTT web site. www.ifttt.com
- Also, download the IFTTT app for your Android or iPhone.
- Download the Android app from here.
- Download the iPhone app from here.
- After downloading the app login with your user credentials.
- Also, allow all the permissions which ask for.
- Click on your profile icon
- Then select the create option from the drop down list.
- Now click on the +This button
- Now search for webhooks
- Then click on the Webhooks icon
- From choose trigger option, click on the “receive a web request”.
- Now give a name for the even
- I have written “iot_Motion_Sensor”.
- Note that there should not be having any space between the words.
- Now clock on +That button
- Now from choose action service,
- Search for notification.
- And click on the notification icon.
- Note that you must me installed and logged in the IFTTT app in your phone for the notifications to work.
- Now from here choose any of the option you need
- I am going to choose simple notification instead of rich notification.
- Now in the message box write the notification which you needed to receive when the motion is detected.
- I am simply going to write “Motion Detected”
- If you have multiple sensors in place then you can write something like motion detected at garage or motion detected in closet etc..
- If you want you can give time at when the motion is detected.
- Now click finish
- Thats it now we have created the applet successfully.
- Login to your IFTTT account.
- Click on your profile pic and choose My services
- Then select webhooks.
- Now click on Documentation
- Now replace {event} with our event name which we given when we created our applet.
- In my case it was “Iot_Motion_Sensor”.
- There is a test button you can click on it to check whether your applet is working.
- Your secret key also will be in this page which you should not share with anyone.
- Don’t worry I have changed mine
- You can click on the image to zoom.
- Now upload the code to your ESP8266 – 01 using a FTDI or use a Arduino as a USB to TTL converter and upload the code.
- Then connect the circuit and power it on.
- Wait for 30 seconds to calibrate the PIR sensor, when calibration is done the onboard LED will turn OFF.
- Now when ever a motion is detected the onboard LED will blink and
- A push notification will arrive in your phone saying “Motion Detected”.
Comments