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.
- Raspberry Pi PIco —>https://amzn.to/3LCIoWq
- PIR Sensor —>https://amzn.to/3KxRlPK
- Jumper wire —>https://amzn.to/3LN8ohS
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.
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: LED.high() else: LED.low()
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.
You may also like to read: