Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Developing IoT Projects with ESP32
Developing IoT Projects with ESP32

Developing IoT Projects with ESP32: Automate your home or business with inexpensive Wi-Fi devices

Arrow left icon
Profile Icon Vedat Ozan Oner
Arrow right icon
zł59.99 zł225.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3 (11 Ratings)
eBook Sep 2021 474 pages 1st Edition
eBook
zł59.99 zł225.99
Paperback
zł282.99
Subscription
Free Trial
Arrow left icon
Profile Icon Vedat Ozan Oner
Arrow right icon
zł59.99 zł225.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3 (11 Ratings)
eBook Sep 2021 474 pages 1st Edition
eBook
zł59.99 zł225.99
Paperback
zł282.99
Subscription
Free Trial
eBook
zł59.99 zł225.99
Paperback
zł282.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Table of content icon View table of contents Preview book icon Preview Book

Developing IoT Projects with ESP32

Chapter 1: Getting Started with ESP32

Espressif ESP32 is a powerful tool in the toolbox of a developer for many types of Internet of Things (IoT) projects. We are all developers, and we all know how important it is to select the right tool for a given problem in a domain. To solve the problem, we need to understand the domain, and we need to know the available tools and their features that are important for that specific problem in order to find the right one (or perhaps several combined). After selecting the tool, we eventually need to figure out how to use it in the most efficient and effective way possible so as to maximize the added value for end users.

In this chapter, I will discuss the technology, IoT, in general, what an IoT solution looks like in terms of basic architecture, and how ESP32 fits into those solutions as a tool. If you are new to IoT technology, or are thinking of using ESP32 in your next project, this chapter helps you to understand the big picture from the technology perspective by describing what ESP32 provides, its capabilities, and its limitations.

The main topics covered in this chapter are as follows:

  • IoT as an emerging technology and its application areas with some examples
  • The basic structure of IoT solutions, including security considerations
  • An introduction to the ESP32 platform and modules
  • Available development platforms and frameworks
  • Real-Time Operating System (RTOS) options for ESP32

Technical requirements

In this book, we are going to have 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/Internet-of-Things-with-ESP32. 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.

We will use different software tools and hardware components throughout the book. Each chapter shows its own list of these tools and components.

IoT as an emerging technology

When I started my career 20 years ago, my first project involved collecting data regarding radio and TV stations by measuring some Radio Frequency (RF) parameters of broadcasted channels. The task was to design and develop a system in order to understand whether the stations comply with the existing regulations in the country. As a solution for this engineering problem, the technical leaders in the team designed a van with various equipment, including the following:

  • A spectrum analyzer
  • A TV demodulator
  • Different types of antennas to measure those parameters
  • An industrial PC to run the application software
  • A radio transmitter to upload the measurements and some basic analysis to a data center

I was lucky that I participated in such a project in my very first job and saw how a complete data acquisition system was designed and developed to solve a real-world problem. This project was in the year just after Kevin Ashton introduced the term Internet of Things to technology literature in 1999.

When I first heard this term and was trying to understand what it actually means, I quickly noticed the similarities between an IoT solution and our monitoring van. We collected data from the environment by using some sensing devices, we had a processing unit, and we also transferred information to a central data storage and processing center. This last part was to access more processing and spot correlation between data coming from multiple vans. So, why not call it an IoT product? Well, not exactly. From that perspective, you could easily call any SCADA or PLC product an IoT system as well, so IoT would only then constitute a rebranding of existing technologies.

What is IoT?

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 be in the form of an action, a log, or an alert if required.
  • Interoperability: Devices in an IoT solution talk to one another, but they don't necessarily belong to a single vendor. When devices designed by different vendors share a common application-level protocol, adding a new device to that heterogeneous network is as easy as clicking on a few buttons on the device or on the management software.
  • Scalability: IoT systems are capable of horizontal scalability to respond to an increasing workload. A new device is added when necessary to increase capacity instead of replacing the existing one with a superior device (vertical scalability).
  • Security: I wish I could say that every IoT solution implements at least the minimal set of mandatory security measures, but unfortunately, this is not the case, despite a number of bad experiences, including the infamous Mirai botnet attack. On a positive note, I can say that IoT devices mostly have secure boot, secure update, and secure communication features to ensure confidentiality, integrity, and availability the (CIA triad).

