Skip to content

Latest commit

 

History

History
93 lines (66 loc) · 3.23 KB

File metadata and controls

93 lines (66 loc) · 3.23 KB

PIR Sensor

Overview

This section provides details of the PIR Sensor, including the components and assembly instructions. A Passive Infrared Sensor measures infrared light radiating from objects to detect motion.

Components
  • PIR Sensor

  • Breadboard

  • T-Extension Board

  • Jumper wires x 3

  • Power source (5V)

  • 3 x 220Ω resistors

  • RGB LED

Assembly Instructions

When looking at the bottom of PIR, the pins from left to right are:

  1. Power: connect the left pin on the PIR to 5V0 on the breadboard

  2. I/O: connect the middle pin on the PIR to GPIO 13 on the breadboard

  3. Ground: connect right pin on the PIR to GND on the breadboard

  4. Set up the RGB LED

Circuit Diagram
PIR Sensor Circuit
Schematic Diagram
PIR Sensor Schematic
Functionality

A PIR - Passive Infrared sensor detects motion by sensing changes in the infrared light emitted by objects in its environment. It works passively, meaning it does not emit any infrared light itself, but rather detects the infrared radiation coming from warm objects, such as humans or animals. The sensor has two sensitive slots that detect infrared radiation.

As a warm object moves across its field of view, the amount of infrared radiation reaching each slot changes, creating a detectable change in the radiation pattern. This change triggers the sensor to send an electrical signal, which can then be used to activate alarms, lights, or other devices, making PIR sensors widely used in security systems and automated lighting controls due to their efficiency and effectiveness in detecting motion.

Testing

Use the below command to enable the sensor.

$ curl http://localhost:8080/pirSensor/enable

Once the sensor is enabled, anytime the sensor detects motion, the RGB LED will turn red. If no motion is detected, the RGB LED will be green.

Use the below command to disable the sensor.

$ curl http://localhost:8080/pirSensor/disable
Troubleshooting
  • Sensor not detecting something:

    • Make sure the object is moving. The sensor only detects movement. Once an object stops moving, it is no longer detected.

YAML Configuration

A BCM numbering system is used. More info can be found here.

digital-input:
    pir-sensor:
      name: PIR Sensor
      address: 13
      pull: PULL_DOWN
      debounce: 30000
      provider: pigpio-digital-input
Constructor and Methods

The constructor and the methods within the PIRSensorHelper class can be seen in our javadoc here.

Example Controller
This controller uses the PIR Sensor to turn an RGB LED red if motion is detected, green otherwise
link:../../../../../../components/src/main/java/com/opensourcewithslu/components/controllers/PIRSensorController.java[role=include]