CNAP

PIR Motion Sensor Reference

A passive infrared (PIR) sensor that outputs a digital HIGH signal when it detects motion from a warm body within its field of view.

Pin names

NameDescription
VCCPower (5V)
OUTSignal Out — HIGH while motion is detected
GNDGround

Attributes

This component has no configurable attributes.

Usage

Connect VCC to 5V, GND to GND, and OUT to a GPIO configured as INPUT.

const int PIR_PIN = 2;

void setup() {
  pinMode(PIR_PIN, INPUT);
  Serial.begin(9600);
}

void loop() {
  if (digitalRead(PIR_PIN) == HIGH) {
    Serial.println("Motion detected!");
  }
  delay(200);
}

Real PIR modules typically need 30–60 seconds to calibrate after power-on, and have an onboard trimmer for sensitivity and hold-time — the simulator model skips this warm-up.

Examples

DescriptionAttrs
Default PIR sensor{}

See also

  • Tilt Switch — another simple binary digital sensor
  • HC-SR04 — distance-based alternative for presence detection