Book Image

ESP8266 Home Automation Projects

By : Catalin Batrinu, Constantin Tambrea
Book Image

ESP8266 Home Automation Projects

By: Catalin Batrinu, Constantin Tambrea

Overview of this book

The ESP8266 is a low-cost yet powerful Wi-Fi chip that is becoming more popular at an alarming rate, and people have adopted it to create interesting projects. With this book, you will learn to create and program home automation projects using the ESP8266 Wi-Fi chip. You will learn how to build a thermostat to measure and adjust the temperature accordingly and how to build a security system using the ESP8266. Furthermore, you will design a complete home automation system from sensor to your own cloud. You will touch base on data monitoring, controlling appliances, and security aspects. By the end of the book, you will understand how to completely control and monitor your home from the cloud and from a mobile application. You will be familiar with the capabilities of the ESP8266 and will have successfully designed a complete ready-to-sell home automated system.
Table of Contents (16 chapters)
Title Page
About the Author
About the Reviewer
Customer Feedback
Building a Home Thermostat with the ESP8266
Using ESP8266 to Build a Security System

Starting with the ESP8266 chip

In order to start working with ESP8266, you will need a series of software and hardware components. ESP8266 is a 32-bit RISC low-cost microcontroller with Wi-Fi connectivity, capable of running at 80 MHz or 160 MHz. It has 64 KiB of instruction RAM and 96 KiB of RAM data.

For firmware and other data storage, an external QSPI flash is connected to it and the size can vary from 512 KiB to 4 MiB. The chip itself exposes 16 General Purpose Input/Output (GPIO) pins but some of them are used for the QSPI flash connection. The remaining pins are capable of Serial Peripheral Interface (SPI), I2C, I2S, Universal Asynchronous Receiver/Transmitter (UART), and one 10-bit Analog to Digital Converter (ADC).

The Wi-Fi capabilities are according to IEEE 80.11 b/g/n and provide WPA/WPA2 and WEP authentication but can also connect to open networks.

For this chapter, you will need just an ESP8266 module of your choice, since nowadays, there are many producers and board types available.

A good board can be found on or on e-commerce sites, such as, or but don't stop searching for them at your local electronics stores.

Now, the form factor of your board depends on your project constraints but for getting started with this chip, we can use one of the following boards:

  • Witty ESP12-F board
  • NodeMCU v1.0
  • WeeMos D1 mini

Either board will work fine but if you are a beginner, I'd recommend you to start with the Witty ESP12-F board because it already has:

  • LDR (Light Dependent Resistor) connected to the analog A0 input
  • RGB LED connected to GPIO 15, GPIO 12, and GPIO13
  • A push button connected to GPIO 4

Later, when we add other sensors to ESP8266, this module can be replaced with any of the other ESP8266 modules.