SlideShare a Scribd company logo
4
Most read
13
Burglar Detector
with Photo
Capture
This project will teach
you to use the Raspberry
Pi Camera Module v2, which,
along with the PIR motion
sensor, will detect and
photograph trespassers.
When the motion sensor
detects movement, it
triggers an event that
takes a photo so you know
who was in your house
while you were out.
www.itbook.store/books/9781593278434
Parts Required
Raspberr y Pi
Breadboard
Raspberr y Pi Camera Module v2
PIR motion sensor HC-SR501
Pushbutton
Jumper wires
Cost: $$	Time: 45 minutes
www.itbook.store/books/9781593278434
1 64 • proj ect 1 3
Introducing the Raspberry Pi
Camera Module v2
The Raspberry Pi Camera Module v2, shown in Figure 13-1, features
an 8 MP Sony IMX219 image sensor with a fixed-focus lens. It’s
capable of 3280×2464 pixel static images and supports video with
resolutions of 1080p at 30 frames, 720p at 60 frames, and 640×480
at 90 frames—all of which means it’s a pretty good camera for its size!
You’ll just use the static image capabilities in this project.
This camera is compatible with all Raspberry Pi models—1, 2, 3,
and zero—and comes with a 15 cm ribbon cable that makes it easy
to connect to the CSI port on the Raspberry Pi, designed to interface
with cameras. If you want your camera to reach farther than 15 cm
from your Pi, you should be able to find and purchase longer cables.
The Raspberry Pi Camera Module v2 is one of the most popular
Raspberry Pi add-ons because it gives users an affordable way to
take still photographs and record video in full HD. One interesting
example of a Camera Module v2 project comes from the Naturebytes
community, which provides kits to remotely capture wildlife photos.
Figure 13-2 shows the wildlife camera in action.
Figure 13-1:
Raspberry Pi Camera
Module v2
Figure 13-2:
Raspberry Pi camera
with PIR motion sensor
pointed at a bird feeder
www.itbook.store/books/9781593278434
1 65 • proj ect 1 3
The Naturebytes kit is also equipped with a PIR motion sensor,
so if a bird perches on the feeder in Figure 13-2, it will trigger the
camera to take a photo of the bird. You’ll use the same principles for
this project’s burglar detector.
Building the Burglar Detector
The burglar detector consists of a PIR motion sensor, a pushbutton,
and a camera module you’ll connect to your Pi. You’ll use the built-in
picamera library, which makes it simple to control the camera.
Enabling the Camera
You need to enable your Pi’s camera software before you can use the
camera module. In the desktop environment, go to the main menu
and select Preferences4Raspberry Pi Configuration. You should
see a window like the one in Figure 13-3.
Select Enabled on the Camera row, then click OK, and you’re
ready to go.
Connecting the Camera
With the camera software enabled, shut down your Pi and then con-
nect the camera to the CSI port. Make sure the camera is connected
with the blue letters facing up and oriented as shown in Figure 13-4.
Then start up your Pi again.
Figure 13-3:
Enabling the camera
software
www.itbook.store/books/9781593278434
1 66 • proj ect 1 3
Wiring the Circuit
With the camera connected, follow these instructions to wire the rest
of the circuit, using Figure 13-5 as a reference.
1.	 Connect a GND pin to the breadboard GND rails.
2.	 Insert a pushbutton into the breadboard so that it straddles the
center divide. Connect one lead to GND and the other lead on
the same side of the button to GPIO 2.
3.	 Wire the PIR motion sensor with the connections shown in the
following table.
PIR motion sensor R aspberry Pi
GND GND
OUT GPIO 4
VCC 5 V
Figure 13-4:
Connecting the
Raspberry Pi camera to
the CSI port
Note
Be careful when moving
the camera. The ribbon
is very fragile, and if it
touches the GPIOs, they
may permanently damage
your camera. Try using
some modeling clay or
sticky tack to secure the
camera.
www.itbook.store/books/9781593278434
1 67 • proj ect 1 3
Writing the Script
To control the camera, you’ll use the built-in picamera library. It’s
a very straightforward library, so this script will be a piece of cake.
Here’s an overview of what the code should do:
1.	 Initialize the camera.
2.	 Take a photo when the PIR motion sensor detects movement.
3.	 Save the photos in your Desktop folder.
4.	 Name the photos incrementally so you know what order they were
taken in—for example, image_1.jpg, image_2.jpg, and so on.
5.	 Stop the camera when the pushbutton is pressed. If you don’t
include this feature, you won’t be able to exit the camera preview
that pops up on your screen.
Entering the Script
Go to your Projects folder and create a new folder called Cameras.
Then open Python 3 (IDLE) and go to File4New to create a new
script called burglar_detector.py, and copy the following code into
it (remember that you can download all the scripts at https://www.
nostarch.com/RaspberryPiProject/ ).
Figure 13-5:
The burglar detector circuit
Note
You can’t name any of your
files picamera.py because
picamera is a Python
library name and
cannot be used.
www.itbook.store/books/9781593278434
1 68 • proj ect 1 3
#import the necessary libraries
 from gpiozero import Button, MotionSensor
