PIR Sensor -Email Sending Movement Detector using IFTTT
Introduction
In this lesson you will learn how to use a PIR movement detector with an Raspberry pi4 Python program running on your computer to send an email whenever movement is detected by the sensor.
if you work some step with me i hope you can do this
Let's go
Step 1: Create account on IFTTT
go to https://ifttt.com/ sign up and Login
Click on Create
Now Click If+This
Choose a service webhooks
Click on Receive a web request
Write your Event Name motion_detector
Click on +That
Choose action service Email
Choose action Send me an email
Complete action fields(more on my Video) Click Create action
Click on finish
then go to home Click on webhooks
Go to Documentation
Now you Can see your key
Step-1is ok then of to
STEP-2
Install Requests
Requests is the module which allows us to send the HTML POST request to IFTTT.
Install requests by typing the following command, followed by enter:
sudo pip3 install requests
Python script
1.You'll need to change the part that says YOUR_KEY to your IFTTT key
2.You'll need to change the part that says YOUR_EVENT_NAME to whatever event name you want to use with Webhooks (remember, we used 'motion_detected' in the example)
requests.post('https://maker.ifttt.com/trigger/YOUR_EVENT_NAME/with/key/YOUR_KEY_HERE', params={"value1":"none","value2":"none","value3":"none"})
Test Code is :
import requests
requests.post('https://maker.ifttt.com/trigger/motion_detector /with/key/nSnY012ZcVDsjlKHkdUymDC-Q1pTdsLGie2mvp9gw5I', params={"value1":"none","value2":"none","value3":"none"})
Go to raspberry pi and run code
now you can see your Massage
Step 2 is finish then go to
STEP-3 nowe are code on PIR Sensor -Email Sending Movement Detector using IFTTT
First go to PIR Motion Sensor using Raspberry Pi4 | Interfacing Tutorial read this then go to This code:
Circuit Diagram
Circuit Design
Connect the VCC and GND pins of the PIR Motion Sensor to +5V and GND pins of the Raspberry Pi. Connect the DATA Pin of the PIR Sensor to GPIO24 of the Raspberry Pi.A 5V Buzzer is connected to GPIO20 i.e. and BC547 base Connected toGPIO 21 and Emitter Connected to GND and Collector connected to relay signal pin of the Raspberry Pi. The other pin of the buzzer and LED is connected to GND.The Code
Here's the full Python script. Below the code you'll see how to easily download this directly to your Raspberry Pi:
Comments