Book Image

Building Smart Homes with Raspberry Pi Zero

By : Marco Schwartz
Book Image

Building Smart Homes with Raspberry Pi Zero

By: Marco Schwartz

Overview of this book

The release of the Raspberry Pi Zero has completely amazed the tech community. With the price, form factor, and being high on utility—the Raspberry Pi Zero is the perfect companion to support home automation projects and makes IoT even more accessible. With this book, you will be able to create and program home automation projects using the Raspberry Pi Zero board. The book will teach you how to build a thermostat that will automatically regulate the temperature in your home. Another important topic in home automation is controlling electrical appliances, and you will learn how to control LED Lights, lamps, and other electrical applications. Moving on, we will build a smart energy meter that can measure the power of the appliance, and you’ll learn how to switch it on and off. You’ll also see how to build simple security system, composed of alarms, a security camera, and motion detectors. At the end, you will integrate everything what you learned so far into a more complex project to automate the key aspects of your home. By the end, you will have deepened your knowledge of the Raspberry Pi Zero, and will know how to build autonomous home automation projects.
Table of Contents (17 chapters)
Building Smart Homes with Raspberry Pi Zero
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Preface

The Raspberry Pi is an amazing development platform that was introduced back in 2012, along with the release of the first board. However, due to its price, it was not convenient for people to use it for smart home applications, where you need to deploy several modules at different places of your home. Usually, people building smart homes with this board used it as a central hub.

However, in 2016 the Raspberry Pi foundation released the Zero board, which is a smaller and much cheaper version of the Raspberry Pi board, and this changed everything for the home automation field. Now, you can actually use several of these boards in a home automation system and enjoy all the power and flexibility of the Raspberry Pi for all your projects.

This is exactly what I will teach you to do in this book. You will learn how to use the Raspberry Pi Zero board in several home automation projects, in order for you to build a smart home that is really tailored to your needs.

What this book covers

Chapter 1, Configuring Your Raspberry Pi Zero Board, teaches you how to get started with your Raspberry Pi Zero board and also install everything that you need to carry out all the projects that you will find in this book.

Chapter 2, Measure Data Using Your Raspberry Pi Zero Board, teaches you how to measure data from a sensor using the Raspberry Pi Zero board. You will also learn how to measure data from the sensor, store this data on the Pi, and plot it graphically.

Chapter 3, Building a Smart Home Thermostat, gets you right into the core topic of this book, that is, building your first home automation system. In this chapter, we will build a simple thermostat that will allow you to regulate the temperature in your home.

Chapter 4, Control Appliances from the Raspberry Pi Zero, shows you how to use the Raspberry Pi Zero board to easily control home appliances. As an example, we'll see how to control a DC motor and switch on/off appliances, such as lamps.

Chapter 5, Making a Smart Plug with the Raspberry Pi Zero, teaches you how to build your own version of a smart wireless plug that you can buy in a shop. We'll see how to build the same using the Raspberry Pi Zero board and how to customize it for your own needs.

Chapter 6, Sending Notifications using Raspberry Pi Zero, shows you how to send automated notifications from your Pi, for example to indicate that the temperature in your home is getting low. As examples, we'll see how to send text, email, and push notifications.

Chapter 7, Use the Raspberry Pi Zero to Build a Security System, shows you how to start integrating everything we saw so far in the book and build a security system using what we have learned so far. You'll, for example, learn how to transform your Raspberry Pi Zero board into a wireless security camera.

Chapter 8, Monitor Your Home from the Cloud, guides you through an amazing field: the Internet of Things. You will learn how to use the Internet of Things for your smart home and monitor it from anywhere in the world.

Chapter 9, Control Appliances from Anywhere, guides you into the field of the Internet of Things, this time by teaching you how to control home appliances from outside of your Wi-Fi network.

Chapter 10, Building a Home Automation System with Raspberry Pi Zero Boards, uses everything you learned in the book to build a complete home automation system for your entire home.

What you need for this book

For this book, the main component you will need is, of course, a Raspberry Pi Zero board. In the first chapter of the book, I will show you how to completely configure the board, so you can use it for the projects of this book. We will use some basic components at the start, such as sensors, and then move on to using more complex components. For every project, I will of course guide you step-by-step into building the hardware part so that you are not left behind.

On the software side, it is good if you actually have some existing programming skills, especially in JavaScript and in the Node.js framework. However, I will explain all the parts of each software piece of this book; so even if you don't have good programming skills in JavaScript you will be able to follow along.

Who this book is for

This book is for all the people who want to automate their homes and make it smarter, while at the same time having complete control on what they are doing. If that's your case, you will learn everything there is to learn in this book, on how to use the amazing Raspberry Pi Zero board to automate your home.

This book is also for makers who have played in the past with other development boards, such as Arduino. If that's your case, you will learn how to use the power of the Raspberry Pi platform to build smart homes. You will also learn to create projects that can't easily be done with other platforms, such as creating a wireless security camera with the Pi Zero.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "You can now simply navigate to the IP address of the computer or Pi on which the application is running, followed by port 3000."

A block of code is set as follows:

var request = require('request');
var sensorLib = require('node-dht-sensor');

Any command-line input or output is written as follows:

sudo npm install express request

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "You can now just click on Stream to access the live stream from the camera."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.

  2. Hover the mouse pointer on the SUPPORT tab at the top.

  3. Click on Code Downloads & Errata.

  4. Enter the name of the book in the Search box.

  5. Select the book for which you're looking to download the code files.

  6. Choose from the drop-down menu where you purchased this book from.

  7. Click on Code Download.

You can also download the code files by clicking on the Code Files button on the book's webpage at the Packt Publishing website. This page can be accessed by entering the book's name in the Search box. Please note that you need to be logged in to your Packt account.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows

  • Zipeg / iZip / UnRarX for Mac

  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Building-Smart-Homes-with-Raspberry-Pi-Zero We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

lease contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.