edit

Grove - Digital PIR Sensor

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.

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

Item Value
Voltage range 3V–5V
Detecting angle 100 degree
Detecting distance 3.2m-12m
Response time < 1s
Working temp -20-85 C
Interface Grove
Dimensions 20mm * 20mm * 11.5mm
Weight 3g
Battery Exclude

Getting Started

Materials Required

Platform Select

Hareware connection

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.
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    #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.

Schematic Online Viewer

Resource