O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

ESP8266 Internet of Things Cookbook

Book Description

Exploring the low cost WiFi module

About This Book

  • Leverage the ESP8266's on-board processing and storage capability
  • Get hand- on experience of working on the ESP8266 Arduino Core and its various libraries
  • A practical and enticing recipe-based book that will teach you how to make your environment smart using the ESP8266

Who This Book Is For

This book is targeted at IOT enthusiasts who are well versed with electronics concepts and have a very basic familiarity with the ESP8266. Some experience with programming will be an advantage.

What You Will Learn

  • Measure data from a digital temperature and humidity sensor using the ESP8266
  • Explore advanced ESP8266 functionalities
  • Control devices from anywhere in the world using MicroPython
  • Troubleshoot issues with cloud data monitoring
  • Tweet data from the Arduino board
  • Build a cloud-connected power-switch with the ESP8266
  • Create an ESP8266 robot controlled from the cloud

In Detail

The ESP8266 Wi-Fi Module is a self contained System on Chip (SOC) with an integrated TCP/IP protocol stack and can give any microcontroller access to your Wi-Fi network. It is capable of either hosting an application or offloading all Wi-Fi networking functions from another application processor.

This book contains practical recipes that will help you master all ESP8266 functionalities. You will start by configuring and customizing the chip in line with your requirements. Then you will focus on core topics such as on-board processing, sensors, GPIOs, programming, networking, integration with external components, and so on. We will also teach you how to leverage Arduino using the ESP8266 and you'll learn about its libraries, file system, OTA updates, and so on. The book also provide recipes on web servers, testing, connecting with the cloud, and troubleshooting techniques. Programming aspects include MicroPython and how to leverage it to get started with the ESP8266. Towards the end, we will use these concepts and create an interesting project (IOT).

By the end of the book, readers will be proficient enough to use the ESP8266 board efficiently.

Style and approach

This recipe-based book will teach you to build projects using the ESP8266.

Downloading the example code for this book. 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 code file.

