Book Image

Internet of Things with ESP8266

By : Marco Schwartz
Book Image

Internet of Things with ESP8266

By: Marco Schwartz

Overview of this book

The Internet of Things (IoT) is the network of objects such as physical things embedded with electronics, software, sensors, and connectivity, enabling data exchange. ESP8266 is a low cost WiFi microcontroller chip that has the ability to empower IoT and helps the exchange of information among various connected objects. ESP8266 consists of networkable microcontroller modules, and with this low cost chip, IoT is booming. This book will help deepen your knowledge of the ESP8266 WiFi chip platform and get you building exciting projects. Kick-starting with an introduction to the ESP8266 chip, we will demonstrate how to build a simple LED using the ESP8266. You will then learn how to read, send, and monitor data from the cloud. Next, you’ll see how to control your devices remotely from anywhere in the world. Furthermore, you’ll get to know how to use the ESP8266 to interact with web services such as Twitter and Facebook. In order to make several ESP8266s interact and exchange data without the need for human intervention, you will be introduced to the concept of machine-to-machine communication. The latter part of the book focuses more on projects, including a door lock controlled from the cloud, building a physical Bitcoin ticker, and doing wireless gardening. You’ll learn how to build a cloud-based ESP8266 home automation system and a cloud-controlled ESP8266 robot. Finally, you’ll discover how to build your own cloud platform to control ESP8266 devices. With this book, you will be able to create and program Internet of Things projects using the ESP8266 WiFi chip.
Table of Contents (20 chapters)
Internet of Things with ESP8266
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Preface

The Internet of Things (IoT) is an exciting field that proposes to have all the devices that surround us connected to the Internet and interacting with us, but also between each other. It's estimated that there will be 50 billion IoT devices in the world by the year 2020.

On the other hand, the ESP8266 chip is a small, cheap (less than $5), and powerful Wi-Fi chip that is also really easy to program. Therefore, it is just the perfect tool to build inexpensive and nice IoT projects. In this book, you are going to learn everything you need to know on how to build IoT projects using the ESP8266 Wi-Fi chip.

What this book covers

Chapter 1, Getting Started with the ESP8266, will teach all you need to know about how to choose your ESP8266 board and upload your first sketch to the chip.

Chapter 2, First Projects with the ESP8266, will explain the basics of the ESP8266 by making some real simple projects.

Chapter 3, Cloud Data Logging with the ESP8266, will dive right into the core of the topic of the book, and build a project that can log measurement data on the cloud.

Chapter 4, Control Devices from Anywhere, will reveal how to control devices from anywhere in the world using the ESP8266.

Chapter 5, Interacting With Web Services, will show how to use the ESP8266 to interact with existing web platforms such as Twitter.

Chapter 6, Machine-to-Machine Communications, will explain how to make ESP8266 chips talk to each other via the cloud, to build applications that don't require human intervention.

Chapter 7, Sending Notifications from the ESP8266, will show how to send automated notifications from the ESP8266, for example, via text message or email.

Chapter 8, Controlling a Door Lock from the Cloud, will use what we learned so far in the book to build our first application: a door lock that can be controlled remotely.

Chapter 9, Building a Physical Bitcoin Ticker, will use the ESP8266 for a fun project: making a physical display of the current price of Bitcoin.

Chapter 10, Wireless Gardening with the ESP8266, will dive into a more complex, by learning how to automate your garden with the ESP8266.

Chapter 11, Cloud-Based Home Automation System, will show how to build the essential blocks of an home automation system using the ESP8266.

Chapter 12, Cloud-Controlled ESP8266 Robot, will explain how to use the ESP8266 to control a mobile robot from anywhere in the world.

Chapter 13, Building Your Own Cloud Platform to Control ESP8266 Devices, will reveal how to build our own cloud platform for your ESP8266 projects.

What you need for this book

For this book, you will need to have the Arduino IDE, which we will use for all the projects of the book. You will learn how to install it and configure it in the first chapter of the book.

The chapters of the book were also written with a progressive complexity, so even if you don't know a lot about Arduino and/or the ESP8266 you will be able to learn as you progress through the chapters. However, previous experience in programing (especially in C++ and/or JavaScript) is recommend for this book.

Who this book is for

This book is for those who want to build powerful and inexpensive IoT projects using the ESP8266 Wi-Fi chip, including those who are new to IoT, or those who already have experience with other platforms such as Arduino.

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: "We can include other contexts through the use of the include directive."

A block of code is set as follows:

void loop() {
Serial.print("Connecting to ");
Serial.println(host);
// Use WiFiClient class to create TCP connections
WiFiClient client;
const int httpPort = 80;
if (!client.connect(host, httpPort)) {
Serial.println("connection failed");
return;
  }

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

# cp /usr/src/asterisk-addons/configs/cdr_mysql.conf.sample
     /etc/asterisk/cdr_mysql.conf

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: "Open Boards Manager from the Tools | Board menu and install the esp8266 platform, as shown."

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.

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

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from http://www.packtpub.com/sites/default/files/downloads/InternetofThingswithESP8266_ColorImages.pdf.

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.

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

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.