echo '' ;

Embedded Sensor – Passive Infrared Sensor (PIR)

  • PIRPassive InfraRed Sensor
  • PIR consists of a Pyroelectric sensor which generates energy when exposed to heat.
  • The module covered with Fresnel Lense Cover.
  • BISS0001 micro Power PIR Motion Detector IC.

Infrared Application

  • Passive Infrared Detector for Anti Theft security alarm system.
  • Passive Infrared Detector based Light On/OFF.
  • Automatic Light  ON/OFF.
  • Many other motion Detection Application.

Different PIR Modules

The HC-SR501 PIR Sensor Module

  • Working voltage : 5v to 20V DC
  • Range : 3 to 7 meters
  • Induction Lens size: 23mm.
  • PCB Size: 32mm x24mm.
  • Pins Details
    • Ground pin
    • VCC pin
    • The output pin detects an object when it is at a high logic level.
  • Two potentiometers.
    • One for adjusting the sensitivity of the sensor
    • Adjust the time for the output signal to stay high when an object is detected from 0.3 seconds up to 5 minutes.
  • Jumper Settings (Selecting the trigger modes)
    • non-repeatable trigger – when the sensor output is high and the delay time is over, the output will automatically change from high to low level.
    • Repeatable trigger –  will keep the output high all the time until the detected object is present in sensor’s range

Arduino Example code :

Circuit

Code

/* Arduino PIR Motion Sensor Tutorial */
/* www.ArunEworld.com */

int pirSensor = 8;
int relayInput = 7;

void setup() {
  pinMode(pirSensor, INPUT);
  pinMode(relayInput, OUTPUT);
}

void loop() {
  int sensorValue = digitalRead(pirSensor);
  if (sensorValue == HIGH) {
    digitalWrite(relayInput, LOW); // The Relay Input works Inversely
  }
}

Code Explanation

This Arduino code is for a PIR (Passive Infrared) motion sensor setup, where a relay is controlled based on motion detection. Here’s an explanation of each part:

SectionExplanation
CommentsThe code includes comments providing information about the purpose of the code and its source.
Variable DeclarationpirSensor = 8;: Declares a variable pirSensor and assigns pin 8 to it for reading the PIR sensor’s output. – relayInput = 7;: Declares a variable relayInput and assigns pin 7 to it for controlling the relay.
Setup FunctionInitializes the pins: – Sets pirSensor pin as INPUT to receive data from the PIR sensor. – Sets relayInput pin as OUTPUT to control the relay.
Loop Function– Reads the digital state from the pirSensor pin to check for motion detection. – If motion is detected (sensor value is HIGH), it turns on the relay by setting the relayInput pin LOW.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from ArunEworld

Subscribe now to keep reading and get access to the full archive.

Continue reading