Developing IoT Projects with ESP32

Book description

Master the technique of using ESP32 as an edge device in any IoT application where wireless communication can make life easier

Key Features

  • Gain practical experience in working with ESP32
  • Learn to interface various electronic devices such as sensors, integrated circuits (ICs), and displays
  • Apply your knowledge to build real-world automation projects

Book Description

Developing IoT Projects with ESP32 provides end-to-end coverage of secure data communication techniques from sensors to cloud platforms that will help you to develop production-grade IoT solutions by using the ESP32 SoC. You'll learn how to employ ESP32 in your IoT projects by interfacing with different sensors and actuators using different types of serial protocols.

This book will show you how some projects require immediate output for end-users, and cover different display technologies as well as examples of driving different types of displays. The book features a dedicated chapter on cybersecurity packed with hands-on examples. As you progress, you'll get to grips with BLE technologies and BLE mesh networking and work on a complete smart home project where all nodes communicate over a BLE mesh. Later chapters will show you how IoT requires cloud connectivity most of the time and remote access to smart devices. You'll also see how cloud platforms and third-party integrations enable endless possibilities for your end-users, such as insights with big data analytics and predictive maintenance to minimize costs.

By the end of this book, you'll have developed the skills you need to start using ESP32 in your next wireless IoT project and meet the project's requirements by building effective, efficient, and secure solutions.

What you will learn

  • Explore advanced use cases like UART communication, sound and camera features, low-energy scenarios, and scheduling with an RTOS
  • Add different types of displays in your projects where immediate output to users is required
  • Connect to Wi-Fi and Bluetooth for local network communication
  • Connect cloud platforms through different IoT messaging protocols
  • Integrate ESP32 with third-party services such as voice assistants and IFTTT
  • Discover best practices for implementing IoT security features in a production-grade solution

Who this book is for

If you are an embedded software developer, an IoT software architect or developer, a technologist, or anyone who wants to learn how to use ESP32 and its applications, this book is for you. A basic understanding of embedded systems, programming, networking, and cloud computing concepts is necessary to get started with the book.

