top of page

interface pir sensor with arduino

Updated: May 18

In this project, you will learn to interface a PIR sensor with the Arduino.

Hardware Components:

1. Arduino Uno - pir sensor with arduino

#ArduinoUno board is used for interfacing the input-output elements to construct a project. It is an open-source microcontroller board that can be programmed according to user requirements.

Arduino Uno
Arduino Uno

2. Passive Infrared Sensor(PIR):

PIR sensor detects and measures the infrared radiation emitting from the objects present in its range of application. #PIRsensor is commonly used in motion detection applications.

PIR sensor
PIR sensor

3. LED:

Light Emitting Diode (LED) is a semiconductor device that emits light when the current flows through it. The color of the light emitted by the LED depends on the bandgap the electrons need to cross to recombine with the holes in the semiconductor.


4. Resistor-220Ω:

The resistor is a passive electronic component that offers resistance to the current flowing through it. In this project, we use 220Ω resistors to reduce the current flowing through the LED.

Circuit Connections:

  • Connect the power pin of the PIR sensor to the 5V of the Arduino via a breadboard.

  • Connect the ground of the PIR sensor to the ground of the Arduino.

  • Connect the signal pin of the PIR sensor to D13 of the Arduino.

  • Connect the Anode of the LED pin to D12 of the Arduino through a 220Ω resistor.

  • Connect the cathode of the Arduino to the ground rail on the breadboard.


  • Define the Arduino pins connected to the PIR sensor and the LED.

  • Define and initialize a boolean variable pi_val to 0.

  • In void setup(), start the serial monitor output with a 9600 baud rate.

  • Set the pin modes for the LED and the PIR pins.

  • In void loop(), store the Digital value read from the PIR sensor in the variable pi_val.

  • Using the if-else condition, set the LED to glow for a high pi_val. Set the led output to low, otherwise.


Connect the hardware connections and copy the code in the Arduino IDE. When the PIR sensor detects any movement in its range, then the LED will glow.

Video By - Maninder Kumar

Written by-

Name- Nagashree R Nadig

See also-

SMS alert using IOT - Esp8266

Motion Controlled Colour Changer

Follow us -

Please do follow us i.e #learnelectronicsindia to get daily updates about new blogs, videos, courses, quizzes, and contests.

Want us to help you with the projects, write your inquiry here - Order Projects

Check out our Free Arduino Projects Playlist - Arduino Projects

Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects

Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects

Check out our Free IoT Projects Playlist - IoT Projects

Check out our Free Home Automation Projects Playlist - Home Automation Projects

Check out our Free NodeMCu Projects Playlist - NodeMCu Projects

470 views2 comments


Informative and concise! LearnElectronics India always delivers quality content.


Anushka Gupta
Anushka Gupta
Jul 19, 2023

I just wanted to express my gratitude for this outstanding blog/article by Learn Electronics India. The step-by-step instructions on interfacing a PIR sensor with Arduino were incredibly well-written and easy to understand. I especially appreciated the practical tips and recommendations provided along the way. This blog has not only expanded my knowledge but also inspired me to explore more Arduino projects. Thank you for sharing your expertise.

bottom of page