Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Raspberry Pi 3 Home Automation Projects
Raspberry Pi 3 Home Automation Projects

Raspberry Pi 3 Home Automation Projects: Bringing your home to life using Raspberry Pi 3, Arduino, and ESP8266

Arrow left icon
Profile Icon Bhadoria Profile Icon Ruben Oliva Ramos
Arrow right icon
€29.99
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2 (1 Ratings)
Paperback Nov 2017 226 pages 1st Edition
eBook
€8.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Bhadoria Profile Icon Ruben Oliva Ramos
Arrow right icon
€29.99
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2 (1 Ratings)
Paperback Nov 2017 226 pages 1st Edition
eBook
€8.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€8.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Raspberry Pi 3 Home Automation Projects

Creating a Raspberry Pi-Powered Magic Mirror

We’ll be operating with the understanding that this may be the first Raspberry Pi project that you have attempted to undertake. The Magic Mirror is a practical and easy way to introduce yourself to working the Raspberry Pi and will also serve a great conversation piece for your home. To briefly cover the contents of this chapter, you will learn about the Raspberry Pi single-board computer and how to navigate the command line using basic Linux commands. We will focus on downloading the latest version of the Magic Mirror project by Michael Teeuw from GitHub (https://github.com/MichMich/MagicMirror) and setting up the open source modular platform to work with the Pi 3. Once downloaded, we will take a look at editing the content for the Magic Mirror and how one might go about integrating third-party modules to create a custom Magic Mirror experience. As a final step, a discussion will surround the construction of the mirror’s frame and what might be best for your personal home experience.

By the end of this chapter, you’ll know how to:

  • Work with the Raspberry Pi
  • Operate within LXTerminal
  • Navigate the Magic Mirror repository
  • Do basic file editing with GNU Nano
  • Use the Raspberry Pi GPIO to attach sensors

What is the Raspberry Pi?

The Raspberry Pi is a credit-card-sized single-board computer that was developed by the Raspberry Pi Foundation in 2012. The foundation's main goal is to promote computer literacy across the globe by offering an affordable and mutable bit of hardware to the masses. It's become a huge hit among the maker communities and is paving its way through education as a cheap, practical, and convenient way to teach digital and physical making. As we move through the text, I will be centering my conversation on the base model and necessities of a Raspberry Pi 3, as this is the most current version of the Raspberry Pi on the market. If you're using a Raspberry Pi 2 or B+, I’ll make sure to point out the differences in hardware usage as we move along.

While taking a closer look, the Raspberry Pi 3 boasts of some impressive specs for its size:

  • A 1.2 GHz 64-bit quad-core ARMv8 CPU
  • 802.11n Wireless LAN
  • Bluetooth 4.1
  • Bluetooth Low Energy (BLE)
  • 1 GB RAM
  • Four USB ports
  • 40 GPIO pins
  • Full HDMI port
  • Ethernet port
  • Combined 3.5mm audio jack and composite video
  • Camera Interface (CSI)
  • Display Interface (DSI)
  • Micro SD card slot
  • VideoCore IV 3D graphics core

Furthermore, the Raspberry Pi 3 has the same form factor as the earlier models, the Raspberry Pi 2 and the B+, allowing you to reuse the casing and accessories.

Raspberry Pi Model 3:

You will need the following materials for this project:

  • Project materials:
    • Raspberry Pi 2/3
    • Micro USB charging cable
    • Wi-Fi dongle (if you are using Pi 2)
    • A microSD card
    • Monitor (HDMI/VGA)
    • Two-way glass/acrylic
    • Wooden frame
  • Optional materials:
    • PIR motion sensor
    • Pi Camera Module
    • Ultrasonic sensor—HC-SR04
    • HDMI-to-VGA converter

Purchasing the Raspberry Pi

When purchasing a Raspberry Pi, it may look a bit intimidating at first, given the sheer amount of add-ons or the variety of kits from which you can choose. At a minimum, for this project and the others in this book, you’ll need a kit that contains a Raspberry Pi 3, a micro-USB charging cable, an 8 gigabyte (or larger) microSD card preinstalled with NOOBS, and an HDMI cable. For the novice user, it’s generally recommended that you also acquire an HDMI monitor and a USB-connected keyboard and mouse to easily display and interact with the Raspberry Pi interface:

The Raspberry Pi revision 2 and B+ models differ from the Raspberry Pi revision 3, as neither revision 2 or B+ have Bluetooth or Wi-Fi built into the board itself. So, if you’re working with either of these models, be aware that you will have to purchase a Wi-Fi dongle (highly recommended) or a Bluetooth dongle in order to have these connectivity options available to you.

Setting up the Raspberry Pi

Assuming that you’ve gotten the required materials, it’s now time to get the Raspberry Pi up and running. Before powering it on, you're going to make sure that you connect the Pi to a monitor, connect the keyboard and mouse, and make sure that the microSD card is inserted. If you have any dongles to plug into the extra USB ports, now would be the time to do that.

In discussing the microSD card, with most kits bought online for the Raspberry Pi, the microSD card will come preloaded with NOOBS (known as New Out Of the Box Software), which lets you easily set up Raspbian, the Foundation’s officially supported operating system. Raspbian is a Linux distribution based on the Debian distribution. You can, however, purchase a microSD card that does not have the NOOBS installation preloaded on it. If this is the case, using your home computer or laptop, you can manually install NOOBS or the image of your choosing onto the SD card. Here are the steps for the manual installation, as aligned to the Raspberry Pi Foundation’s suggestions:

  1. Visit the SD Association’s website (https://www.sdcard.org/) and download SD Formatter 5.0 for either Windows or Mac systems.
  2. Follow the instructions to install the software.
  3. Insert your SD card into the computer or laptop’s SD card reader and make note of the drive letter allocated to it, for example, F or G.
  4. In SD Formatter, select the drive letter for your SD card and format it.
  5. Download the NOOBS ZIP file from the Raspberry Pi Foundation Downloads page (https://www.raspberrypi.org/downloads/noobs/).
  6. Save this to a folder on your computer and then extract the files.
  7. Once your SD card has been formatted and the files from the ZIP are extracted, you are going to drag the unzipped files onto the SD card. As a note, make sure you’re dragging the contents of the NOOBS folder onto the SD card. If you move the entire NOOBS folder itself, the installation process will not follow through.
  8. When the files have finished transferring, eject the SD card and place it into your Raspberry Pi.

Assuming the microSD card has made it to your Raspberry Pi and all of the requisite hardware is connected, it is now time to power on the board by plugging in the micro USB charging cable.

This will take a little time as you go through the setup screen, but you’ll be looking at the Raspbian desktop shortly:

Moving on to the LXTerminal

While the Raspberry Pi has a healthy variety of applications and programs for our consumption, we’re going to be primarily using the LXTerminal to download and interact with the Magic Mirror program. For those of you unfamiliar with the Terminal, it’s essentially a program that allows a user to directly manipulate their computer system through the use of commands. As we move through the text, when I refer to the command line, I’m talking about the Terminal and the location where a user will input the commands.

Understanding how the Terminal works and being able to use the command line is a very powerful tool when working to manipulate files on the Raspberry Pi. Commands can be strung together and input in order to efficiently carry out tasks that other applications cannot. When you initially open LXTerminal, you will see a screen with a blinking cursor. On the left-hand side, there will be a prompt that shows your current username and the hostname of the Pi. Both the username and hostname can be changed later on in settings if you’d like to tailor the Pi further for your uses:

Basic Linux commands

There are basic Linux commands that are going to be very useful in your navigation through your filesystems through the Terminal. In this section, I want to list some essential commands that will help you when building the Magic Mirror. With each command, I’ll provide a brief explanation. As with anything, the best way to learn how to successfully use these commands is with practice. Also, note that syntax is important when working with the command line. The computer interprets capitalized and uncapitalized letters as two different symbols, so we have to make sure we type our commands as they are shown. A good rule of thumb is that if something doesn’t work the first time, go back and proofread what you have typed.

Helpful commands

Here are some helpful Linux or NOOBS commands that will come in handy when you work on your Raspberry Pi:

  • sudo: Short for super user do, this command is powerful and necessary. When used before any others in the command line, you're telling the computer that you are running the command as the root user. This gives you the ability to alter files that may be unalterable to the regular user on the computer. When first working with the Terminal, I suggest you use sudo primarily, as opposed to su (though su is needed for particular actions). This will curtail your use of the super user command, putting a slight speed bump between you and any commands that may unintentionally delete necessary files from your system.
  • su: While similar to sudo, instead of running a command as root, su makes you root. As I said earlier, sudo is useful for targeted commands, but if you’re working extensively as root, su may be the better option. Just make sure you stay aware that you're working as a root user, as you do not want to delete anything necessary in your Raspberry Pi system files.
  • cd: This changes your location to a directory of your choosing. Remember, a directory is essentially a folder, and this allows you to navigate to a specific folder as long as you know the pathway. Furthermore, if you are in a specific directory and want to return to your /home directory, typing in cd will bring you immediately back to /home.
  • cd –: To build on the cd command, a useful command is to add the dash after the space after cd. This will allow you to immediately return to the previous directory in your pathway, for example, cd /MagicMirror/modules/. This will bring you to the modules folder within the MagicMirror folder. If you want to go back to the MagicMirror folder, you would then type cd –.

  • ls: When you're in a directory and wish to know the folder's contents, typing in this command will list the files within the folder.

  • pwd: This stands for print working directory. It is very useful if you’ve forgotten your current pathway or need to access that information.

  • mkdir: This command enables you to create a directory with a name of your choosing.

  • cp: This is the copy function. It allows you to copy a file from its source destination to another destination of your choosing.

  • nano: This command calls upon the Terminal’s nano text editor, enabling you to access and modify the contents of the file from within the Terminal emulator. This is very useful for quick changes to files on the Pi, and I will be using this as the command-line editor for this text.

Let's move forward. I find these to be the most useful commands for this project; however, there is a vast array of commands that will make your navigation more efficient. As you learn more with the Pi, it’s encouraged that you research more commands and how they work in order to maximize your experience in LXTerminal.

The Magic Mirror

The project was first put together by Michael Teeuw in 2014 and has since garnered much popularity in the maker community, inspiring smart mirror projects created by the average laymen. The project is open source and community-driven, enabling all users to download, edit, and create using this framework. On the most basic level, the Magic Mirror program is run on the Raspberry Pi, typically connected to a monitor specifically designated for this project.

The user then programs the Magic Mirror interface to his or her liking, adding functions such as e-mail notifications, NFL scores, weather alerts, reminders, and additional text. Once the Magic Mirror is set up to your liking, it’s common to see people install a wooden frame and a two-way mirror around the monitor, effectively creating a do-it-yourself smart mirror.

Downloading the Magic Mirror repository

Now that we’ve established how to set up our Raspberry Pi and familiarized ourselves with the Terminal, it’s time to download the Magic Mirror repository. In order to do this, you’ll have to clone the repository that is hosted on the popular website GitHub. GitHub is an online version control repository, basically, a place where the changes to computer files and code can be tracked and all workers on a particular project can come together to add the appropriate documentation. In line with the open source nature of this project, it’s very helpful for your future endeavors with this project. If you find that you have further questions, bug issues, or code to contribute, checking out their GitHub repository is the next and later step.

Now in terms of cloning the repository, using this phrasing is deliberate. To clone a repository means to not only download the current working copy of a project, but to also download every version of the project available. This is extremely useful for individuals who face problems with file corruption or server issues. So, moving into cloning the Magic Mirror repository, it’s fairly straightforward and we’ll get to it shortly. I’m having you walk through the manual installation of the Magic Mirror so that you have a better understanding of what is happening while interacting with the command line. I’ll show the alternate way later on in the text, but this builds some necessary skills for later on in this book. In turn, we have to install a few more packages before cloning into the repository in order to have the Magic Mirror run efficiently.

Installing Node.js

Node.js is an important aspect of the Magic Mirror setup as it creates the screen image with the specific modules on the monitor. It’s described as “an asynchronous event driven JavaScript runtime… designed to build scalable network applications” (about Node.js). While Raspbian, our operating system, does a timely job at staying updated, it behooves us to make sure that we have the latest version of Node.js in order to run our Magic Mirror program. We’re going to install the latest 64-bit ARM (known as Advanced Reduced Instruction Set Computer Machines) version for our Raspberry Pi. In order to install the latest version of Node.js, you’re going to execute the following steps:

  1. Make sure that you have an active Internet connection.
  2. Open up LXTerminal.
  3. In the Terminal, type the following:
wget http://node-arm.herokuapp.com/node_latest_armhf.deb
sudo dpkg –i node_latest_armhf.deb
  1. This was me telling the Pi to grab the most current version of Node.js and then switch to the root user in order to install the node package using dpkg, which is the Debian package management system.
  2. Wait for Node.js to download.
  3. Once the download has finished, double-check that you have the latest version by inputting node –v into the command line.

Installing Grunt

With some of the updates to the Magic Mirror program, I’ve found that it’s best to have the latest version of Grunt installed on your Pi as well. Grunt is basically a task manager and a build manager that integrates with Node.js. It has certain features that are helpful in the JavaScript environment, such as minification or the process of removing all unnecessary characters from source code without changing its functionality. On top of that, Grunt enables your program to reload as you make changes to your code during development. You’ll notice, when we start the Magic Mirror later on, that we’re going to call on Grunt usage with the npm start command. Grunt installation is very simple. We’re going to want to install Grunt’s command-line interface globally on the Pi. This way, we can readily call upon it when working from any directory:

sudo npm install –g grunt-cli

With Node.js and Grunt now downloaded, it’s time to finally clone into our repository:

  1. Make sure your Raspberry Pi is updated and upgraded. You can do this by typing sudo apt-get update && sudo apt-get upgrade.
  2. Clone the repository with git clone https://github.com/MichMich/MagicMirror ~/MagicMirror.
  3. This will download the directory containing the Magic Mirror files directly to your /home/pi folder.
  4. You’re going to enter the repository with cd ~/MagicMirror.
  5. You are then going to install and run the application using npm install && npm start.

It will take a second or two, but you will then see the default screen for your Magic Mirror pop up on your screen (Teeuw).

Working with the configuration file

Now that we have the Magic Mirror up and running, we have to personalize it. Consider where the Magic Mirror is going to be placed within your home. Are you going to be using it as a clock? Does it replace your bathroom mirror? Is this something that you’ve mounted near the front door so that you may scan some information as you leave for the day? All are excellent questions to consider and will mold how you choose which modules to include and which information should be highlighted. As you consider your options, take note of the default modules that are preinstalled with the application:

  • Clock: This displays the current date and time.
  • Calendar: This displays information from any public iCal calendar and can combine multiple calendars into one.
  • Current weather: This will display your chosen location’s weather information. It’s geared toward using the API from http://www.openweathermap.org/api.
  • Weather Forecast: Also using OpenWeatherMap, this will display the location’s forecast for the week.
  • News Feed: You can input news URLs of your choosing and the title of each news source, and this will scroll through the major headlines of the chosen news sources.
  • Compliments: This gives you the ability to randomize your own text content on the screen at a given the time of day: morning, afternoon, and evening.
  • Hello world: This places static text on your screen in a location of your choosing.
  • Alert: This module will display notifications from other modules.

As you can see, these working in tandem can create a very informative mirror for your everyday use. So, how do we actually customize? The customization process relies on the configuration file nestled in /MagicMirror/config. You’ll notice that when you move into the config directory, a file that you see listed is config.js.sample:

We have to make a copy of config.js.sample, and the easiest way to do that will be by making sure that you’re in the config directory and making a copy of the file:

cp config.js.sample config.js

So, any changes that you make to the config.js file will show up on the Magic Mirror screen. If you make an inexcusable error or find yourself needing to revert to the defaults entirely, you still have the sample copy to rely upon.

This is the sort of screen you will see with the default config.

Editing the configuration file

If you’re a complete novice to JavaScript, don’t worry too much about this process. Remember, the idea is to learn through trial and error and create a product that instills some pride. One way to build skills is to start editing and adding to the configuration file copy that you created in the previous section. The nice part about editing this file is that if your syntax is wrong or there’s a typo living somewhere in your document, the Magic Mirror will display a screen that alerts you to this problem. So there’s no harm in trying it out!

If you find it difficult to fix any problems or errors in the script, be mindful that there are browser-based JavaScript editors online that help you find the errors in your code. It comes down to a matter of copying and pasting, so I’d encourage you to turn to a website such as JSLint, found at http://www.jslint.com/. So, on to the configuration file as a whole:

/* Magic Mirror Config Sample
*
* By Michael Teeuw http://michaelteeuw.nl
* MIT Licensed.
*
* For more information how you can configurate this file
* See https://github.com/MichMich/MagicMirror#configuration
*
*/

var config = {
address: "localhost", // Address to listen on, can be:
// - "localhost", "127.0.0.1", "::1" to listen on loopback interface
// - another specific IPv4/6 to listen on a specific interface
// - "", "0.0.0.0", "::" to listen on any interface
// Default, when address config is left out, is "localhost"
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses
// or add a specific IPv4 of 192.168.1.5 :
// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],

language: "en",
timeFormat: 24,
units: "metric",

modules: [
{
module: "alert",
},
{
module: "updatenotification",
position: "top_bar"
},
{
module: "clock",
position: "top_left"
},
{
module: "calendar",
header: "US Holidays",
position: "top_left",
config: {
calendars: [
{
symbol: "calendar-check-o ",
url: "webcal://www.calendarlabs.com/templates/ical/US-Holidays.ics"
}
]
}
},
{
module: "compliments",
position: "lower_third"
},
{
module: "currentweather",
position: "top_right",
config: {
location: "New York",
locationID: "", //ID from http://www.openweathermap.org/help/city_list.txt
appid: "YOUR_OPENWEATHER_API_KEY"
}
},
{
module: "weatherforecast",
position: "top_right",
header: "Weather Forecast",
config: {
location: "New York",
locationID: "5128581", //ID from http://www.openweathermap.org/help/city_list.txt
appid: "YOUR_OPENWEATHER_API_KEY"
}
},
{
module: "newsfeed",
position: "bottom_bar",
config: {
feeds: [
{
title: "New York Times",
url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml"
}
],
showSourceTitle: true,
showPublishDate: true
}
},
]

};

/*************** DO NOT EDIT THE LINE BELOW ***************/

While reprinted here, you can also access this file for editing by employing the use of the nano function in the command line. As always, make sure that you're in the configuration directory found within the Magic Mirror directory: /home/pi/MagicMirror/configuration. At this point, you want to tell the Pi that you wish to edit config.js. In order to do that, type sudo nano config.js into the command line. This will bring up the preceding file text on your screen, where you can easily move the cursor around to add and remove items.

In terms of observation, there are a few items to which I wish to call your attention. Toward the top of the script, you’ll notice that there are some initial customizable options, such as port, ipWhitelist, language, timeFormat, and units. Let’s explore each briefly:

  • port: Not to be confused with a USB port, this is regarded as the endpoint of information in an operating system. You can change the port address, but 8080 is the conventional address that you’ll see used somewhat ubiquitously as your personally hosted web server. Over your local network, it’s easily accessed and can be used to view your Magic Mirror in a browser, as opposed to the application view. As a side note, running the Magic Mirror on a local host would be useful if you wanted multiple browser displays showing the same information. Some museums and venues use this setup for guests.
  • ipWhitelist: If you’d like to remote into your Magic Mirror, you’ll have to add the IP address of the machine you’d like to use. With updates to the Magic Mirror happening frequently, I would suggest that you look to the active Magic Mirror community and its discussions in case there are any issues.
  • language: While setting to English, you also have the options of nl, ru, and fr, Dutch, Russian, and French, respectively.
  • timeFormat: You can change this from the 24-hour clock format to the 12-hour format by inputting 12 in this space.
  • units: While setting to metric, you can replace this with imperial.

After going through these preferential settings, you’ll notice that the body of the script deals directly with the modules that are going to be displayed on your screen. You’ll notice a pattern with the curly brackets, as they enclose each module. There is a standardization to how each module is set up, which may be helpful if you find yourself puzzled about how to incorporate preferences and variables:

{
module: 'module name',
position: 'position',
header: 'optional header',
config: {
extra option: 'value'
}
},

Understanding the module

So, let’s take the compliments module as our example working piece. If you pass your eyes back over the config.js file, you’ll notice that the compliments module is nestled fifth from the top. You’ll notice that the only information in the config.js file for the compliments module is its placement: lower third. How does the compliments module know what information to display? Where is the revolving text coming from? The config.js file is using and calling up the information stored in the compliments directory, found in /home/pi/MagicMirror/defaults/compliments, specifically, compliments.js. Logically, we would need to edit the compliments.js file in order to change the content of the compliments module. Accordingly, we must understand that the config.js file literally deals with the spacing and configuration of the Magic Mirror display. Moving forward, let’s take a look at a portion of the compliments.js file after you’ve navigated to the compliments directory:

cd /home/pi/MagicMirror/defaults/compliments
sudo nano compliments.js

While looking at this file, we see the most important content aspects—anytime, morning, afternoon, and evening, toward the top. As you can guess, these compliments or text portions roll through the screen given the appropriate times of the day. Consider what content you would like to change or add and play around with modifying it. Also, make note that later in the compliments file, you have the ability to modify the hours dedicated to morning and afternoon, the leftover hours being dedicated to the evening:

complimentArray: function() {
var hour = moment().hour();
var compliments;

if (hour >= 3 && hour < 12 && this.config.compliments.hasOwnProperty("morning")) {
compliments = this.config.compliments.morning.slice(0);
} else if (hour >= 12 && hour < 17 && this.config.compliments.hasOwnProperty("afternoon")) {
compliments = this.config.compliments.afternoon.slice(0);
} else if(this.config.compliments.hasOwnProperty("evening")) {
compliments = this.config.compliments.evening.slice(0);
}
if (typeof compliments === "undefined") {
compliments = new Array();
}
if (this.currentWeatherType in this.config.compliments) {
compliments.push.apply(compliments, this.config.compliments[this.currentWeatherType]);
}
compliments.push.apply(compliments, this.config.compliments.anytime);
return compliments;
},

Once you’ve played around with modifying, understand that this process is replicated for the majority of modules in this program. I’d recommend that you take the time to look through the default folders and see what else you can change. If you’re worried about mistakes or editing a file in an error, make a copy of the original file, rename it, and leave it so that you have a reference point or a file to revert to.

Installing third-party modules

While the Magic Mirror comes with default modules, there are industrious Internet folk out there creating new, open source modules for download and addition by going to the third-party module portion of the Magic Mirror GitHub website, https://github.com/MichMich/MagicMirror/wiki/MagicMirror%C2%B2-Modules#3rd-party-modules. While extensive to list, you’ll note that there are modules for Twitter, Instagram, NFL scores, and Amazon’s Alexa, to name a few. These come with varying degrees of skill needed to set up, so it’s suggested that you assess which seems to be the best to try and then work through the installation and setup steps. Importantly, when installing a third-party module, you’re going to clone the repository into the Magic Mirror modules folder. Your steps would involve the following:

  1. Navigate to the Magic Mirror modules folder.
  2. Determine the URL of the GitHub repository you wish to clone.
  3. Clone the repository using the steps mentioned previously in the chapter.

Here is an example of what your mirror may look like once you place a two way mirror on the screen plugged into your Raspberry Pi 3:

Summary

In this chapter you learned how to set up a cool Magic Mirror that updates you on the news, shows you your local weather and so on while you check yourself out in the mirror. You also learned the basics of Raspberry Pi and the NOOBS operating system. You can enhance your mirror using motion sensors to activate your mirror when you are nearby. You can now continue to explore the Magic Mirror repository for some exciting modules to explore how others are using their Magic Mirror.

Left arrow icon Right arrow icon

Key benefits

  • Build exciting (six) end-to-end home automation projects with Raspberry Pi 3,
  • Seamlessly communicate and control your existing devices and build your own home automation system,
  • Automate tasks in your home through projects that are reliable and fun

Description

Raspberry Pi 3 Home Automation Projects addresses the challenge of applying real-world projects to automate your house using Raspberry Pi 3 and Arduino. You will learn how to customize and program the Raspberry Pi 3 and Arduino-based boards in several home automation projects around your house. This book aims to help you integrate different microcontrollers like Arduino, ESP8266 Wi-Fi module, Particle Photon and Raspberry Pi 3 into the real world, taking the best of these boards to develop some exciting home automation projects. We will start with an interesting project creating a Raspberry Pi Powered smart mirror and move on to Automated Gardening System, which will help you build a simple smart gardening to keep your garden healthy with minimal effort. You will also learn to build projects such as CheerLights into a holiday display, a project to erase parking headaches with OpenCV and Raspberry Pi 3, create Netfl ix's "The Switch" for the living room and lock down your house like Fort Knox with a Windows IoT face recognition-based door lock system. By the end of the book, you will be able to build and automate the living space with intriguing IoT projects and bring a new degree of inter connectivity to your world.

Who is this book for?

This book is for all those who are excited about building home automation systems with Raspberry Pi 3. It's also for electronic hobbyists and developers with some knowledge of electronics and programming.

What you will learn

  • Integrate different embedded microcontrollers and development boards like Arduino, ESP8266, Particle Photon and Raspberry Pi 3
  • Create your own magic mirror that lights up with useful information as you walk up to it
  • Create a system that intelligently decides when to water your garden and then goes ahead and waters it for you
  • Use the Wi-fi enabled Adafruit ESP8266 Huzzah to create your own networked festive display lights
  • Create a simple machine learning application and build a parking automation system using Raspberry Pi
  • Learn how to work with AWS cloud services and connect your home automation to the cloud
  • Learn how to work with Windows IoT in Raspberry Pi 3 and build your own Windows IoT Face Recognition door locking system
Estimated delivery fee Deliver to Czechia

Premium delivery 7 - 10 business days

€25.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Nov 06, 2017
Length: 226 pages
Edition : 1st
Language : English
ISBN-13 : 9781783283873
Vendor :
Raspberry Pi
Category :
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Czechia

Premium delivery 7 - 10 business days

€25.95
(Includes tracking information)

Product Details

Publication date : Nov 06, 2017
Length: 226 pages
Edition : 1st
Language : English
ISBN-13 : 9781783283873
Vendor :
Raspberry Pi
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 88.97
Raspberry Pi cookbook for Python programmers
€37.99
Raspberry Pi 3 Home Automation Projects
€29.99
Internet of Things with Raspberry Pi 3
€20.99
Total 88.97 Stars icon
Banner background image

Table of Contents

6 Chapters
Creating a Raspberry Pi-Powered Magic Mirror Chevron down icon Chevron up icon
Automated Gardening System Chevron down icon Chevron up icon
Integrating CheerLights into a Holiday Display Chevron down icon Chevron up icon
Erase Parking Headaches with OpenCV and Raspberry Pi Chevron down icon Chevron up icon
Building Netflix's The Switch for the Living Room Chevron down icon Chevron up icon
Lock Down with a Windows IoT Face Recognition Door System Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
(1 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 100%
1 star 0%
Breanna L Feb 11, 2018
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
I think this book would have been great but it is unfortunately OUT DATED. I was able to work through the first project, but instructions provided did not match the most recent updates to the magic mirror. I went on to the second project which was the home automated garden watering. The arduino board that is required has been discontinued. I then decided to just jump to the IoT section to find that the particle board needed is also discontinued and will no longer be made available. So in all this is already an outdated book. I feel sorry for the author because he spend a lot of time for these projects but next time he needs to do a little future proofing!
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela