How to guard your home with Raspberry Pi

In brief, our goal is to build an alarm system with our Raspberry Pi that's triggered by a PIR sensor, which detects movement.

Once the alarm is tripped, a camera will take a quick picture of the event, and then record 10 seconds of video. To alert the user that the alarm has been triggered a text message is sent. So let's get started!

Raspberry Pi

1. Connect the PIR

Our PIR sensor needs three connections to work: VCC (5V), Out and Ground (GND). To connect our sensor to the Raspberry Pi, we need to use female to female jumper cables.

You can buy them from many online retailers. On the sensor, locate the VCC pin and gently push a cable until it is firmly in place.

On your Raspberry Pi, locate Pin 2 and gently push the VCC cable into place. We connect the VCC pin on the PIR sensor to a 5V pin on a Raspberry Pi, which is Pin 2.

When connecting anything to the GPIO, ensure that the Raspberry Pi is powered off and that all connections are checked before powering on your Raspberry Pi.

Raspberry Pi

2. Ground and Out

We then need to repeat the process and connect the GND pin of our sensor to GND on a Raspberry Pi, which is Pin 6. Lastly, we connect our Out pin to Pin 7.

For our connection to the PIR sensor, we will require no resistors inline as the PIR has a diode to protect the board, and the signal sent via the Out pin is 3V and safe with our Raspberry Pi.

Our PIR sensor needs three connections to work: VCC (5V), Out and Ground (GND). To connect our sensor to the Raspberry Pi, we need to use female to female jumper cables. You can buy them from many online retailers. On the sensor, locate the VCC pin and gently push a cable until it is firmly in place.

On your Raspberry Pi, locate Pin 2 and gently push the VCC cable into place. We connect the VCC pin on the PIR sensor to a 5V pin on a Raspberry Pi, which is Pin 2. When connecting anything to the GPIO, ensure that the Raspberry Pi is powered off and that all connections are checked before powering on your Raspberry Pi.

Raspberry Pi

3. Connect the camera

Our next piece of hardware is the Raspberry Pi Camera, and to insert the camera, you need to locate a plastic port between the HDMI and Ethernet port on the board.

Gently lift the plastic lock from the port and then slide the ribbon cable into the slot, with the silver strips of the ribbon facing the HDMI port.

Once fully slid into place, press the plastic lock back into its original position. The ribbon cable will now be locked in place.

Latest in Raspberry Pi
white keyboard PC with mouse and book
The Raspberry Pi 500 is a state-of-the-art keyboard PC...just like the Tandy 1000 in the 1980s
Raspberry Pi strapped to a satellite takes stunning picture of Earth
Kali Linux on Pi 4
Raspberry Pi 4 gets Kali Linux, a distro aimed at ethical hackers
Worried about Alexa spying on you? This Raspberry Pi smart speaker for kids puts privacy first
How to install Ubuntu on the Raspberry Pi
New Raspberry Pi 3 Model A+ is somehow even smaller and cheaper
Latest in How Tos
Photoshop CC logo on a screen
How to make an image background transparent in Photoshop
Glasgow Rangers' Nigerian forward Cyriel Dessers runs with the ball during a UEFA Europa League round of 16 first-leg football match in March 2025
Rangers vs Fenerbahce live stream: How to watch UEFA Europa League online
Tottenham Hotspur player Lucas Bergvall participates in the match at the AFAS Stadium for the UEFA Europa League
Tottenham vs AZ live stream: How to watch the Europa League online from anywhere
Bruno Fernandes of Manchester United celebrates after scoring their side's first goal during a Premier League match in March 2025
Man Utd vs Real Sociedad live stream: How to watch the Europa League game online
Cheltenham racing festival 2024 day four: Paul Townend on Galopin Des Champs crosses the finishing line for victory in the Gold Cup
Cheltenham Festival 2025 live stream: How to watch world-class horse racing online
Vinicius Junior of Real Madrid in action during the UEFA Champions League in March 2025
Atletico Madrid vs Real Madrid live stream: How to watch Champions League online