Skip to main content

Grove - Digital PIR Sensor

pir

PIR sensor is an IR sensor to detect human motions. This Grove Digital PIR Sensor is the cheapest PIR sensor in the PIR families, however, it is able to give a quick response and generate a high signal from the "sig" Pin.

With the Grove interface, the Grove digital PIR Sensor is easy to be plugged and played. And it doesn't need any Arduino Library.

pir

Features​

  • Budget-friendly: less than 3 dollars
  • Intuitive: detect motion and output with only ‘high’ and ‘low’ digital signals
  • Simple: no external arduino library required
  • Interface: Grove

Specification​

ItemValue
Voltage range3V–5V
Detecting angle100 degree
Detecting distance3.2m-12m
Response time< 1s
Working temp-20-85 C
InterfaceGrove
Dimensions20mm 20mm 11.5mm
Weight3g
BatteryExclude

Platform Supported​

ArduinoRaspberry Pi

pir

pir

Getting Started​

Getting Started with Arduino​

Materials Required​

Seeeduino XIAOGrove BreadboardGrove Digital PIR Motion Sensor

pir

pir

pir

Get one nowGet one nowGet one now

Hardware Connection​

pir

The Grove interface on the breadboard and on the Grove digital PIR Sensor are connected by the Grove cable.

Softwawre​

  • Step1 Copy the code below to the Arduino IDE and upload. If you do not know how to update the code, please check How to upload code.
#define digital_pir_sensor 5 // connect to Pin 5

void setup()
{
Serial.begin(9600); // set baud rate as 9600
pinMode(digital_pir_sensor,INPUT); // set Pin mode as input
}

void loop()
{
bool state = digitalRead(digital_pir_sensor); // read from PIR sensor
if (state == 1)
Serial.println("A Motion has occured"); // When there is a response
else
Serial.println("Nothing Happened"); // Far from PIR sensor
}
  • Step2 Open the Serial port and you will see the value changing when you take a motion around the PIR sensor.

Getting Started with Raspberry Pi​

Materials Required​

Raspberry Pi 4B(4GB)Grove Base Hat for Raspberry PiGrove Digital PIR Motion Sensor

pir

pir

pir

Get one nowGet one nowGet one now

Hardware Connection​

pir

Connect the PIR sensor with "D5" on the Grove Base Hat.

Code​

  • Step 1 Update the system verion of Raspberry Pi.
sudo apt-get update
  • Step 2 Install the wiringPi.
sudo pip install wiringPi

If you use Pi 4, please select the version of wiringPi

sudo pip install wiringPi==2.52.0
  • Step 3 Get the right Pin you are connecting with.
gpio readall

here comes a table, find the Pim definition of the Pin 5 in wiring definition, in this demo, the pin definition is 21.

gpio read 21

You can read the value from the PIR sensor, when there is a motion, the value is "1", otherwise. the value is "0".

Schematic Online Viewer​

Resource​

Tech Support​

Please do not hesitate to submit the issue into our forum.


Loading Comments...