Raspberry Pi Motion Sensor using a PIR Sensor

In this tutorial we’re building a Raspberry Pi motion sensor that makes use of a PIR sensor (Passive Infrared Sensor). Also to make this project a little more interesting we will also be using a piezo speaker whenever motion is detected. Both these devices will need to be hooked up to the GPIO pins in order to work.raspberry pi motion sensor using-a pir sensor

Equipment:

In order to do this project, you will need some equipment this includes a Raspberry Pi PIR sensor and a piezo speaker.
Raspberry Pi

SD Card (8 GB+ Recommended) or Micro SD Card if you’re using a Raspberry Pi 2, 3 or B+

PIR Sensor

Piezo speaker

1x 100-ohm resistor

Optional:

Ethernet Cord or Wifi dongle (These are only required if you plan on remotely controlling the Pi)

GPIO Breakout Kit Assembled

Breadboard

Breadboard Wire/Jumper Cables

Whilst the breakout board, breadboard and the wire are optional I do highly recommend using these as they will make your life a lot easier. Also be sure to check out some of the best Raspberry Pi cases you’re able to get.

Raspberry Pi PIR Sensor Hardware Setup

We will be putting together a simple circuit that makes use of a PIR sensor and also a piezo speaker.

A PIR sensor is most commonly seen in security systems to detect movement before sending the alarm off. They detect motion whenever there is a change of infrared temperature in their field of view.

Most PIR sensors have some adjustable screws on them that will allow you to adjust both the time and sensitivity of them. The time will allow you to set a delay before it will go off (Send a high signal). (About 2-4 seconds). The sensitivity is how much movement needs to occur before it will go off.

The piezo buzzer is a simple speaker that outputs a sound whenever a current is run through it. In this circuit the buzzer will give a loud beep whenever the motion detector circuit is triggered.

A breadboard isn’t necessarily required for this project but I would highly recommend using one. They make prototyping and building circuitry a lot easier.

You don’t have to use a breadboard like I am you can just simply hook these straight up to the Raspberry Pi.circuit raspberry pi motion sensor using a pir sensor

To construct the circuit simply do the following.

  1. Run a ground pin to the ground/negative rail on the breadboard.
  2. Run a 5v pin to the positive rail on the breadboard.
  3. Connect the piezo buzzer to pin 7 (Red wire) and the negative rail (Black wire).
  4. Run a wire from pin 11 to the breadboard. Place a 100-ohm resistor at the end of the wire. Then connect this up to the yellow wire of the PIR sensor.
  5. Now for the PIR sensor run the red wire to the 5v line and the black wire to the ground rail on the breadboard.

For more detail: Raspberry Pi Motion Sensor using a PIR Sensor

Scroll to Top