Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

Intruder detection with Raspberry Pi using camera

By Vinay Kadali August 11, 2021

Summary

Aim of the project:

The main aim of this project is to provide more security in restricted areas.

General Application of circuit:

Banks:

In banks it is mainly used in locker rooms for more security. If any motion is detected is in locker rooms it will capture the photos automatically.

Demonstrate its working:

PIR is a sensor which is used to detect any motion. If any motion is detected by PIR sensor   then it will send activation message to raspberry pi. Then raspberry pi will turn on the camera and then pi camera will capture the image.

Description:-

Block diagram:

Block Diagram of Raspberry Pi based Intruder Alarm

Fig. 1: Block Diagram of Raspberry Pi based Intruder Alarm

Ethernet :

Image showing Ethernet Cable connecting PC and Raspberry Pi

Fig. 2: Image showing Ethernet Cable connecting PC and Raspberry Pi

It is a Family of computer networking technologies for local area networks (LANs) and metropolitan area networks (MANs). It was commercially introduced in 1980 and first standardized in 1983 as IEEE 802.3, and has since been refined to support higher bit rates and longer link distances. Over time, Ethernet has largely replaced competing wired LAN technologies such as token ring, FDDI, and ARCNET. The primary alternative for contemporary LANs is not a wired standard, but instead a wireless LAN standardized as IEEE 802.11 and also known as Wi-Fi.

The Ethernet standards comprise several wiring and signaling variants of the OSI physical layer in use with Ethernet. The original 10BASE5 Ethernet used coaxial cable as a shared medium. Later the coaxial cables were replaced with twisted pair and fiber optic links in conjunction with hubs or switches. Over the course of its history, Ethernet data transfer rates have been increased from the original 3 megabits per second (Mbit/s) to the latest 100 gigabits per second (Gbit/s), with 400 Gbit/s expected by early 2017

Systems communicating over Ethernet divide a stream of data into shorter pieces called frames. Each frame contains source and destination addresses and error-checking data so that damaged data can be detected and re-transmitted. As per the OSI model, Ethernet provides services up to and including the data link layer.

PIR sensor:-

Typical Image of PIR Sensor

Fig. 3: Typical Image of PIR Sensor

An individual PIR sensor detects changes in the amount of infrared radiation impinging upon it, which varies depending on the temperature and surface characteristics of the objects in front of the sensor.] When an object, such as a human, passes in front of the background, such as a wall, the temperature at that point in the sensor’s field of view will rise from room temperature to body temperature, and then back again. The sensor converts the resulting change in the incoming infrared radiation into a change in the output voltage, and this triggers the detection. Moving objects of similar temperature to the background but different surface characteristics may also have a different infrared emission pattern, and thus sometimes trigger the detector.

PIRs come in many configurations for a wide variety of applications. The most common models have numerous Fresnel lenses or mirror segments, an effective range of about ten meters (thirty feet), and a field of view less than 180 degrees. Models with wider fields of view, including 360 degrees, are available—typically designed to mount on a ceiling. Some larger PIRs are made with single segment mirrors and can sense changes in infrared energy over one hundred feet away from the PIR. There are also PIRs designed with reversible orientation mirrors which allow either broad coverage (110° wide) or very narrow “curtain” coverage or with individually selectable segments to “shape” the coverage.

Raspberry pi:-

Typical Image of Raspberry Pi 2

Fig. 4: Typical Image of Raspberry Pi 2

The Raspberry Pi is a series of credit card-sized single-board computers developed in the UK by the Raspberry Pi Foundation with the intention of promoting the teaching of basic computer  science in schools.

The original Raspberry Pi is based on the Broadcom BCM2835 system on a chip (SoC), which includes an ARM1176JZF-S700 MHz processor, Video Core IV GPU, and was originally shipped with 256 megabytes of RAM, later upgraded (models B and B+) to 512 MB. The system has Secure Digital (SD) (models A and B) or Micro-SD (models A+ and B+) sockets for boot media and persistent storage. In 2014, the Raspberry Pi Foundation launched the Compute Module, which packages a BCM2835 with 512 MB RAM and MMC flash chip into a module for use as a part of embedded systems.

Pi camera:-

Typical Image of Raspberry Pi Camera

Fig. 5: Typical Image of Rapsberry Pi Camera