Gartner added IoT in the 2011 hype cycle, with the expectation of more than 10 years to mainstream adoption. However, many related technologies, such as RFID, mesh networking, and Bluetooth, were already on the list many years before 2011, along with enablers such as mobile and cloud technologies. Since then, Gartner has added several other IoT technologies and applications to its list, including the following:

  • IoT platform
  • Connected home
  • Smart dust
  • Edge computing
  • Low-cost, single-board computers at the edge

5G and embedded AI are other revolutionary technologies on the Gartner list that support IoT and expand its area of application.

Where do we apply IoT?

The application areas are vast, but conceptually speaking, we can group them into two basic categories:

  • In the consumer IoT category, we can see mainly smart home and security systems, personal healthcare products, wearable technologies, and asset tracking applications.
  • The industrial IoT category has more application areas, as you might expect. Every year, IoT Analytics publishes a top-10 trend list for industrial applications by reviewing thousands of new projects and the 2020 list contains manufacturing, transportation, energy, retail, cities, healthcare, supply chain, agriculture, and building applications in that order (https://iot-analytics.com/top-10-iot-applications-in-2020).

Since we have limited space in this book, I don't want to waste pages talking about each of these application areas. Instead, I'd like to share more interesting cases to show how the IoT technology can provide powerful solutions when incorporated with other cutting-edge technologies.

AI/ML on the edge

AI has been around for a long time and there are many successful examples of machine vision, Natural Language Processing (NLP), speech recognition, and ML projects. However, they all require energy-hungry powerful hardware to be able to cope with CPU and memory-intensive calculations, which is not possible with humble sensor devices that have much less memory and processing power. TensorFlow Lite addresses this problem. Its converter can output a model, a set of rules to make predictions by running data through them, with a size as low as 14 KB to fit into any modern microcontroller, such as an ARM Cortex-M3 device with a very low power consumption, which enables you to have battery-operated sensor devices with ML capabilities. One interesting project comes from Benjamin Cabé (on Twitter: @kartben). In his project, he managed to train a model to discern different types of spirits with an accuracy of 92%. He used a Wio Terminal from SeeedStudio as the computing board, which has an ARM Cortex-M4F core running at 120 MHz.

Implications are enormous. Instead of a dummy sensor device, now we have the capability of developing a real smart device such that it can add meaning to data it collects and can react based not only on data, but also the meaning. Benjamin employed a simple gas sensor to detect various gases, such as carbon monoxide (CO), nitrogen dioxide (NO2), ethyl alcohol (C2H5CH), and some other types. But the device itself can understand what it actually smells, thanks to the ML model it uses in its firmware. Without such a capability, the device would have to send its data to another more powerful machine or a cloud to make this analysis and then wait for a reply to decide what to do next. Moreover, if it loses its network connectivity somehow, nothing could be done more until connectivity is restored.

This subject definitely deserves another book, but if you want to do some experiments, ESP32 is also on the list of supported platforms on the TensorFlow Lite website.

Important note

You can have a look at the supported platforms for TensorFlow Lite at the following link: https://www.tensorflow.org/lite/microcontrollers.

Energy harvesting

A vital discussion and research subject for Wireless Sensor Networks (WSNs) has always been the energy consumption of sensor nodes. Obviously, less is better. If you have some experience with the development of battery-operated wireless devices, you know the concept of run to sleep, which means do the job and go into sleep mode as soon as possible to preserve the most valuable resource, energy. Nonetheless, whatever you do, sensor nodes must consume energy and the user will have to replace the batteries after a while. An interesting technology comes to your aid at this point – energy harvesting, which has been around since the days of Nikola Tesla. The energy can be harvested from various ambient sources, including light, vibration, and wireless energy sources. To do that, a harvesting solution first needs to access that ambient energy by means of various components, depending on the energy type.

It is an RF antenna if the energy comes from an RF source, or a photovoltaic cell if light is the source. Then, this raw electrical energy has to be converted with the help of an integrated circuit in order to store it in a capacitor or a battery. But you know that this is easier said than done. Although there are several Power Management Integrated Circuits (PMICs) from different silicon vendors on the market, it is hard to say whether they solve this problem efficiently. The major challenges are very low levels of energy to harvest, the need to boost the very low voltage to higher logic levels, the need for multiple external components to operate, and a large chip footprint on the PCB. Therefore, these challenges have prevented vendors from producing high-performance energy harvesting chips. One product does sound promising, though.

Nowi Energy promotes its NH2D0245 PMIC as the most efficient and the smallest footprint power management IC compared to other semiconductor giants on the market. To prove their arguments, they launched a hybrid smartwatch module together with the module company MMT, such that a watch with that module requires no charge to operate during its lifetime. Energy harvesting is a hot topic, so there are, of course, competitors, such as e-peas semiconductors from Belgium. You might want to try one of those PMICs in your next WSN project.

Nanorobotics

Before we move on, we should look at one last project, a research project from Cornell University. The result of this research has been published in Nature Journal in August 2020 as an article named Electronically integrated, mass-manufactured, microscopic robots. They invented actuators on a nano scale that you literally cannot see with your eyes. The super tiny structure has two solar cells on it to move the legs, and when laser beams are dropped on those solar cells, they generate enough voltage to activate the legs. Although not ready for any practical application as yet, this research is definitely on my follow-up list as a technologist and IoT expert.

Important note

If you want to see them in action, there is a video on YouTube: https://www.youtube.com/watch?v=2TjdGuBK9mI.

These examples are certainly extremes in terms of technology application, but I hope they provide a glimpse of the future in terms of IoT technologies and inspire you in your next IoT project. Let's now continue with some common features of IoT solutions.

Understanding the basic structure of IoT solutions

An IoT solution combines many different technologies into a single product, starting from a physical device and covering all layers up to end user applications. Each layer of the solution aims to implement the same vision set by the business, but requires a different approach while designing and developing. We definitely cannot talk about one-size-fits-all solutions in IoT projects, but we still can apply an organized approach to develop products. Let's see which layers a solution has in a typical IoT product:

  • Device hardware: Every IoT project requires hardware with a System-On-Chip (SoC) or Microcontroller Unit (MCU) and sensors/actuators to interact with the physical world. In addition to that, every IoT device is connected, so we need to select the optimal communication medium, such as wired or wireless. Power management is also another consideration under this category.
  • Device firmware: We need to develop device firmware to run on the SoC in order to fulfill the project's requirements. This is where we collect data and transfer it to the other components in the solution.
  • Communication: Connectivity issues are handled in this category of the solution architecture. The physical medium selection corresponds to one part of the solution, but we still need to decide on the protocol between devices as a common language for sharing data. Some protocols may provide a whole stack of communication by defining both the physical medium up to the application layer. If this is the case, you don't need to worry about anything else, but if your stack leaves the context management at the application layer up to you, then it is time to decide on what IoT protocol to use.
  • Backend system: This is the backbone of the solution. All data is collected on the backend system and provides the management, monitoring, and integration capabilities of the product. Backend systems can be implemented on on-premises hardware or cloud providers, again depending on the project requirements. Moreover, this is where IoT encounters other disruptive technologies. You can apply big data analytics to extract deeper information from data coming from sensors, or you can use AI algorithms to feed your system with more smart features, such as anomaly detection or predictive maintenance.
  • End user applications: You will very likely require an interface for your end users to let them access the functionality. 10 years ago, we were only talking about desktop, web, or mobile applications. But today we have voice assistants. You can think of them as a modern interface for human interaction, and it might be a good idea to add voice assistant integration as a feature, especially in the consumer segment.

The following diagram depicts the general structure of IoT solutions:

Figure 1.1 – Basic structure

Figure 1.1 – Basic structure

This is the list of aspects, more or less, that we need to take into account in many types of IoT projects before starting.

IoT security

One important consideration that remains is security. Actually, it is all about security. I cannot overemphasize its importance whatever I write. IoT devices are connected to the real world and any security incident has the potential for serious damage in the immediate environment, let alone other cybersecurity crimes. Therefore, it should always be in your checklist while designing any hardware or software components of the solution. Although security, as a subject, definitely deserves a book by itself, I can list some golden rules for devices in the field:

  • Always look to reduce the attack surface for both hardware and firmware.
  • Prevent physical tampering wherever possible. No physical port should be open if this is not necessary.
  • Keep secret keys on a secure medium.
  • Implement secure boot, secure firmware updates, and encrypted communication.
  • Do not use default passwords; TCP/IP ports should not be open unnecessarily.
  • Put health check mechanisms in place along with anomaly detection where possible.

We should embrace secure design principles in general as IoT developers. Since an IoT product has many different components, end-to-end security becomes the crucial point while designing the product. A risk impact analysis should be done for each component to decide on the security levels of data in transit and data at rest. There are many national/international institutions and organizations that provide standards, guidelines, and best practices regarding cybersecurity. One of these, which works specifically on IoT technology is the IoT Security Foundation. They are actively developing guidelines and frameworks on the subject and publishing many of those guidelines, which are freely available.

Important note

If you want to check those guidelines, you can visit the IoT Security Foundation website for their publications here: https://www.iotsecurityfoundation.org/best-practice-guidelines/.

Now, that we are equipped with sufficient knowledge of IoT and its applications, we can propel our journey with ESP32, a platform perfectly suited for beginner-level projects as well as end products. In the remaining sections of this chapter, we are going to talk about the ESP32 hardware, development frameworks, and RTOS options available on the market.

Introduction to ESP32 platform and modules

The first ESP32 chip was launched in 2016 when I was working for a smart home company as a technical product manager. The wireless communication technology that we had chosen for our product line was Z-wave on account of its technical features (sub-gigahertz wireless communication, mesh networking, interoperability, and suchlike) and market status (many vendors, thousands of certified products, and so on).

The vision was not to be yet another device vendor, but to be a platform where every other vendor meets with end users. The most crucial step was to develop the most affordable Z-wave gateway on the market such that any smart home enthusiast would prefer our gateway as the access point of other Z-wave devices in their home. Our first prototype was a high-performance, embedded Linux board with an ARM-CortexA SoC; however, in terms of pricing, it was certainly not the most affordable one in our segment. Then we discovered ESP32 from Espressif. This was a game-changer.

ESP32 allowed us to slash the price of the gateway to a quarter of what it was originally. Having an ESP32 as the main computing unit, we attached a Z-wave module to it as the network co-processor. The other end was Wi-Fi, a built-in feature of ESP32, to connect the backend system. We didn't worry about security requirements because there was a cryptographic hardware accelerator in the ESP32 chip for encryption/decryption purposes. That was all that we needed. However, as always, life is not that easy. The Z-wave library that we procured from the market had targeted Linux-based boards, not a resource-constrained SoC like ESP32. So we started to port the whole Z-wave library for ESP32 and succeeded. Finally, we had the most compact and most affordable Z-wave gateway on the market.

Why ESP32?

IoT technologies have proven their worth over the years and, as developers, we have a great many tools available to us today for developing exceptional IoT products compared to 5 or 10 years ago. ESP32 is definitely one of those tools and there are many reasons as to why this is so:

  • Its price tag and availability
  • Wi-Fi and Bluetooth in a single SoC
  • Great hardware features with many peripheral interfaces, different power modes, and cryptographic hardware acceleration
  • Variants for different requirements, in terms of both chips and modules
  • Advanced development platforms and frameworks
  • A huge community
  • And finally, native integration with top cloud infrastructures

These are the reasons for putting ESP32 at the top of your SoC selection list if you require a Wi-Fi SoC in your project.

ESP32 features

Since the introduction of the first ESP32 on the market, Espressif launched several variants of ESP32 and most recently, in 2020, they introduced ESP32-S2 series chips. The ESP32 family is a general-purpose, feature-rich, and versatile SoC solution that you can use in many different types of IoT projects where you require Wi-Fi connectivity. Let's have a quick look at the main features:

  • CPU and memory: 32-bit Xtensa® LX6 microprocessor with a clock frequency/MIPS of up to 240 MHz/600 MIPS. Single- or dual-core variants. 448 KB ROM, 520 KB SRAM, and 16 KB RTC memory. Support for external SPI flash and SPI RAM for module variants. DMA for peripherals.
  • Connectivity: Wi-Fi 802.11 n (2.4 GHz) up to 150 Mbps (STA and softAP modes) and Bluetooth-compliant with Bluetooth v4.2 BR/EDR and BLE specifications.
  • Peripheral interfaces: GPIOs, ADC, DAC, SPI, I2C, I2S, UART, eMMC/SD (chip variants), CAN, IR, PWM, touch sensor, and hall sensor.
  • Security: Cryptographic hardware acceleration (random number, hash, AES, RSA, and ECC), 1024-bit OTP, secure boot, and flash encryption.
  • Power modes: Different power modes with the help of an Ultra-Low-Power (ULP) co-processor and a Real-Time Clock (RTC). 100 μA power consumption in deep-sleep mode (ULP active).

The new ESP32-S2 series is a bit different, with some notable differences including the following:

  • Single core.
  • No Bluetooth.
  • No support for SD/eMMC, but USB OTG has been added.
  • Enhanced security features.

To make hardware design easier, Espressif provides different ESP32 modules with different configurations. Variable parameters for the modules are the ESP32 chip variant, external flash (4, 8, or 16 MB), external SRAM, and the antenna type. We can select among modules with a PCB antenna, or there is an external antenna option realized with the help of a U.FL/IPEX connector. On the ESP32-S2 side, we have only one module option as of the time of writing this book. Most of the time, it is enough to choose one of those modules in your projects. However, if you require a specific ESP32 chip, for example, one with high-temperature operation, then you need to use a corresponding chip variant such as ESP32-U4WDH and design your PCB accordingly. You can find available modules on the Espressif website here: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/index.html.

The following photo shows an ESP32-WROOM-32D module with an integrated onboard antenna:

Figure 1.2 – ESP32-WROOM-32D module

Figure 1.2 – ESP32-WROOM-32D module

As a development kit, we can find many boards from different vendors on the market. We can easily start to develop with such a kit without the need for the actual hardware design and prototype of the final product. All models integrate a USB-UART bridge chip and a USB port, so we only need to plug the kit into our development PC to flash and test the firmware:

Figure 1.3 – DOIT ESP32 Devkit v1

Figure 1.3 – DOIT ESP32 Devkit v1

Following this introduction to the hardware, we can continue with the firmware development platforms and frameworks.

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 one, 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 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. But as I said, it is a command-line tool, so if you are a more graphical UI person, then you need to install Visual Studio Code and install an ESP-IDF extension in it. Here is the link to ESP-IDF: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html.

The second option is the Arduino IDE. As you might expect. Arduino provides its own library to work with ESP32 boards. If you have experience with the Arduino IDE, you know how easy it is to use. However, it comes at the cost of development flexibility compared to ESP-IDF. You are constricted in terms of what Arduino allows you to do and you need to obey its rules.

The third alternative you can choose is PlatformIO. This is not a standalone IDE or tool, but comes as an extension in Visual Studio Code as an open source embedded development environment. It supports many different embedded boards, platforms, and frameworks, including ESP32 boards and ESP-IDF. Following installation, it integrates itself with the VSCode UI, where you can find all the functionality that idf.py of ESP-IDF provides. In addition to VSCode IDE features, PlatformIO has an integrated debugger, unit testing support, static code analysis, and remote development tools for embedded programming. PlatformIO is a good choice for balancing ease of use and development flexibility.

The programming language for those three frameworks is C/C++, so you need to know C/C++ in order to develop within those frameworks. However, C/C++ is not the only programming language for ESP32. You can use MicroPython for Python programming or Espruino for JavaScript programming. They both support ESP32 boards, but to be honest, I wouldn't use them to develop any product to be launched on the market. Although you may feel more comfortable with them because of your programming language preferences, you won't find ESP-IDF capabilities in any of them.

RTOS options

Basically, an 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 the 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 an MIT license: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos.html.

If you want to connect your ESP32 to the Amazon Web Services (AWS) IoT infrastructure, you can do that by using Amazon FreeRTOS as your RTOS choice. ESP32 is in the AWS partner device catalog and officially supported. Amazon FreeRTOS has the necessary libraries to connect to the AWS IoT and other security-related features, such as TLS, OTA updates, secure communication with HTTPS, WebSockets, and MQTT, pretty much everything to develop a secure connected device: https://docs.aws.amazon.com/freertos/latest/userguide/getting_started_espressif.html.

Zephyr is another RTOS option with a permissive free software license, Apache 2.0. Zephyr requires an ESP32 toolchain and ESP-IDF installed on the development machine. Then, you need to configure Zephyr with them. When the configuration is ready, we use the command-line Zephyr tool, "west," for building, flash, monitoring, and debugging purposes: https://docs.zephyrproject.org/latest/boards/xtensa/esp32/doc/index.html.

The last RTOS that I want to share here is Mongoose OS. It provides a complete development environment with its web UI tool, mos. It has native integration with several cloud IoT platforms, namely, AWS IoT, Google IoT, Microsoft Azure, and IBM Watson, as well as any other IoT platform that supports MQTT or REST endpoints if you need a custom platform. Mongoose OS comes with two different licenses, one being an Apache 2.0 community edition, and the other an enterprise edition with a commercial license: https://mongoose-os.com/mos.html.

Summary

In this chapter, we covered all the necessary background information regarding the IoT technology and ESP32 as a hardware platform for developing IoT products.

To add value to our end users, we, as developers, should know the ground. It is not enough to come up with a solution; it has to be the right solution, which requires us to learn more about the technologies and tools available. When it comes to IoT technology, things may become more difficult because an IoT product has several components, starting from sensor/actuator devices to end user applications, allowing end users to interact with the solution. In this manner, learning ESP32 is an important professional skill to be acquired by an IoT developer.

Following the background information in this chapter, upcoming chapters are going to focus on how to use ESP32 effectively in our projects. With the help of practical examples and explanations, we will see different aspects of ESP32 for different use cases and apply them in the projects at the end of each part. We will begin by using sensors and actuators in the next chapter.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • 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

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.

Who is this book 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.

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

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 13, 2021
Length: 474 pages
Edition : 1st
Language : English
ISBN-13 : 9781838642808
Category :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning

Product Details

Publication date : Sep 13, 2021
Length: 474 pages
Edition : 1st
Language : English
ISBN-13 : 9781838642808
Category :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just zł20 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just zł20 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 680.97 714.97 34.00 saved
Practical Python Programming for IoT
zł209.99
Developing IoT Projects with ESP32
zł282.99
Mastering Embedded Linux Programming
zł187.99 zł221.99
Total 680.97 714.97 34.00 saved Stars icon

Table of Contents

16 Chapters
Section 1: Using ESP32 Chevron down icon Chevron up icon
Chapter 1: Getting Started with ESP32 Chevron down icon Chevron up icon
Chapter 2: Talking to the Earth – Sensors and Actuators Chevron down icon Chevron up icon
Chapter 3: Impressive Outputs with Displays Chevron down icon Chevron up icon
Chapter 4: A Deep Dive into the Advanced Features Chevron down icon Chevron up icon
Chapter 5: Practice – Multisensor for Your Room Chevron down icon Chevron up icon
Section 2: Local Network Communication Chevron down icon Chevron up icon
Chapter 6: A Good Old Friend – Wi-Fi Chevron down icon Chevron up icon
Chapter 7: Security First! Chevron down icon Chevron up icon
Chapter 8: I Can Speak BLE Chevron down icon Chevron up icon
Chapter 9: Practice – Making Your Home Smart Chevron down icon Chevron up icon
Section 3: Cloud Communication Chevron down icon Chevron up icon
Chapter 10: No Cloud, No IoT – Cloud Platforms and Services Chevron down icon Chevron up icon
Chapter 11: Connectivity Is Never Enough – Third-Party Integrations Chevron down icon Chevron up icon
Chapter 12: Practice – A Voice-Controlled Smart Fan Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Most Recent
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3
(11 Ratings)
5 star 54.5%
4 star 36.4%
3 star 0%
2 star 0%
1 star 9.1%
Filter icon Filter
Most Recent

Filter reviews by




GTZ2082 Aug 17, 2023
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
There is a sticker saying it is "Used - VG".
Amazon Verified review Amazon
Mr. Stephen J. Farthing May 31, 2022
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is absolutely the best book on ESP 32,IOT programming out there, and I’ve read a few. It uses PlatformIO and Visual Studio Code as the development environment which are both brilliant development tools for amateurs and professionals.My only problem is getting PlatformIO to work with the ESP32 toolset with my Raspberry Pi development system. I suspect Windows users won’t have a problem. I’d make sure that whatever development system you use is compatible before you buy the book.As a previous person wrote PlatformIO is a Ukrainian product. I’ve posted a few questions on their support forum and had pretty much instant answers. This is amazing considering I don’t pay for the product and the guys are in a war. When I was a professional developer I never had a better service
Amazon Verified review Amazon
Eugene C. Olsen Jan 22, 2022
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great book! Clear and easy to understand. Starts with the basics to establish a good foundation then moves into advanced topics. The first two chapters are worth the price of the book and there's so much more! WiFi, Bluetooth, security, cloud integration including interaction with Alexa.The Espressif IoT Development Framework offers a lot more granular control over the ESP32 and devices than the Arduino API.
Amazon Verified review Amazon
Ahmet Dec 13, 2021
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
In a nutshell, the book is more than enough to start with ESP32 if you know the basics of electronics and have some experience with programming. It explains the available toolchains, shows the peripheral communication, discusses wireless communication. And finally, it closes the circle with cloud communication.Let's come to the exciting part. The examples are so well that you learn what you exactly need in an ESP32 project. You may need to integrate a sensor, say an I2C device, you find an example in the book. You may need to start a WiFi access point and a webserver to provision your ESP32 device, again there is an example. You want a voice interface in your device, another example with Amazon Alexa is present. It also talks about the security aspects of an IoT project and how to achieve this with ESP32, including encryption techniques and firmware over-the-air updates. The book is a hands-on experience from the beginning till the end. As a note, be aware that the framework used in this book is ESP-IDF, not Arduino.In my view, debugging and testing deserve a designated chapter in such books, which I couldn't see in this one. The author mentions debugging briefly, but it would be beneficial for developers to discuss debugging and testing in more detail. That is why I give 4 out of 5.As a whole, this book provides the groundwork for any ESP32 project as promised and I recommend reading it thoroughly if you are new to this platform.
Amazon Verified review Amazon
Sunil Nov 28, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Excellent book with comprehensive coverage on developing IoT devices with ESP32 SOC. It broadly covers different range of IoT development which includes interfacing different sensors with different communication protocols (UART, I2C etc), dealing with Wireless technologies (WiFi. BLE), using FreeRTOS and most importantly about security side of IoT. Very easy to follow the steps through the projects with relevant images and code snippets.The author assumes that you are familiar with basic electronics and embedded development fundamentals. You might need to order few of the electronics components, which are readily available and cheap to buy for few of the projects mentioned out in the book. In terms of software, there’s good coverage of PlatformIO on VSCode, which is available on most major platforms.I really enjoyed the section that covers connecting ESP32 to AWS Cloud and other platforms. My other personal projects with BLE and voice controlled smart fan were fun too.Few things I would have liked here: I felt the need for some debugging guidelines to newbies using the JTAG/Serial. I would have also liked to see author talking little more about processor architecture and its ramifications when using FreeRTOS.Being an IoT enthusiast and having had the experience with working on ESP32 with mass producing IoT product, this book effectively gives new insights that are up to date and relevant, and I would surely recommend this to readers.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.