Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the health-check domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/wp-includes/functions.php on line 6114
Interfacing PIR Motion Sensor with Raspberry Pi Pico - Electric DIY Lab

Interfacing PIR Motion Sensor with Raspberry Pi Pico

Thumbnail

Hello,

In this article we are going to interface Raspberry Pi Pico with PIR sensor module and make Anti-Theft Alarm.

If someone enter in room or anywhere sensor is place, sensor will detect human and trigger alarm.

Here, we used buzzer as alarm. If PIR sensor module detect human or animal body it will give signal to Raspberry Pi Pico and pico will turn on the alarm.

Let’s make this.

If you are new to Raspberry Pi Pico and wants to get started then click here, it is all about getting started with Raspberry Pi Pico.

VIDEO

Required Components

List of required components is given below.

Raspberry Pi Pico

PIR Sensor Module

Buzzer

Jumper Wires

Bread Board

Schematic Diagram

Follow this schematic diagram and make connections.

Schematic Diagram
  • Connect Vcc of PIR sensor with 5V of Pico.
  • Connect Dout pin of PIR with GP28 pin of Pico.
  • Connect GND of PIR with GND of Pico.
  • Connect anode pin of buzzer with GP15 Pin of Pico.
  • Connect Cathode pin of buzzer with GND pin of Pico.

Coding

To write and upload program here i used Thonny IDE. You can download from here.

Here i write code in micropython.

from machine import Pin

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

while True:
    if PIR.value() == 1:
        Buz.high()
        
    else:
        Buz.low()

Save this code in Raspberry Pi Pico and and name it main.py