Table of contents

  1. Developing IoT Projects with ESP32
  2. Contributors
  3. About the author
  4. About the reviewers
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Code in Action
    6. Download the color images
    7. Conventions used
    8. Get in touch
    9. Share Your Thoughts
  6. Section 1: Using ESP32
  7. Chapter 1: Getting Started with ESP32
    1. Technical requirements
    2. IoT as an emerging technology
      1. What is IoT?
      2. Where do we apply IoT?
      3. AI/ML on the edge
      4. Energy harvesting
      5. Nanorobotics
    3. Understanding the basic structure of IoT solutions
      1. IoT security
    4. Introduction to ESP32 platform and modules
      1. Why ESP32?
      2. ESP32 features
    5. Development platforms and frameworks
    6. RTOS options
    7. Summary
  8. Chapter 2: Talking to the Earth – Sensors and Actuators
    1. Technical requirements
    2. Toolchain installation, programming, and debugging ESP32
      1. PlatformIO installation
      2. The first program
      3. Debugging the application
    3. Warming up – Basic I/O with buttons, pots, and LEDs
      1. Example: Turning an LED on/off by using a button
      2. Example – LED dimmer
    4. Working with sensors
      1. Reading ambient temperature and humidity with DHT11
      2. Using DS18B20 as temperature sensor
      3. Sensing light with TSL2561
      4. Employing BME280 in your project
    5. Working with actuators
      1. Using an electromechanical relay to control switching
      2. Running a stepper motor
    6. Summary
    7. Questions
  9. Chapter 3: Impressive Outputs with Displays
    1. Technical requirements
    2. Liquid Crystal Displays (LCDs)
    3. Organic Light-Emitting Diode Displays (OLEDs)
    4. Thin Film Transistor Displays (TFTs)
    5. Using FreeRTOS
      1. Counting touch sensor
      2. Using several sensors as producers
    6. Summary
    7. Questions
  10. Chapter 4: A Deep Dive into the Advanced Features
    1. Technical requirements
    2. Communicating over UART
    3. Adding a speaker with I²S
      1. Uploading a sound file to the flash memory
      2. Playing the sound file
    4. Developing a camera application
      1. Preparing the development environment for ESP32-CAM
      2. Flashing and monitoring ESP32-CAM
      3. Developing the project
    5. Developing low-power applications
      1. Waking up from light sleep
      2. Using the ULP coprocessor in deep sleep
    6. Summary
    7. Questions
  11. Chapter 5: Practice – Multisensor for Your Room
    1. Technical requirements
    2. Feature list of the multisensor
    3. Solution architecture
    4. Implementation
      1. Sensor subsystem
      2. User interaction subsystem
      3. Power management subsystem
      4. Main application
    5. Summary
  12. Section 2: Local Network Communication
  13. Chapter 6: A Good Old Friend – Wi-Fi
    1. Technical requirements
    2. Using Wi-Fi
      1. STA mode
      2. AP mode
    3. Developing with lwIP
      1. Sensor service over mDNS
      2. Digital clock with SNTP
    4. Summary
    5. Questions
    6. Further reading
  14. Chapter 7: Security First!
    1. Technical requirements
    2. Secure boot and over-the-air (OTA) updates
      1. Secure boot v1
      2. Secure boot v2
      3. Updating OTA
    3. Securing communication with TLS/DTLS
    4. Integrating with secure elements
    5. Summary
    6. Questions
    7. Further reading
  15. Chapter 8: I Can Speak BLE
    1. Technical requirements
    2. Understanding BLE basics
      1. The Generic Access Profile
      2. The Attribute Profile
      3. The Generic Attribute Profile
      4. The Security Manager Protocol
    3. Developing a BLE beacon
    4. Developing a GATT server
    5. Setting up a BLE Mesh network
    6. Summary
    7. Questions
    8. Further reading
  16. Chapter 9: Practice – Making Your Home Smart
    1. Technical requirements
    2. Feature list
    3. Solution architecture
      1. Light sensor
      2. Switch
      3. Gateway
    4. Implementation
      1. Light sensor
      2. Switch
      3. Gateway
      4. Testing
    5. Summary
  17. Section 3: Cloud Communication
  18. Chapter 10: No Cloud, No IoT – Cloud Platforms and Services
    1. Technical requirements
    2. IoT protocols with ESP32
      1. MQTT
      2. CoAP
      3. WebSocket
    3. Understanding cloud IoT platforms
      1. AWS IoT
      2. Azure IoT
      3. Google IoT Core
      4. Alibaba Cloud IoT Platform (Aliyun IoT)
    4. Developing on AWS IoT
    5. Summary
    6. Questions
  19. Chapter 11: Connectivity Is Never Enough – Third-Party Integrations
    1. Technical requirements
      1. How it works
      2. Amazon Alexa concepts
    2. Integrating with Amazon Alexa
      1. Creating the smart home skill
      2. Creating the Lambda function
      3. Linking an Amazon account to the skill
      4. Enabling the skill
      5. Creating a thing
      6. Developing the Lambda function
      7. Testing the skill
      8. Developing the firmware
      9. Troubleshooting
    3. Defining rules with IFTTT
      1. Preparing the rule
      2. Developing the firmware
    4. Summary
    5. Questions
    6. Further reading
  20. Chapter 12: Practice – A Voice-Controlled Smart Fan
    1. Technical requirements
    2. Feature list of the smart fan
    3. Solution architecture
      1. The device firmware
      2. The cloud architecture
    4. Implementation
      1. Creating the skill
      2. Creating the Lambda function
      3. Account linking
      4. Creating the thing
      5. Developing the Lambda function
      6. Developing the firmware
      7. What is next?
    5. Summary
  21. Answers
    1. Chapter 2
    2. Chapter 3
    3. Chapter 4
    4. Chapter 6
    5. Chapter 7
    6. Chapter 8
    7. Chapter 10
    8. Chapter 11
    9. Why subscribe?
  22. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Share Your Thoughts

Product information

  • Title: Developing IoT Projects with ESP32
  • Author(s): Vedat Ozan Oner
  • Release date: September 2021
  • Publisher(s): Packt Publishing
  • ISBN: 9781838641160