Raspberry Pi Pico Projects

Interfacing PIR Motion Sensor with Raspberry Pi Pico


In this Raspberry Pi Pico series tutorial, we will learn how to interface a PIR Motion Sensor with Raspberry Pi Pico. A PIR sensor is a sensor that is used to detect the presence of an object by measuring the infrared radiation emitted by the object. PIR sensors are used in a wide variety of applications, including security systems, motion detectors, and automatic doors. PIR sensors can be used with Raspberry Pi Pico to detect the presence of people or objects.

Required Components

What is a PIR Motion Sensor?

PIR sensors are sensitive to infrared radiation, which is emitted by warm objects. When a PIR sensor detects infrared ray, it produces a signal that can be used to trigger an event, such as turning on a light. In this tutorial, we’ll show you how to use a PIR sensor with Raspberry Pi Pico.

PIR sensors are available in a  many variety of shapes and sizes in market. In this tutorial we use The HC SR501  PIR Motion Sensor, This sensor is a good choice for this tutorial because it’s easy to use and it’s already

The PIR sensor has three pins: power, ground, and signal.

Circuit Diagram of PIR Motion Sensor with Raspberry Pi Pico

The circuit diagram is a very easy to how an Raspberry Pi Pico and PIR motion sensor can be used together. The PIR sensor is used to detect movement, and the Raspberry pi pico is used to control the PIR sensor and turn it on or off buzzer Or alaram.


PIR Motion Sensor with Raspberry Pi Pico


Source Code : PIR Motion Sensor with Raspberry Pi Pico

Open Thonny IDE and paste following code:

from machine import Pin

PIR = Pin(28,Pin.IN)
LED= Pin(15,Pin.OUT)

while True:
    if PIR.value() == 1:


After Upload code You will see that the Buzzer remains OFF when no motion is detected and when the PIR sensor detects motion, Buzzer ON.

Leave a Reply

Your email address will not be published.

Related Articles

Back to top button