Introduction: Pır Sensor+Raspberry Pi+IFTTT
Hey guys; we make an alarm with raspberry pi, Pir sensor and a smartphone.You can use this at your home, at your room or anywhere else you want :)
Step 1: PIR
First of all; you have to connect pir to raspberry pi as the way you see in the photo.check pir's connection it can be changed over the time, better the check. vcc=5v(pin2) ,out=pin7, gnd=pin6 .
Step 2: IFTTT
and then you need to use www.ifttt.com and create a new applet. Go to maker settings , copy and go on that url.
Step 3: Command Line
then coppy and paste curl code (curl -X POST https://maker.ifttt.com/trigger/room/with/key/YourKey) to raspberry's command line.and you can see "Congratulations! You've fired the detected event".
Step 4: Python 3
last step is your python code.
--------------------------------
import RPi.GPIO as GPIO
import requests
import time
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7, GPIO.IN)
GPIO.setup(16, GPIO.OUT)
while True:
i=GPIO.input(7)
if i==0:
print ("No one")
time.sleep(1)
if i==1:
print ("someone is detected")
r=requests.post('https://maker.ifttt.com/trigger/detected/with/key/YourKeyİsHere')
time.sleep(1)
-------------------------------------------------------------------------------------
if this will not wok try to create a new applet and apply steps again.Good luck :)