from picamera import PiCamera
from time import sleep
from signal import pause
#create objects that refer to a button,
#a motion, sensor, and the PiCamera
 button = Button(2)
pir = MotionSensor(4)
camera = PiCamera()
#start the camera
camera.rotation = 180
 camera.start_preview()
#create image names
 i = 0
#stop the camera when the pushbutton is pressed
 def stop_camera():
camera.stop_preview()
#exit the program
exit()
#take a photo when motion is detected
 def take_photo():
global i
i = i + 1
camera.capture('/home/pi/Desktop/image_%s.jpg' % i)
print('A photo has been taken')
 sleep(10)
#assign a function that runs when the button is pressed
 button.when_pressed = stop_camera
#assign a function that runs when motion is detected
 pir.when_motion = take_photo
pause()
First you import the libraries you need ; as we’ve said, the pro-
gram uses the picamera library to control the camera. You should be
familiar with all the other modules used here from previous projects.
Then you create objects to refer to the pushbutton, the PIR motion
sensor, and the camera , and initialize the camera with camera​
.start_preview() . Depending on how your camera is oriented,
you might also need to rotate it 180 degrees with camera.rotation =
180 so that it doesn’t take the photos upside down. If your image is
www.itbook.store/books/9781593278434
1 69 • proj ect 1 3
upside down when you test this code, go back and set the rotation
to 0 or comment out this line.
Next, you initialize an i variable that starts at 0 . The take_
photo() function, defined at , will use this variable to count and
number the images, incrementing the number in the filename by one
with each picture taken.
You then define the stop_camera() function that stops the cam-
era with the camera.stop_preview() method . At , you define the
take_photo() function we just mentioned, which takes a photo. For
this, you use the camera.capture() method, specifying the direc-
tory you want to save the image to inside the parentheses. In this
case, we’re saving the images in the Desktop folder and naming
the images image_%s.jpg, where %s is replaced with the number we
incremented earlier in i. If you want to save your files to a different
folder, replace this directory with the path to your chosen folder.
You then impose a 10-second delay , meaning the camera
takes photos at 10-second intervals for as long as the PIR sensor
detects movement. Feel free to increase or decrease the delay time,
but be careful to not overload the Pi with tons of images by making
the delay time too small.
At , you define the behavior to trigger the stop_camera() func-
tion when you press the pushbutton. This function stops the camera
preview and exits the program. The exit() function pops up a window
asking if you want to close the program; to close it, just click OK.
Finally, you tell the camera to take a photo by triggering the take_
photo() function when motion is detected .
Running the Script
Press F5 or go to Run4Run Module to run the script. While the
script is running, you should see a preview of what the camera sees
on your screen. To shut down the camera preview, press the push-
button and click OK in the window that pops up.
Congratulations! Your burglar detector is ready to catch some
burglars. Place the burglar detector in a strategic place and come
back later to check any saved photos. Figure 13-6 shows a photo
taken by our burglar detector, catching someone stealing a computer
from our lab.
www.itbook.store/books/9781593278434
170 • proj ect 1 3
Taking It Further
As you’ve seen, projects with cameras are fun! Here’s an idea on
how to improve your security system: redesign your project so that,
when the sensor detects motion, the Raspberry Pi takes a photo,
sends you an email notification, and sounds an alarm. You should
already know how to do all of this using the skills you’ve learned from
Projects 9–12.
Figure 13-6:
Picture taken with the
burglar detector
www.itbook.store/books/9781593278434

More Related Content

PDF
Security System with PIR sensor and Raspberry Pi
Raúl Peláez Berroteran
 
PDF
IRJET - IoT based Anti Theft Detection and Alerting System using Raspberry Pi
IRJET Journal
 
