Thursday, September 21, 2023

Intrusion Detection and Image Storage Using Pi Camera and Firebase

By Dr Geetali Saha and Premal Talpada

- Advertisement -

The proposed project is a Raspberry Pi-based intrusion detection system that uses a passive infrared (PIR) sensor to detect motion and a Pi camera to take pictures. The images obtained are stored in Firebase, which is Google’s mobile platform that helps you quickly develop high-quality apps.efy test

Any area (indoors or outdoors) can be put under observation and even a slight movement by any heat-radiating body, such as a human being or an animal like a cat or dog, can be detected. On detection, the sensor triggers the camera to capture an image of the area. This system for intrusion detection can be modified to capture wildlife photos, face recognition, or other such applications.

Without Firebase settings enabled, the captured images are by default saved in Raspberry Pi. Either way, the autogenerated name itself contains the time and date of the movement in the area under observation, thereby giving the added advantage for user verification of the zone of observation (and verification of the same against expected or unexpected trespassing) by checking the folder. The same can be accessed on the Firebase system on your Android/iOS device or via a web app.

Intrusion Detection System
Bill of Material
Components Quantity Description
Raspberry Pi 3b+ 1 For programming
PIR sensor 1 Motion sensor
Pi cam 1 5MP Pi camera
Jumper wire 3 Female-female jumper
- Advertisement -

Python language is used for programming. Before coding, the configuration of Raspbian OS on Raspberry Pi is needed. You need to install the Pi camera library files to run this project on Raspberry Pi.

Intrusion Detection System using Raspberry Pi
Fig. 1: Intrusion Detection System with no movement

Fig. 1 shows the author’s prototype when the PIR sensor does not detect any movement.

Fig. 2 shows the prototype when the sensor detects a small hand movement and activates the Pi camera to record the image. The image is captured and stored for reference. The components used in the project are listed in Table 1 for the Bill of Material.

Raspberry Pi-based Intrusion Detection Security System
Fig. 2: Intrusion Detection System detecting hand movement

Raspberry Pi – Installation and Setup

To use a Raspberry Pi camera (having a ribbon cable), first, enable the camera interface in the Raspberry Pi config setting. The following code is used for this part:


This is PREMIUM content, which means that only
REGISTERED users of our website can read it, by logging in.

If you ARE a registered user, CLICK HERE to login.
Else, CLICK HERE to register for FREE!


  1. Thank you for the good and useful project. As mentioned it detects pets like cat and dog. What is the smallest object it can detect? Like rats, cockroaches and mosquitoes? Is the detection depends on volume or body temperature of the intruder?


Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components