Introduction
Author’s Note
How to use this book?
Preparation
1.
Introduction to IoT
1.1.
Architecture of IoT
1.2.
IoT Application in Smart Homes
2.
Introduction and Practice of IoT Projects
2.1.
Introduction to Typical IoT Projects
2.1.1.
Basic Modules for Common IoT Devices
2.1.2.
Basic Modules of Client Applications
2.1.3.
Introduction to Common IoT Cloud Platforms
2.2.
🧐 Practice: Smart Light Project
2.2.1.
Project Structure
2.2.2.
Project Functions
2.2.3.
Hardware Preparation
2.2.4.
Development Process
2.3.
Summary
3.
Introduction to ESP RainMaker
3.1.
What is ESP RainMaker?
3.2.
The Implementation of ESP RainMaker
3.2.1.
Claiming Service
3.2.2.
RainMaker Agent
3.2.3.
Cloud Backend
3.2.4.
RainMaker Client
3.3.
🧐 Practice: Key Points for Developing with ESP RainMaker
3.4.
Features of ESP RainMaker
3.4.1.
User Management
3.4.2.
End User Features
3.4.3.
Admin Features
3.5.
Summary
4.
Setting Up Development Environment
4.1.
ESP-IDF Overview
4.1.1.
ESP-IDF Versions
4.1.2.
ESP-IDF Git Workflow
4.1.3.
Choosing a Suitable Version
4.1.4.
Overview of ESP-IDF SDK Directory
4.2.
Setting Up ESP-IDF Development Environment
4.2.1.
Setting up ESP-IDF Development Environment on Linux
4.2.2.
Setting up ESP-IDF Development Environment on Windows
4.2.3.
Setting up ESP-IDF Development Environment on Mac
4.2.4.
Installing VS Code
4.2.5.
Introduction to Third-Party Development Environments
4.3.
ESP-IDF Compilation System
4.3.1.
Basic Concepts of Compilation System
4.3.2.
Project File Structure
4.3.3.
Default Build Rules of the Compilation System
4.3.4.
Introduction to the Compilation Script
4.3.5.
Introduction to Common Commands
4.4.
🧐 Practice: Compiling Example Program “Blink”
4.4.1.
Example Analysis
4.4.2.
Compiling the Blink Program
4.4.3.
Flashing the Blink Program
4.4.4.
Serial Port Log Analysis of the Blink Program
4.5.
Summary
Hardware and Driver Development
5.
Hardware Design of Smart Light Products based on ESP32-C3
5.1.
Features and Composition of Smart Light Products
5.2.
Hardware Design of ESP32-C3 Core System
5.2.1.
Power Supply
5.2.2.
Power-on Sequence and System Reset
5.2.3.
SPI Flash
5.2.4.
Clock Source
5.2.5.
RF and Antenna
5.2.6.
Strapping Pins
5.2.7.
GPIO and PWM Controller
5.3.
🧐 Practice: Building a Smart Light System with ESP32-C3
5.3.1.
Selecting Modules
5.3.2.
Configuring GPIOs of PWM Signals
5.3.3.
Downloading Firmware and Debugging Interface
5.3.4.
Guidelines for RF Design
5.3.5.
Guidelines for Power Supply Design
5.4.
Summary
6.
Driver Development
6.1.
Driver Development Process
6.2.
ESP32-C3 Peripheral Applications
6.3.
LED Driver Basics
6.3.1.
Color Spaces
6.3.2.
LED Driver
6.3.3.
LED Dimming
6.3.4.
Introduction to PWM
6.4.
LED Dimming Driver Development
6.4.1.
Non-Volatile Storage (NVS)
6.4.2.
LED PWM Controller (LEDC)
6.4.3.
LED PWM Programming
6.5.
🧐 Practice: Adding Drivers to Smart Light Project
6.5.1.
Button Driver
6.5.2.
LED Dimming Driver
6.6.
Summary
Wireless Communication and Control
7.
Wi-Fi Configuration and Connection
7.1.
Basics of Wi-Fi
7.1.1.
Introduction to Wi-Fi
7.1.2.
Evolution of IEEE 802.11
7.1.3.
Wi-Fi Concepts
7.1.4.
Wi-Fi Connection
7.2.
Basics of Bluetooth
7.2.1.
Introduction to Bluetooth
7.2.2.
Bluetooth Concepts
7.2.3.
Bluetooth Connection
7.3.
Wi-Fi Network Configuration
7.3.1.
Wi-Fi Network Configuration Guide
7.3.2.
SoftAP
7.3.3.
SmartConfig
7.3.4.
Bluetooth
7.3.5.
Other Methods
7.4.
Wi-Fi Programming
7.4.1.
Wi-Fi Components in ESP-IDF
7.4.2.
Exercise: Wi-Fi Connection
7.4.3.
Exercise: Smart Wi-Fi Connection
7.5.
🧐 Practice: Wi-Fi Configuration in Smart Light Project
7.5.1.
Wi-Fi Connection in Smart Light Project
7.5.2.
Smart Wi-Fi Configuration
7.6.
Summary
8.
Local Control
8.1.
Introduction to Local Control
8.1.1.
Application of Local Control
8.1.2.
Advantages of Local Control
8.1.3.
Discovering Controlled Devices through Smartphones
8.1.4.
Data Communication Between Smartphones and Devices
8.2.
Common Local Discovery Methods
8.2.1.
Broadcast
8.2.2.
Multicast
8.2.3.
Comparison Between Broadcast and Multicast
8.2.4.
Multicast Application Protocol mDNS for Local Discovery
8.3.
Common Communication Protocols for Local Data
8.3.1.
Transmission Control Protocol (TCP)
8.3.2.
HyperText Transfer Protocol (HTTP)
8.3.3.
User Datagram Protocol (UDP)
8.3.4.
Constrained Application Protocol (CoAP)
8.3.5.
Bluetooth Protocol
8.3.6.
Summary of Data Communication Protocols
8.4.
Guarantee of Data Security
8.4.1.
Introduction to Transport Layer Security (TLS)
8.4.2.
Introduction to Datagram Transport Layer Security (DTLS)
8.5.
🧐 Practice: Local Control in Smart Light Project
8.5.1.
Creating a Wi-Fi-based Local Control Server
8.5.2.
Verifying Local Control Functionality using Scripts
8.5.3.
Creating a Bluetooth-based Local Control Server
8.6.
Summary
9.
Cloud Control
9.1.
Introduction to Remote Control
9.2.
Cloud Data Communication Protocols
9.2.1.
MQTT Introduction
9.2.2.
MQTT Principles
9.2.3.
MQTT Message Format
9.2.4.
Protocol Comparison
9.2.5.
Setting Up MQTT Broker on Linux and Windows
9.2.6.
Setting Up MQTT Client Based on ESP-IDF
9.3.
Ensuring MQTT Data Security
9.3.1.
Meaning and Function of Certificates
9.3.2.
Generating Certificates Locally
9.3.3.
Configuring MQTT Broker
9.3.4.
Configuring MQTT Client
9.4.
🧐 Practice: Remote Control through ESP RainMaker
9.4.1.
ESP RainMaker Basics
9.4.2.
Node and Cloud Backend Communication Protocol
9.4.3.
Communication between Client and Cloud Backend
9.4.4.
User Roles
9.4.5.
Basic Services
9.4.6.
Smart Light Example
9.4.7.
RainMaker App and Third-Party Integrations
9.5.
Summary
10.
Smartphone App Development
10.1.
Introduction to Smartphone App Development
10.1.1.
Overview of Smartphone App Development
10.1.2.
Structure of the Android Project
10.1.3.
Structure of the iOS Project
10.1.4.
Lifecycle of an Android Activity
10.1.5.
Lifecycle of iOS ViewController
10.2.
Creating a New Smartphone App Project
10.2.1.
Preparing for Android Development
10.2.2.
Creating a New Android Project
10.2.3.
Adding Dependencies for MyRainmaker
10.2.4.
Permission Request in Android
10.2.5.
Preparing for iOS Development
10.2.6.
Creating a New iOS Project
10.2.7.
Adding Dependencies for MyRainmaker
10.2.8.
Permission Request in iOS
10.3.
Analysis of the App’s Functional Requirements
10.3.1.
Analysis of the Project’s Functional Requirements
10.3.2.
Analysis of User Management Requirements
10.3.3.
Analysis of Device Provisioning and Binding Requirements
10.3.4.
Analysis of Remote-Control Requirements
10.3.5.
Analysis of Scheduling Requirements
10.3.6.
Analysis of User Center Requirements
10.4.
Development of User Management
10.4.1.
Introduction to RainMaker APIs
10.4.2.
Initiating Communication via Smartphone
10.4.3.
Account Registration
10.4.4.
Account Login
10.5.
Development of Device Provisioning
10.5.1.
Scanning Devices
10.5.2.
Connecting Devices
10.5.3.
Generating Secret Keys
10.5.4.
Getting Node ID
10.5.5.
Provisioning Devices
10.6.
Development of Device Control
10.6.1.
Binding Devices to Cloud Accounts
10.6.2.
Getting a List of Devices
10.6.3.
Getting Device Status
10.6.4.
Changing Device Status
10.7.
Development of Scheduling and User Center
10.7.1.
Implementing Scheduling Function
10.7.2.
Implementing User Center
10.7.3.
More Cloud APIs
10.8.
Summary
11.
Firmware Upgrade and Version Management
11.1.
Firmware Upgrade
11.1.1.
Overview of Partition Tables
11.1.2.
Firmware Boot Process
11.1.3.
Overview of the OTA Mechanism
11.2.
Firmware Version Management
11.2.1.
Firmware Marking
11.2.2.
Rollback and Anti-Rollback
11.3.
🧐 Practice: Over-the-air (OTA) Example
11.3.1.
Upgrade Firmware Through a Local Host
11.3.2.
Upgrade Firmware Through ESP RainMaker
11.4.
Summary
Optimisation and Mass Production
12.
Power Management and Low-Power Optimisation
12.1.
ESP32-C3 Power Management
12.1.1.
Dynamic Frequency Scaling
12.1.2.
Power Management Configuration
12.2.
ESP32-C3 Low-Power Mode
12.2.1.
Modem-sleep mode
12.2.2.
Light-sleep Mode
12.2.3.
Deep-sleep mode
12.2.4.
Current Consumption in Different Power Modes
12.3.
Power Management and Low-Power Debugging
12.3.1.
Log Debugging
12.3.2.
GPIO Debugging
12.4.
Practice: Power Management in Smart Light Project
12.4.1.
Configuring Power Management Feature
12.4.2.
Use Power Management Locks
12.4.3.
Verifying Power Consumption
12.5.
Summary
13.
Enhanced Device Security Features
13.1.
Overview of IoT Device Data Security
13.1.1.
Why Securing IoT Device Data?
13.1.2.
Basic Requirements for IoT Device Data Security
13.2.
Data Integrity Protection
13.2.1.
Introduction to Integrity Verification Method
13.2.2.
Integrity Verification of Firmware Data
13.2.3.
Example
13.3.
Data Confidentiality Protection
13.3.1.
Introduction to Data Encryption
13.3.2.
Introduction to Flash Encryption Scheme
13.3.3.
Flash Encryption Key Storage
13.3.4.
Working Mode of Flash Encryption
13.3.5.
Flash Encryption Process
13.3.6.
Introduction to NVS Encryption
13.3.7.
Examples of Flash Encryption and NVS Encryption
13.4.
Data Legitimacy Protection
13.4.1.
Introduction to Digital Signature
13.4.2.
Overview of Secure Boot Scheme
13.4.3.
Introduction to Software Secure Boot
13.4.4.
Introduction to Hardware Secure Boot
13.4.5.
Examples
13.5.
Practice: Security Features In Mass Production
13.5.1.
Flash Encryption and Secure Boot
13.5.2.
Enabling Flash Encryption and Secure Boot with Batch Flash Tools
13.5.3.
Enabling Flash Encryption and Secure Boot in Smart Light Project
13.6.
Summary
14.
Firmware Burning and Testing for Mass Production
14.1.
Firmware Burning in Mass Production
14.1.1.
Defining Data Partitions
14.1.2.
Firmware Burning
14.2.
Mass Production Testing
14.3.
Practice: Mass Production Data in Smart Light Project
14.4.
Summary
15.
ESP Insights: Remote Monitoring Platform
15.1.
Introduction to ESP Insights
15.2.
Getting Started with ESP Insights
15.2.1.
Getting Started with ESP Insights in the esp-insights Project
15.2.2.
Running Example in the esp-insights Project
15.2.3.
Reporting Coredump Information
15.2.4.
Customising Logs of Interest
15.2.5.
Reporting Reboot Reason
15.2.6.
Reporting Custom Metrics
15.3.
Practice: Using ESP Insights in Smart Light Project
15.4.
Summary
Light (default)
Rust
Coal
Navy
Ayu
ESP32-C3 Wireless Adventure: A Comprehensive Guide to IoT
Data Integrity Protection
Introduction to Integrity Verification Method
Integrity Verification of Firmware Data
Example