Reader small image

You're reading from  BeagleBone Home Automation Blueprints

Product typeBook
Published inFeb 2016
Publisher
ISBN-139781783986026
Edition1st Edition
Right arrow
Author (1)
Rodolfo Giometti
Rodolfo Giometti
author image
Rodolfo Giometti

Rodolfo Giometti is an engineer, IT specialist, GNU/Linux expert and software libre evangelist. He is the author of the books BeagleBone Essentials, BeagleBone Home Automation Blueprints and GNU/Linux Rapid Embedded Programming by Packt Publishing and maintainer of the LinuxPPS projects. He still actively contributes to the Linux source code with several patches and new device drivers for industrial applications devices. During his 20+ years of experience, he has worked on the x86, ARM, MIPS, and PowerPC-based platforms. Now, he is the co-chief at HCE Engineering S.r.l., where he designs new hardware and software systems for the quick prototyping in industry environment, control automation, and remote monitoring.
Read more about Rodolfo Giometti

Right arrow

Chapter 8. Intrusion Detection System

Nowadays intrusion detection systems are quite common but really expensive. In this chapter, I'm going to show how we can implement a cheap intrusion detection system with a reasonable quality using our BeagleBone Black and two (or more) webcams.

The system will be able to alert the user by sending an e-mail with a photo of the intruder.

The basics of functioning


As mentioned earlier, we're going to use two webcams connected with our BeagleBone Black via a USB bus. Then, we'll install and run a special motion detection software that is able to detect a movement into a dynamic scene. When the program detects a movement, it will take one or more photos of the moving object and then send the pictures via e-mail to a user's account.

Setting up the hardware


This time, the connections are very simple since they are just done using several USB cables.

In the previous chapters, we have seen how to set up a webcam (see Chapter 3, Aquarium Monitor, for instance); but this time, we have a different configuration due to the fact that we're using two webcams at the same time.

As the reader might know, the BeagleBone Black board has only one USB host port, so to connect two webcams, we need a USB hub. These devices (used to connect more than one device to a USB host port) are very common, and the reader can find them anywhere on the Internet.

Tip

In theory, the more ports the hub has, the more webcams we can use in our system! But, of course, there is a maximum limit of usable webcams due to the fact that each webcam adds a CPU load to the system.

A little schematic of the system using a USB HUB with three ports is shown in the following diagram:

Setting up the webcams

For my prototype, I used two generic webcams supported by the Video4Linux...

Setting up the software


This time, we have to set up two programs: the mailer and the motion detection system. The former, used to send the alarm e-mail message, is very simple and easy to set up; while the latter, used to implement the intrusions detection system, is a bit more complicated due to the fact that it supports tons of different devices and features.

Setting up the mailer

As requested by this project, we should alert the user about possible intrusions by sending them an e-mail. There exists several ways to send an e-mail on a UNIX-like system, and the most commonly used is the mail command that is called with the following command:

echo "Test message" | mail -s "test mail" email_address@somedomain.com

Note

For further information about the mail program, the reader can take a look at its man pages (using the man mail command) or start reading about it at https://en.wikipedia.org/wiki/Mail_%28Unix%29.

The real problem is that this command relays on the system mailer, which is the real...

Final test


Now it's time to test our prototype. To do it, I decided to point the webcams toward my library shelf, where my precious stamp collection is kept. Then, I run the motion utility and just wait.

Note that this time, there is nothing special to do to configure the hardware.

After a while, I receive the following e-mail:

Then, looking at one picture, I discovered a very dangerous intruder.

Summary


In this chapter, there was very little hardware work to do, but on the other hand, we discovered how to use a really powerful tool named motion. This tool allows us to realize (quasi) professional, if minimal, anti-intrusion system. Also, you learned how to send simple e-mails with attached pictures to inform the user about an important event in the system.

In the next chapter, we'll discover how to use different identification devices (such as RFID readers and smart card readers) to implement an access control system.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
BeagleBone Home Automation Blueprints
Published in: Feb 2016Publisher: ISBN-13: 9781783986026
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Rodolfo Giometti

Rodolfo Giometti is an engineer, IT specialist, GNU/Linux expert and software libre evangelist. He is the author of the books BeagleBone Essentials, BeagleBone Home Automation Blueprints and GNU/Linux Rapid Embedded Programming by Packt Publishing and maintainer of the LinuxPPS projects. He still actively contributes to the Linux source code with several patches and new device drivers for industrial applications devices. During his 20+ years of experience, he has worked on the x86, ARM, MIPS, and PowerPC-based platforms. Now, he is the co-chief at HCE Engineering S.r.l., where he designs new hardware and software systems for the quick prototyping in industry environment, control automation, and remote monitoring.
Read more about Rodolfo Giometti