Table of Contents

  1. ESP8266 Internet of Things Cookbook
    1. Table of Contents
    2. ESP8266 Internet of Things Cookbook
    3. Credits
    4. About the Author
    5. About the Reviewer
    6. www.PacktPub.com
      1. eBooks, discount offers, and more
        1. Why subscribe?
    7. Customer Feedback
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Sections
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Conventions
      6. Reader feedback
      7. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    9. 1. Configuring the ESP8266
      1. Introduction
      2. Setting up the Arduino development environment for the ESP8266
        1. Getting ready
        2. How it works…
        3. See also
      3. Choosing an ESP8266 board
        1. Available options
        2. What to choose?
        3. There's more…
        4. See also
      4. Required additional components
        1. Required components
          1. Sensors
            1. DHT11
            2. Photocell
            3. Soil humidity sensor
          2. Actuators
            1. Relays
            2. Power switch tail kit
            3. Water pump
          3. Breadboard
          4. Jumper wires
          5. Micro USB cable
        2. See also
      5. Uploading your first sketch to the ESP8266
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      6. Connecting the ESP8266 to your local Wi-Fi network
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      7. Connecting the ESP8266 to a cloud server
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      8. Troubleshooting basic ESP8266 issues
        1. The Board is not visible from the Arduino IDE
        2. The board cannot be configured from the Arduino IDE
        3. The board does not connect to your local Wi-Fi network
    10. 2. Your First ESP8266 Projects
      1. Introduction
      2. Functionalities of the ESP8266
        1. Features
        2. Pin configuration
          1. Power pins
          2. Serial pins
          3. I2C and SPI pins
          4. GPIO pins
          5. Analog pins
          6. Control pins
        3. How it works...
        4. See also
      3. Reading digital signals
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Reading analog signals
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      5. Controlling an LED
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      6. Dimming an LED
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      7. Controlling a servo motor
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      8. Measuring data from a digital sensor
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      9. Controlling an OLED screen
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      10. Troubleshooting basic ESP8266 issues
        1. The analog pin cannot measure high voltages
        2. The board stops working when things are connected to some pins
        3. The board keeps on crashing and resetting
        4. The board produces gibberish on the serial monitor when I rest it
    11. 3. More ESP8266 Functions
      1. Introduction
      2. Discovering the advanced functions of the ESP8266
        1. Wi-Fi connectivity
        2. Real-Time Clock (RTC)
        3. Over the air update
        4. Low power management
        5. Working with files
        6. See also
      3. Using libraries on the ESP8266
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Discovering the filesystem of the ESP8266
        1. Flash memory
        2. Filesystem memory management
        3. Setting up the ESP8266FS tool
        4. There's more…
        5. See also
      5. Storing data in the ESP8266 filesystem
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      6. Discovering the over the air update of the ESP8266 (OTA)
        1. Over the air
        2. Security
        3. Safety
        4. See also
      7. Programming your ESP8266 OTA
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      8. Troubleshooting basic ESP8266 issues
        1. The Arduino IDE does not show the OTA port
        2. The library no longer compiles
        3. The txt file in my filesystem only holds one value even after saving several values in it
    12. 4. Using MicroPython on the ESP8266
      1. Introduction
      2. Introduction to MicroPython on the ESP8266
        1. MicroPython & the ESP8266
        2. See also
      3. Discovering the MicroPython language
        1. Discovering MicroPython
          1. Auto-indent
          2. Auto-completion
          3. Interrupting a running program
          4. Paste mode
          5. Soft reset
          6. The special variable _ (underscore)
          7. Raw mode
        2. See also
      4. Getting started with MicroPython on the ESP8266
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      5. Controlling pins using MicroPython
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There is more…
        5. See also
      6. Reading data from a sensor using MicroPython
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      7. Sending data to the cloud using MicroPython
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      8. Troubleshooting common MicroPython issues
        1. A library can't be used
        2. The menu to upload files to the ESP8266 is not visible
        3. The board can't be configured via OTA
    13. 5. Cloud Data Monitoring
      1. Introduction
      2. Internet of Things platforms for the ESP8266
        1. Sparkfun ESP8266 thing
        2. Adafruit feather HUZZAH
        3. NodeMCU ESP8266
        4. Wio Link
        5. See also
      3. Connecting sensors to your ESP8266 board
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Posting the sensor data online
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      5. Retrieving your online data
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      6. Securing your online data
        1. Locking your things
        2. See also
      7. Monitoring sensor data from a cloud dashboard
        1. Getting ready
        2. How to do it…
        3. See also
      8. Creating automated alerts based on the measured data
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      9. Monitoring several ESP8266 modules at once
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      10. Troubleshooting common issues with web services
        1. The board is not connecting to the Wi-Fi network
        2. The lock feature on dweet is not working
        3. The alert feature on dweet is not working
        4. The widgets on my dashboard do not display readings
    14. 6. Interacting with Web Services
      1. Introduction
      2. Discovering the Temboo platform
        1. See also
      3. Tweeting data from the ESP8266 board
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Posting updates on Facebook
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      5. Storing data on Google Drive
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      6. Automation with IFTTT
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      7. Sending push notifications
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      8. Sending e-mail notifications
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      9. Sending text message notifications
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      10. Troubleshooting common issues with web services
        1. The board is not connecting to the Wi-Fi network
        2. The generate code button on Temboo returns an error when pressed the second time
        3. The Temboo sketches bring up errors when I try to compile them
        4. All my applets on IFTTT are being activated when the trigger is fired
        5. The IFTTT SMS service is not working
    15. 7. Machine to Machine Interactions
      1. Introduction
      2. Types of IoT interactions
        1. See also
      3. Basic local machine to machine interactions
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      4. Cloud machine to machine interaction
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      5. Automated M2M with IFTTT
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      6. M2M alarm system
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      7. Automated light control
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      8. Automated gardening controller
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      9. Troubleshooting common issues with web services
        1. The board is not connecting to the Wi-Fi network
        2. The board is not connecting to Adafruit IO
        3. The board receives more than one reading or different readings from what was sent
        4. My board is not successfully creating a hotspot
    16. Index