Site Tools


Sidebar

Content

pub:pir_sensor

This is an old revision of the document!


PIR Sensor

what's PIR Sensor

The PIR (passive Infrared) sensor can detect the Infrared rays emitted by human or animals and then output On/Off signals. Traditional pyroelectric PIR sensor needs pyroelectric Infrared probe, special chip and complex circuits to make the effect. In this case, the sensor is a large one with complicated circuits and comparatively less credible. But this Infrared pyroelectric motion sensor adopts the digital integration of the probe, so it boasts high credibility, low power consumption and simple outside circuit with a small size. It can be applied to any cases in detecting moving human or animals.


Pin definition:

S Digital output
3.3V 3.3V
- GND



Microbit

1 * microbit 1 * microbit expansion board 1 * USB cable 1 * PIR Sensor - Several Jumper wires

connection diagram:


Code:

makecode:

MU python:

 



Arduino

Components
- 1 * Adeept Arduino UNO R3 Board
- 1 * PIR Sensor Module
- 1 * USB Cable
- 1 * 3-Pin Wires

Build the circuit


Adeept UNO R3 Board PIR Sensor Module
D8 S
3.3V 3.3V
GND -

Code:

 

Compile and download the sketch to the UNO R3 board.



Open the Serial Monitor in Arduino IDE. When the PIR module detects human movement, “Invasion!” will be displayed on the window; otherwise, “No invasion”



Raspberry pi

Components
- 1 * Raspberry Pi
- 1 * GPIO Extension Board
- 1 * 40-Pin GPIO Cable
- 1 * Breadboard
- 1 * PIR Sensor Module
- 1 * 3-Pin Wires

Build the circuit


Code: C code:

 

Python code:

 

For C language users:

Step 2: Edit and save the code with vim or nano.

(code path: /home/Adeept_Sensor_Kit_for_RPi_C_Code/16_PIR/pir.c)

Step 3: Compile

$ sudo gcc pir.c -o pir -lwiringPi

Step 4: Run

$ sudo ./pir

For Python users:

Step 2: Edit and save the code with vim or nano.

(code path: /home/Adeept_Sensor_Kit_for_RPi_Python_Code/16_PIR.py)

Step 3: Run

$ sudo python 16_PIR.py

When the PIR module detects human movement, “ Someone invasion !!!” will be displayed on the terminal.


Reference material:http://www.adeept.com/learn/
Video:http://www.adeept.com/video/

pub/pir_sensor.1547200431.txt.gz · Last modified: 2019/01/11 17:53 by Adeept