PIR Sensor: Difference between revisions
		
		
		
		Jump to navigation
		Jump to search
		
| Line 8: | Line 8: | ||
| [[File:Pir3.PNG|x300px]] | [[File:Pir3.PNG|x300px]] | ||
| This one is the  | |||
| and it should be connected to 5V, GND and a digital Pin. | |||
| [[File:Pir2.JPG|x300px]] | [[File:Pir2.JPG|x300px]] | ||
| [[File:Pir4.JPG|x300px]] | |||
| = How to connect it electrically = | = How to connect it electrically = | ||
Revision as of 23:34, 11 January 2021
Description
A PIR Sensor can detect motion, it is also called motion sensor. It detect moveing people or animals. PIR stands for passive infrared. Here we use the SR602.
It has 3 connectors:
- - connected to GND
- + connected to 3.3V
- Out - digital output is 1 if motion is detected
This one is the and it should be connected to 5V, GND and a digital Pin.
How to connect it electrically
How to control it in MicroPython
Reading the value and printing it to the console
#Example usage for ESP32
from machine import Pin
from time import sleep
# digital input on pin 26
pir = Pin(26, Pin.IN, Pin.PULL_UP) # enable internal pull-up resistor
while True:
  pirVal = pir.value()
  print(pirVal)
  sleep(1)Related Tutorial Videos