PIR Sensor | Code | Circuit | Pin configuration


PIR Sensor-passive Infrared Sensor.PIR Sensor is also called a motion sensor because it identifies the motion of a body in front of it but does not give information on who or what moved. PIR Sensor is used to detect living beings either it is a live human being or any live animals, these are mostly used in home automation like automatic room lights control ON/OFF. PIR sensors place an important role in electronic gadgets due to their application.PIR Sensors are very compatible with battery-powered applications because of their minimum size and lower-power operation mode.

Note: PIR Sensor does not radiate the energy, they can detect the radiant energy from the object/radiant energy reflected from the object. This radiant energy is also known as Infrared radiation

Let’s check in to some more functionalities of PIR Sensor.

Model Number: HC-SR501

Other names of PIR Sensor
PID (Passive Infrared Detector), Motion Sensor, Motion Detector, Infrared sensor, Pyro-Electric Sensor, IR-motion sensor.
Other related devices
HC-SR505, 360  ̊ PIR sensor, 120  ̊ PIR infrared body sensor, AM312, AS312.


 Pin Configuration


Battery positive Terminal


Digital Data pin


Battery Negative Terminal




  • Repeatable and non-repeatable modes of operation
  • Sensitive adjustment potentiometer
  • Timer adjustment potentiometer
  • Material: Pyroelectric crystal
  • Covered with Fresnel lenses


Technical specifications

  • Size: Rectangular
  •  Output: Digital pulse high (3V) when triggered (motion detected)                                   Digital low when idle (no motion detected).
  •  Sensitivity range: up to 20 feet (6 meters) 110° x 70° detection range
  •  Power supply: 5V-12V input voltage for most modules


 How PIR Sensors Work

PIR Sensor detects changes in the radiant energy/Infrared radiation. The amount of radiant energy will depend on the object surface and heat emitted by the object. PIR sensor differentiates instantaneously changes (increase) in the temperature, if the temperature is not changed then it is not identify any moving object.

For example, a PIR sensor is fixed at a particular area the room temperature is 35  ̊C, if any the person moved in front of the PIR Sensor the temperature rises above the room temperature only instantaneous of time.

At that point of time-temperature rises from room temperature to body temperature and back  to room temperature, the sensor converts the incoming infrared radiation into the output voltage that triggers the device.

Note: In order to detect the moving objects, the temperature should be above the room temperature

Repeatable trigger mode

 In this mode, when the object is detected the out is set to HIGH only for a certain time after  that time the output voltage goes LOW even the object/person  is  within the of the PIR sensor, this  time period set by the “timing control-potentiometer”. In this mode PIR sensor output irrespectively transition from LOW to HIGH or HIGH to LOW. The range of the PIR sensor is set by the Sensitivity –Potentiometer.

Non-Repeatable trigger mode

In this mode when the object/person is within the range then output set to high as long as the person stays in the sensor range. Output goes LOW only when a person is out of the range. The detecting range of the sensor can vary by using the “sensitivity potentiometer “ as shown in the above figure.


How to work with PIR sensor | Arduino with PIR Sensor


PIR Sensor has three pins Vcc, D0, GND.

Vcc is connected to a 5V pin of Arduino

GND is connected to the GND pin of the Arduino

D0 is connected to any Digital pin(9) of Arduino


Relay module has three pins Vcc, GND, D0

Vcc is connected to a 5V pin of Arduino

GND is connected to the GND pin of the Arduino

D0 is connected to any Digital pin(8) of Arduino







In a normal state, the output of the PIR sensor is LOGIC-0, Arduino identifies it as a no object is moving. if the Output voltage transition to LOGIC-1, Arduino identifies it as an object is detected and turned ON the light.






  • Home applications
  • Security alarms
  • Infrared cameras
  • Advanced street light applications


 Other Articles

RGB-Color Sensor


Flex sensor, RF-Transmitter


Post a Comment