Book Image

Arduino Home Automation Projects

By : Marco Schwartz
Book Image

Arduino Home Automation Projects

By: Marco Schwartz

Overview of this book

Table of Contents (14 chapters)
Arduino Home Automation Projects
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Home automation is a topic that has been around for many years. It includes everything that you can imagine to control and automate your home. The most widely spread example is the alarm system of your home. Motion sensors, contact sensors, and the central device that orchestrates your alarm system are generally the main components of any home automation system.

There are countless devices that are available for home automation. You can buy complete home automation devices from a lot of stores, and even get them installed in your home. However, many of these systems are very expensive, impossible to be customized for your own needs, and have outdated user interfaces.

On the other hand, we have the Arduino platform. Arduino is a platform that you can use to quickly prototype electronic systems. It is now used by millions of people around the world to build more complex systems. It is actually the perfect platform to build home automation systems. Because of the flexibility of the Arduino platform, we are going to see that it is easy to interface with various sensors and actuators that are usually found in many home automation systems. It can also be interfaced with many wireless systems, such as Wi-Fi, Bluetooth, or XBee.

In this book, we are going to see how to build home automation systems with Arduino. We will first build systems based on commercially available Arduino boards. For example, we are going to build a temperature sensor based on Arduino and Bluetooth. We are also going to integrate some of these systems in an Internet of Things perspective, by sending some data directly to a cloud service. Finally, we are also going to see how to hack commercially available devices and build your own home automation systems from scratch.

What this book covers

Chapter 1, Building Wireless XBee Motion Detectors, covers a very common topic in home automation: motion detectors. We are going to build a swarm of motion detectors based on the well-known XBee protocol and Arduino. We are also going to build a server-side interface to monitor the state of the XBee motion detectors.

Chapter 2, Control Lights from Your Phone or Tablet, covers another popular topic in home automation systems: controlling lights remotely. We are going to interface a relay with Arduino and a Wi-Fi chip so that you can control lights in your home not only from your computer, but also from your phone or tablet.

Chapter 3, Measuring the Temperature Using Bluetooth, focuses on measuring temperature and humidity with Arduino, and transmitting the result back to your computer using Bluetooth. We are also going to build a simple interface using Python so that you can access the measurements made by the Arduino and Bluetooth system.

Chapter 4, Weather Station in the Cloud with Xively, teaches you to tackle a very trendy topic: the Internet of Things. We are going to make basic weather measurements on our Arduino board, and then transmit this data via Wi-Fi to the cloud using a service called Xively. Using this service, we'll be able to monitor our data remotely from anywhere in the world.

Chapter 5, Monitor Your Energy Consumption in the Cloud, starts with the use of the same cloud service that was used in Chapter 4, Weather Station in the Cloud with Xively. However, in this case, we are going to send energy consumption data to the cloud. This way, you will be able to monitor data directly from the Xively interface.

Chapter 6, Hack a Commercial Home Automation Device, explores the idea of doing things differently. Instead of creating a new home automation system based on Arduino, we are going to hack an existing device so that you can control it from your computer. We are going to build a USB-controlled power switch, so you can control any device right from an interface running on your computer.

Chapter 7, Build Your Own Home Automation System, goes one step further and shows you how to build your own home automation system based on Arduino. We'll cover how to build an Arduino system from scratch, how to design your own PCB, and finally how to design and 3D print a custom case for your project.

What you need for this book

You will need several hardware and software components to create all the projects found in this book. Of course, you can just read the description of the projects and learn this way. However, I really recommend actually doing the projects to really learn about building your own home automation systems based on Arduino.

The hardware components required are detailed at the beginning of each chapter. However, what you will really need for all the projects is an Arduino board. All the projects of the book are based on the Arduino Uno board, which is described in the following URL:

http://arduino.cc/en/Main/arduinoBoardUno

On the software part, there are some software that we will use in all chapters of the book. These are as follows:

  • Arduino IDE (http://arduino.cc/en/main/software).

  • You will need several libraries. These are detailed in each chapter where they are necessary.

  • You will also need a web server running on your computer for some of the projects. I recommend using some software that integrates a web server and a database and that handles all the details for you.

    If you are using Windows, I recommend using EasyPHP. You can download it from the following URL:

    http://www.easyphp.org/

    For OS X, I recommend using MAMP. You can download it from the following URL:

    http://www.mamp.info/

    For Linux, you can follow the instructions given in the following URL to install a web server:

    http://doc.ubuntu-fr.org/lamp

Make sure that the server is running at this point. We are going to use it in several of the projects of this book.

Who this book is for

This book is for all those who are willing to build their own home automation systems based on Arduino. You actually don't need to know anything about the Arduino platform beforehand, since all the projects will be explained step-by-step with clear instructions. The only thing you need in order to follow the projects found in this book is basic knowledge of electronics and programming.

This book is also for electronics hobbyists who want to learn more about doing projects with the Arduino platform. By doing these projects around home automation, you will learn about every aspect of the Arduino platform: how to interface sensors and actuators with Arduino, how to use wireless modules, and even how to build your own Arduino system from scratch.

Finally, this book is also for people willing to learn more about the Internet of Things using Arduino. Nearly all the chapters of the book include wireless communications, and two chapters of the book are dedicated to sending some data to the cloud so that it can be monitored from anywhere.

Conventions

In this book, you will find a number of styles of text 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: "What we are interested in is the return_value field, which contains the result of the digitalRead() function."

A block of code is set as follows:

String data = "";
data = data + timeString + "," + String(temperature) + "," + String(humidity) + "," + String(lightLevel);

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

[default]
if (client) {
  // Process request
  process(client);

  // Close connection and free resources.
  client.stop();
}

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

# /digital/7/1

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "On Windows, you can find it by navigating to Control Panel | Network and Internet | View network status and sharing options."

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 may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via 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 on 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 all Packt books you have purchased 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.

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 would 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 on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright 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.

Please 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

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.