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 various 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 an 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 many varieties of shapes and sizes in the 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 very easy to how a 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 the buzzer Or alarm.
Micropython Code: PIR Motion Sensor with Raspberry Pi Pico
Open Thonny IDE and paste the following code: Check also How to Setup a Raspberry Pi Pico and Code with Thonny IDE
from machine import Pin
sensor_pir = machine.Pin(28, machine.Pin.IN)
led = machine.Pin(15, machine.Pin.OUT)
for i in range(50):
After the Upload code, You will see that the Buzzer remains OFF when no motion is detected and when the PIR sensor detects motion, Buzzer is ON.
Read Similar Articles:
- Getting Started Raspberry Pi Pico – Pinout, Specs – Beginner Guide
- Interfacing PIR Motion Sensor with Raspberry Pi Pico
- Raspberry Pi Pico Home Automation System
- Interface Servo Motor With Raspberry Pi Pico
- Interface 0.96″ OLED Display with Raspberry Pi Pico
- Raspberry Pi Pico Weather Station Using Dht11 Sensor
- Interface 16*2 LCD Display With Raspberry Pi Pico