PPTX
New Microsoft PowerPoint Presentation (2).pptx
MannuMatamAkash
 
PDF
05-Pi-Camera.pdf
bhaveshagrawal35
 
PPTX
05-Pi-Camera.pptx
bhaveshagrawal35
 
PDF
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
WiseNaeem
 
PDF
IMAGE PROCESSING BASED INTRUDER DETECTION USING RASPBERRY PI
IJTRET-International Journal of Trendy Research in Engineering and Technology
 
PDF
S.W.A.T – Motion Based Intrusion Detection System
IRJET Journal
 
Security System with PIR sensor and Raspberry Pi
Raúl Peláez Berroteran
 
IRJET - IoT based Anti Theft Detection and Alerting System using Raspberry Pi
IRJET Journal
 
New Microsoft PowerPoint Presentation (2).pptx
MannuMatamAkash
 
05-Pi-Camera.pdf
bhaveshagrawal35
 
05-Pi-Camera.pptx
bhaveshagrawal35
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
WiseNaeem
 
IMAGE PROCESSING BASED INTRUDER DETECTION USING RASPBERRY PI
IJTRET-International Journal of Trendy Research in Engineering and Technology
 
S.W.A.T – Motion Based Intrusion Detection System
IRJET Journal
 

Similar to 20 easy Raspberry Pi projects (20)

PDF
IRJET- Smart Door Security System using Raspberry Pi with Telegram
IRJET Journal
 
PDF
IRJET - IoT based Surveillance Robot
IRJET Journal
 
PPTX
Motion Detector and Upload Picuter to Gmail.pptx
SovannDoeur
 
PDF
Secured Spy for Highly Secured Areas
IRJET Journal
 
PPTX
AI Base Thundercam using Raspberry Pi and IoT
MuhammadWaleedKhan22
 
PDF
Advanced view of projects raspberry pi list raspberry pi projects
WiseNaeem
 
PPTX
910383538.pptxnnnnnnnnnnnnnnnnnnnnnnnnnnnn
divijareddy0502
 
PDF
Hands on Raspberry Pi - Creative Technologists
bennuttall
 
PPTX
Raspberry pi ppt
gummaavinash7
 
PDF
Colour tracking robot.pdf
AbdessatarMazouzi
 
PDF
IRJET- Surveillance Robot based on Raspberry Pi-3
IRJET Journal
 
PDF
The mag pi-issue-28-en
Nguyen Nam
 
PDF
Projects list raspberry pi projects complete 1480 projects
WiseNaeem
 
PDF
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Ismailkhan77481
 
PDF
Picademy 5 Picamera Intro Workshop
bennuttall
 
PDF
Web-Based Online Embedded Security System And Alertness Via Social Media
IRJET Journal
 
PDF
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
WiseNaeem
 
PPTX
Motion Detector (Fourth Copy).pptx
MOHAMMEDHabeeb54
 
PDF
Raspberry PI based obstacle avoiding robot
IRJET Journal
 
PDF
IOT BASED ROBOTIC CAR USING RASPBERRY
IRJET Journal
 
IRJET- Smart Door Security System using Raspberry Pi with Telegram
IRJET Journal
 
IRJET - IoT based Surveillance Robot
IRJET Journal
 
Motion Detector and Upload Picuter to Gmail.pptx
SovannDoeur
 
Secured Spy for Highly Secured Areas
IRJET Journal
 
AI Base Thundercam using Raspberry Pi and IoT
MuhammadWaleedKhan22
 
Advanced view of projects raspberry pi list raspberry pi projects
WiseNaeem
 
910383538.pptxnnnnnnnnnnnnnnnnnnnnnnnnnnnn
divijareddy0502
 
Hands on Raspberry Pi - Creative Technologists
bennuttall
 
Raspberry pi ppt
gummaavinash7
 
Colour tracking robot.pdf
AbdessatarMazouzi
 
IRJET- Surveillance Robot based on Raspberry Pi-3
IRJET Journal
 
The mag pi-issue-28-en
Nguyen Nam
 
Projects list raspberry pi projects complete 1480 projects
WiseNaeem
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Ismailkhan77481
 
Picademy 5 Picamera Intro Workshop
bennuttall
 
Web-Based Online Embedded Security System And Alertness Via Social Media
IRJET Journal
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
WiseNaeem
 
Motion Detector (Fourth Copy).pptx
MOHAMMEDHabeeb54
 
Raspberry PI based obstacle avoiding robot
IRJET Journal
 