The Raspberry Pi Camera Module is a custom designed add-on for Raspberry Pi. It attaches to Raspberry Pi by way of one of the two small sockets on the board upper surface. This interface uses the dedicated CSI interface, which was designed especially for interfacing to cameras. The CSI bus is capable of extremely high data rates, and it exclusively carries pixel data.
The board itself is tiny, at around 25mm x 20mm x 9mm. It also weighs just over 3g, making it perfect for mobile or other applications where size and weight are important. It connects to Raspberry Pi by way of a short ribbon cable. The camera is connected to the BCM2835 processor on the Pi via the CSI bus, a higher bandwidth link which carries pixel data from the camera back to the processor. This bus travels along the ribbon cable that attaches the camera board to the Pi.the sensor itself has a native resolution of 5 megapixel, and has a fixed focus lens onboard. In terms of still images, the camera is capable of 2592 x 1944 pixel static images, and also supports 1080p30, 720p60 and 640x480p60/90 video.

Working of the circuit:-

After  installing  the OS in the Raspberry pi connect the raspberry pi to PC through LAN cable with the help of MobeXterm software   we have to open  the desktop of raspberry pi.

Before opening desktop open MobeXterm it consists of SSH click on SSH and give the IP address which IP address we have given in the installation of OS in raspberry pi and click on that IP address and open a new window and give the command lxsession for opening the desktop of raspberry pi.The desktop  consists of so many apps like games ,python IDE and root terminal etc…open python IDE and write the code for our requirement and save it as pirsensor.py.open root terminal and for  set the path give the command cd desktop and for execute the code  give the command sudo  python3 pirsensor.py if any motion is detected the PIR sensor is activated and it will give the activation to the raspberry pi and the raspberry pi turn on the camera and capture the images.

Number of components

·    Raspberry pi model B+ board-1

·    Pi camera-1

·    PIR sensor-1

Pin number:-

Pin description of raspberry pi:-

Pin Diagram of Raspberry Pi GPIO

Fig. 6: Pin Diagram of Raspberry Pi GPIO

Connect PIR sensor output as follows

PIR 1st pin supply (+5v) (pin2).

PIR 2nd pin output (GPIO16).

PIR 3rdpin ground (pin 9)

Supply voltage values:-

·   Raspberry pi     –    5v

·   PIR sensor        –   5v

Implemented circuit image:-

Prototype of Raspberry Pi based Intruder Alarm

Fig. 7: 

Prototype of Raspberry Pi based Intruder Alarm

You may also like:


  • What are the top development boards for AI and ML?

  • What is the role of embedded software in electric vehicles?

  • What drone parts you need to build a quadcopter?

  • What are the sensors used in self-driving cars?

  • Motion detectors or motion sensors?

  • What is TinyML?

Project Source Code

###

from time import sleep

import RPi.GPIO as GPIO

import picamera

from tkinter import *

from threading import Thread

 

def motion():

   

     photo = PhotoImage(file="hero.gif")

     w = Label(master, image=photo)

     w.photo = photo

     w.pack()

     mainloop()

 

def threadings():

     GPIO.setmode(GPIO.BCM)

     GPIO.setup(16, GPIO.IN)

     while True:

          if ( GPIO.input(16) == True ):

               print ("Warning - MOTION has been detected!")

               with picamera.PiCamera() as camera:

                    camera.start_preview()

                    sleep(2)

                   

                    camera.capture('/home/pi/Desktop/hero.gif')

                    camera.stop_preview()

                    master = Tk()

                    photo = PhotoImage(file="hero.gif")

                        

                    w = Label(master, image=photo)

                    w.photo = photo

                    w.pack()

                    mainloop()

                   

 

          else:

               print ("All is QUIET in RPi...")

               sleep(1);

     motion()

 

while True:

     t=Thread(target=threadings)

     t.start()

     t.join()

###

 


Circuit Diagrams

Intruder-detection-with-raspberry-pi-using-camera_Circuit-Diagram

Project Video


Filed Under: Electronic Projects

 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Inconsistent Charge Termination Voltage with battery charger
  • 21V keeps getting shorted to my UART line.
  • Voltage mode pushpull is a nonsense SMPS?
  • Voltage mode push pull with extra DC blocking capacitor
  • NXP library issue in awr

RSS Electro-Tech-Online.com Discussions

  • Is AI making embedded software developers more productive?
  • Why can't I breadboard this oscillator?
  • using a RTC in SF basic
  • Parts required for a personal project
  • Cataract Lens Options?

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • GigaDevice launches GD32C231 MCU series with 48MHz Cortex-M23 core and 64KB Flash
  • Advanced Energy releases 425 W CF-rated medical power supply in 3.5 x 6 x 1.5-inch format”
  • LEM combines shunt and Hall effect sensing in 2000 A current measurement unit
  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe