Reader small image

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

Product typeBook
Published inNov 2023
Reading LevelIntermediate
PublisherPackt
ISBN-139781803237688
Edition2nd Edition
Languages
Tools
Right arrow
Author (1)
Vedat Ozan Oner
Vedat Ozan Oner
author image
Vedat Ozan Oner

Vedat Ozan Oner is an IoT product developer and software architect, with an excellent blend of technical knowledge and experience. During his career, he has contributed to several IoT projects in different roles, which allowed him to discover all key aspects of developing successful IoT products in highly competitive markets. Vedat has a bachelor's degree in METU/computer engineering and holds several industry-recognized credentials and qualifications, including PMP®, ITIL®, and AWS Certified Developer. Vedat started his limited company, Mevoo Ltd, in London in 2018 to provide consultancy services to his clients as well as develop his own IoT products. He still lives in London with his family.
Read more about Vedat Ozan Oner

Right arrow

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 2023Publisher: PacktISBN-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.
undefined
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 €14.99/month. Cancel anytime

Author (1)

author image
Vedat Ozan Oner

Vedat Ozan Oner is an IoT product developer and software architect, with an excellent blend of technical knowledge and experience. During his career, he has contributed to several IoT projects in different roles, which allowed him to discover all key aspects of developing successful IoT products in highly competitive markets. Vedat has a bachelor's degree in METU/computer engineering and holds several industry-recognized credentials and qualifications, including PMP®, ITIL®, and AWS Certified Developer. Vedat started his limited company, Mevoo Ltd, in London in 2018 to provide consultancy services to his clients as well as develop his own IoT products. He still lives in London with his family.
Read more about Vedat Ozan Oner