Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Building a Home Security System with Raspberry Pi

You're reading from  Building a Home Security System with Raspberry Pi

Product type Book
Published in Dec 2015
Publisher
ISBN-13 9781782175278
Pages 190 pages
Edition 1st Edition
Languages
Author (1):
Matthew Poole Matthew Poole
Profile icon Matthew Poole

Table of Contents (16) Chapters

Building a Home Security System with Raspberry Pi
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Setting Up Your Raspberry Pi Connecting Things to Your Pi with GPIO Extending Your Pi to Connect More Things Adding a Magnetic Contact Sensor Adding a Passive Infrared Motion Sensor Adding Cameras to Our Security System Building a Web-Based Control Panel A Miscellany of Things Putting It All Together Index

Building the control script


Now that we have designed our system the way we want it to work, we can start writing our Bash control script. As before, we'll locate our scripts in the folder, /etc/pi-alarm, which, you'll remember from Chapter 7, Building a Web-Based Control Panel, is also where our Web-based control panel writes its configuration status file, alarm.cfg to. We'll be referring to that file in our scripts too.

In this script, we are going to use the bc tool (the Bash command-line calculator) to convert hex values to binary. It's not installed by default, so you'll need to get the package:

$ sudo apt-get update
$ sudo apt-get install bc

Tip

Our script file is quite long so, as before, you might want to sit on the sofa and write it on your laptop using something such as Notepad++. Remember, however, if you're using a PC, ensure that the end-of-line (EOL) format is converted to the Unix format, otherwise the Bash script won't run on the Pi when you copy it across. Notepad++ will do...

lock icon The rest of the chapter is locked
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.
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 $15.99/month. Cancel anytime}