IOT BASED ROBOTIC CAR USING RASPBERRY
IRJET Journal
 
Ad

Recently uploaded (20)

PPTX
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
PPTX
A Smarter Way to Think About Choosing a College
Cyndy McDonald
 
PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
PDF
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
DOCX
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PPTX
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
PDF
RA 12028_ARAL_Orientation_Day-2-Sessions_v2.pdf
Seven De Los Reyes
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
PPTX
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
PPTX
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
A Smarter Way to Think About Choosing a College
Cyndy McDonald
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
RA 12028_ARAL_Orientation_Day-2-Sessions_v2.pdf
Seven De Los Reyes
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
Ad

20 easy Raspberry Pi projects

  • 1. 13 Burglar Detector with Photo Capture This project will teach you to use the Raspberry Pi Camera Module v2, which, along with the PIR motion sensor, will detect and photograph trespassers. When the motion sensor detects movement, it triggers an event that takes a photo so you know who was in your house while you were out. www.itbook.store/books/9781593278434
  • 2. Parts Required Raspberr y Pi Breadboard Raspberr y Pi Camera Module v2 PIR motion sensor HC-SR501 Pushbutton Jumper wires Cost: $$ Time: 45 minutes www.itbook.store/books/9781593278434
  • 3. 1 64 • proj ect 1 3 Introducing the Raspberry Pi Camera Module v2 The Raspberry Pi Camera Module v2, shown in Figure 13-1, features an 8 MP Sony IMX219 image sensor with a fixed-focus lens. It’s capable of 3280×2464 pixel static images and supports video with resolutions of 1080p at 30 frames, 720p at 60 frames, and 640×480 at 90 frames—all of which means it’s a pretty good camera for its size! You’ll just use the static image capabilities in this project. This camera is compatible with all Raspberry Pi models—1, 2, 3, and zero—and comes with a 15 cm ribbon cable that makes it easy to connect to the CSI port on the Raspberry Pi, designed to interface with cameras. If you want your camera to reach farther than 15 cm from your Pi, you should be able to find and purchase longer cables. The Raspberry Pi Camera Module v2 is one of the most popular Raspberry Pi add-ons because it gives users an affordable way to take still photographs and record video in full HD. One interesting example of a Camera Module v2 project comes from the Naturebytes community, which provides kits to remotely capture wildlife photos. Figure 13-2 shows the wildlife camera in action. Figure 13-1: Raspberry Pi Camera Module v2 Figure 13-2: Raspberry Pi camera with PIR motion sensor pointed at a bird feeder www.itbook.store/books/9781593278434
  • 4. 1 65 • proj ect 1 3 The Naturebytes kit is also equipped with a PIR motion sensor, so if a bird perches on the feeder in Figure 13-2, it will trigger the camera to take a photo of the bird. You’ll use the same principles for this project’s burglar detector. Building the Burglar Detector The burglar detector consists of a PIR motion sensor, a pushbutton, and a camera module you’ll connect to your Pi. You’ll use the built-in picamera library, which makes it simple to control the camera. Enabling the Camera You need to enable your Pi’s camera software before you can use the camera module. In the desktop environment, go to the main menu and select Preferences4Raspberry Pi Configuration. You should see a window like the one in Figure 13-3. Select Enabled on the Camera row, then click OK, and you’re ready to go. Connecting the Camera With the camera software enabled, shut down your Pi and then con- nect the camera to the CSI port. Make sure the camera is connected with the blue letters facing up and oriented as shown in Figure 13-4. Then start up your Pi again. Figure 13-3: Enabling the camera software www.itbook.store/books/9781593278434
  • 5. 1 66 • proj ect 1 3 Wiring the Circuit With the camera connected, follow these instructions to wire the rest of the circuit, using Figure 13-5 as a reference. 1. Connect a GND pin to the breadboard GND rails. 2. Insert a pushbutton into the breadboard so that it straddles the center divide. Connect one lead to GND and the other lead on the same side of the button to GPIO 2. 3. Wire the PIR motion sensor with the connections shown in the following table. PIR motion sensor R aspberry Pi GND GND OUT GPIO 4 VCC 5 V Figure 13-4: Connecting the Raspberry Pi camera to the CSI port Note Be careful when moving the camera. The ribbon is very fragile, and if it touches the GPIOs, they may permanently damage your camera. Try using some modeling clay or sticky tack to secure the camera. www.itbook.store/books/9781593278434
  • 6. 1 67 • proj ect 1 3 Writing the Script To control the camera, you’ll use the built-in picamera library. It’s a very straightforward library, so this script will be a piece of cake. Here’s an overview of what the code should do: 1. Initialize the camera. 2. Take a photo when the PIR motion sensor detects movement. 3. Save the photos in your Desktop folder. 4. Name the photos incrementally so you know what order they were taken in—for example, image_1.jpg, image_2.jpg, and so on. 5. Stop the camera when the pushbutton is pressed. If you don’t include this feature, you won’t be able to exit the camera preview that pops up on your screen. Entering the Script Go to your Projects folder and create a new folder called Cameras. Then open Python 3 (IDLE) and go to File4New to create a new script called burglar_detector.py, and copy the following code into it (remember that you can download all the scripts at https://www. nostarch.com/RaspberryPiProject/ ). Figure 13-5: The burglar detector circuit Note You can’t name any of your files picamera.py because picamera is a Python library name and cannot be used. www.itbook.store/books/9781593278434
  • 7. 1 68 • proj ect 1 3 #import the necessary libraries  from gpiozero import Button, MotionSensor from picamera import PiCamera from time import sleep from signal import pause #create objects that refer to a button, #a motion, sensor, and the PiCamera  button = Button(2) pir = MotionSensor(4) camera = PiCamera() #start the camera camera.rotation = 180  camera.start_preview() #create image names  i = 0 #stop the camera when the pushbutton is pressed  def stop_camera(): camera.stop_preview() #exit the program exit() #take a photo when motion is detected  def take_photo(): global i i = i + 1 camera.capture('/home/pi/Desktop/image_%s.jpg' % i) print('A photo has been taken')  sleep(10) #assign a function that runs when the button is pressed  button.when_pressed = stop_camera #assign a function that runs when motion is detected  pir.when_motion = take_photo pause() First you import the libraries you need ; as we’ve said, the pro- gram uses the picamera library to control the camera. You should be familiar with all the other modules used here from previous projects. Then you create objects to refer to the pushbutton, the PIR motion sensor, and the camera , and initialize the camera with camera​ .start_preview() . Depending on how your camera is oriented, you might also need to rotate it 180 degrees with camera.rotation = 180 so that it doesn’t take the photos upside down. If your image is www.itbook.store/books/9781593278434
  • 8. 1 69 • proj ect 1 3 upside down when you test this code, go back and set the rotation to 0 or comment out this line. Next, you initialize an i variable that starts at 0 . The take_ photo() function, defined at , will use this variable to count and number the images, incrementing the number in the filename by one with each picture taken. You then define the stop_camera() function that stops the cam- era with the camera.stop_preview() method . At , you define the take_photo() function we just mentioned, which takes a photo. For this, you use the camera.capture() method, specifying the direc- tory you want to save the image to inside the parentheses. In this case, we’re saving the images in the Desktop folder and naming the images image_%s.jpg, where %s is replaced with the number we incremented earlier in i. If you want to save your files to a different folder, replace this directory with the path to your chosen folder. You then impose a 10-second delay , meaning the camera takes photos at 10-second intervals for as long as the PIR sensor detects movement. Feel free to increase or decrease the delay time, but be careful to not overload the Pi with tons of images by making the delay time too small. At , you define the behavior to trigger the stop_camera() func- tion when you press the pushbutton. This function stops the camera preview and exits the program. The exit() function pops up a window asking if you want to close the program; to close it, just click OK. Finally, you tell the camera to take a photo by triggering the take_ photo() function when motion is detected . Running the Script Press F5 or go to Run4Run Module to run the script. While the script is running, you should see a preview of what the camera sees on your screen. To shut down the camera preview, press the push- button and click OK in the window that pops up. Congratulations! Your burglar detector is ready to catch some burglars. Place the burglar detector in a strategic place and come back later to check any saved photos. Figure 13-6 shows a photo taken by our burglar detector, catching someone stealing a computer from our lab. www.itbook.store/books/9781593278434
  • 9. 170 • proj ect 1 3 Taking It Further As you’ve seen, projects with cameras are fun! Here’s an idea on how to improve your security system: redesign your project so that, when the sensor detects motion, the Raspberry Pi takes a photo, sends you an email notification, and sounds an alarm. You should already know how to do all of this using the skills you’ve learned from Projects 9–12. Figure 13-6: Picture taken with the burglar detector www.itbook.store/books/9781593278434