PIR Motion Sensor HC-SR501

৳ 120.00

A passive infrared sensor is an electronic sensor that measures infrared light radiating from objects in its field of view. They are most often used in PIR-based motion detectors. PIR sensors are commonly used in security alarms and automatic lighting applications.

PIR motion sensors consist of two main parts: a pyroelectric sensing element and a fresnel lens. The pyroelectric sensing element can detect infrared radiation. All objects with a temperature above absolute zero (0 Kelvin / -273.15 °C) emit heat energy in the form of infrared radiation, including human bodies.


  • Dimension: 3.2cm x 2.4cm x 1.8cm (approx)
  • Voltage Range: DC 4.5V- 20V
  • Current drain:<60uA
  • Detection distance: 3–7M
  • Detection range: <140
  • Voltage Output: High/Low level signal:3.3V TTL output

A pyroelectric sensor has two rectangular slots in it made of a material that allows the infrared radiation to pass. Behind these, there are two separate infrared sensor electrodes, one responsible for producing a positive output and the other a negative output. The reason for that is that we are looking for a change in IR levels and not ambient IR levels. The two electrodes are wired up so that they cancel each other out. If one half sees more or less IR radiation than the other, the output will swing high or low.

The on-board signal processing IC processes this signal and turns the output pin of the sensor HIGH or LOW accordingly.

Package Included: 1 X PIR Motion Sensor HC-SR501




Sample Code

  1. // Define connection pins:
  2. #define pirPin 2
  3. #define ledPin 13
  4. // Create variables:
  5. int val = 0;
  6. bool motionState = false; // We start with no motion detected.
  7. void setup() {
  8. // Configure the pins as input or output:
  9. pinMode(ledPin, OUTPUT);
  10. pinMode(pirPin, INPUT);
  11. // Begin serial communication at a baud rate of 9600:
  12. Serial.begin(9600);
  13. }
  14. void loop() {
  15. // Read out the pirPin and store as val:
  16. val = digitalRead(pirPin);
  17. // If motion is detected (pirPin = HIGH), do the following:
  18. if (val == HIGH) {
  19. digitalWrite(ledPin, HIGH); // Turn on the on-board LED.
  20. // Change the motion state to true (motion detected):
  21. if (motionState == false) {
  22. Serial.println(“Motion detected!”);
  23. motionState = true;
  24. }
  25. }
  26. // If no motion is detected (pirPin = LOW), do the following:
  27. else {
  28. digitalWrite(ledPin, LOW); // Turn off the on-board LED.
  29. // Change the motion state to false (no motion):
  30. if (motionState == true) {
  31. Serial.println(“Motion ended!”);
  32. motionState = false;
  33. }
  34. }
  35. }

Based on 0 reviews

0.0 overall

Be the first to review “PIR Motion Sensor HC-SR501”

There are no reviews yet.