Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Developing IoT Projects with ESP32 - Second Edition

You're reading from  Developing IoT Projects with ESP32 - Second Edition

Product type Book
Published in Nov 2023
Publisher Packt
ISBN-13 9781803237688
Pages 578 pages
Edition 2nd Edition
Languages
Author (1):
Vedat Ozan Oner Vedat Ozan Oner
Profile icon Vedat Ozan Oner

Table of Contents (15) Chapters

Preface Introduction to IoT development and the ESP32 platform Understanding the Development Tools Using ESP32 Peripherals Employing Third-Party Libraries in ESP32 Projects Project – Audio Player Using Wi-Fi Communication for Connectivity ESP32 Security Features for Production-Grade Devices Connecting to Cloud Platforms and Using Services Project – Smart Home Machine Learning with ESP32 Developing on Edge Impulse Project – Baby Monitor Other Books You May Enjoy
Index

Developing IoT Projects with ESP32, Second Edition: Discover the IoT development ecosystem with ESP32 to create production-grade smart devices

Welcome to Packt Early Access. We’re giving you an exclusive preview of this book before it goes on sale. It can take many months to write a book, but our authors have cutting-edge information to share with you today. Early Access gives you an insight into the latest developments by making chapter drafts available. The chapters may be a little rough around the edges right now, but our authors will update them over time.

You can dip in and out of this book or follow along from start to finish; Early Access is designed to be flexible. We hope you enjoy getting to know more about the process of writing a Packt book.

  1. Chapter 1: Overview of ESP32 / Introduction to IoT development and the ESP32 platform
  2. Chapter 2: Understanding the development tools to create the first application
  3. Chapter 3: Using ESP32 peripherals...

Technical requirements

In this book, we are going to go through many practical examples where we can learn how to use ESP32 effectively in real-world scenarios. Although links to the examples are provided within each chapter, you can take a sneak peek at the online repository here: https://github.com/PacktPublishing/Developing-IoT-Projects-with-ESP32-2nd-edition. The examples are placed in their relative directories of the chapters for easy browsing. There is also a common source code directory that contains the shared libraries across the chapters.

The programming language of the examples is usually C++11 (the default C++ standard supported by the toolchain). However, there are several chapters where Python 3 is required to support the subject.

The hardware tools, development kits, and sensors that you will need throughout the book are the following:

  • ESP32-S3-BOX-Lite (approx. $35)
  • ESP32-C3-DevKitM-1 (approx. $8)
  • BME280 temperature, humidity, pressure...

Understanding the basic structure of IoT solutions

Although the definition of IoT might change slightly from different viewpoints, there are some key concepts in the IoT world that differentiate it from other types of technologies:

  • Connectivity: An IoT device is connected either to the internet or to a local network. An old-style thermostat on the wall waiting for manual operation with basic programming features doesn’t count as an IoT device.
  • Identification: An IoT device is uniquely identified in the network so that data has a context identified by that device. In addition, the device itself is available for remote update, remote management, and diagnostics.
  • Autonomous operation: IoT systems are designed for minimal or no human intervention. Each device collects data from the environment where it is installed, and it can then communicate the data with other devices to detect the current status of the system and respond as configured. This response can...

The ESP32 product family

Since the launch of the first ESP32 chip, Espressif Systems has extended the family with new designs for different purposes. They now have more than 200 different SoCs and modules in the inventory. Although it is impossible to discuss each of them one by one, we can talk about the ESP32 product family in general to understand their intended use cases. It is always a good idea to check what we need and what is available in the arsenal before starting a new IoT project.

There is an online tool on the Espressif website to find an SoC/module by filtering them based on selected features. You check the filter boxes, and the tool lists the hardware matching your requirements: https://products.espressif.com/#/product-selector

The following is a basic checklist for selecting an SoC/module:

  • Performance requirements (core frequency, single/double core)
  • Memory requirements (RAM, ROM)
  • Embedded flash requirements
  • Power requirements...

Development platforms and frameworks

ESP32 is quite popular. Therefore, there are a good number of options that you can select as your development platform and framework.

The first framework, of course, comes directly from Espressif itself. They call it the Espressif IoT Development Framework (ESP-IDF). It supports all three main OS environments – Windows, macOS, and Linux. After installing some prerequisite packages, you can download the ESP-IDF from the GitHub repository and install it on your development PC. They have collected all the necessary functionality into a single Python script, named idf.py, for developers. You can configure project parameters and generate a final binary image by using this command-line tool.

You can also use it in every step of your project, starting from the build phase to connecting and monitoring your ESP32 board from the serial port of your computer. If you are a more graphical UI person, then you need to install Visual Studio Code...

RTOS options

Basically, a real-time operating system (RTOS) provides a deterministic task scheduler. Although the scheduling rules change depending on the scheduling algorithm, we know that the task we create will complete in a certain time frame within those rules. The main advantages of using an RTOS are the reduction in complexity and improved software architecture for easier maintenance.

The main real-time operating system supported by ESP-IDF is FreeRTOS. ESP-IDF uses its own version of the Xtensa port of FreeRTOS. The fundamental difference compared with vanilla FreeRTOS is the dual-core support. In ESP-IDF FreeRTOS, you can choose one of two cores to assign a task, or you can let FreeRTOS choose it. Other differences compared with the original FreeRTOS mostly stem from the dual-core support. FreeRTOS is distributed under the MIT license. You can find the ESP-IDF FreeRTOS documentation at this URL: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference...

Summary

In this first chapter, we discussed what the Internet of Things (IoT) is in general and its building blocks to understand the basic structure of IoT solutions. One of the building blocks is device hardware that interacts with the physical world. System-on-chip (SoC) is a major component while designing an IoT device. Espressif Systems empowers us, as IoT developers, with its ESP32 product family, which includes many SoCs with different configurations in response to the needs of IoT projects. In addition to hardware, Espressif maintains the Espressif IoT Development Framework (ESP-IDF), the main software framework to develop IoT applications on ESP32 SoCs. ESP-IDF comes with all the necessary tools to deliver full-fledged IoT products. We also talked about real-time operating system (RTOS) options that we can select from in ESP32 development. ESP-IDF integrates FreeRTOS, a prominent RTOS option in the embedded world, as a component.

Following the background information...

lock icon The rest of the chapter is locked
You have been reading a chapter from
Developing IoT Projects with ESP32 - Second Edition
Published in: Nov 2023 Publisher: Packt ISBN-13: 9781803237688
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}