This book focuses on communication protocols for the ESP32 microcontroller with illustrative projects ranging from a Bluetooth Low Energy beacon communicating with your smart wristwatch to LoRa (Long Range) communication between microsatellites circling 550km above the Earth and an ESP32 microcontroller in your home. The advantages of each communication protocol correspond to different project types. For example, the I2S (Inter-Integrated circuit Sound) protocol manages digital audio for internet radio, while the WebSocket protocol enables two-way real-time communication between an ESP32 microcontroller and a webpage for control of remote devices.
Just as there are different communication protocols, there are different ESP32 microcontroller formats. The ESP32 microcontroller provides the platform for the ESP32 LoRa module for long-range communication, the ESP32-CAM camera module for image streaming to a webpage on an Android tablet or mobile phone and an ESP32-based programmable watch incorporating a GPS unit for route tracking, a Bluetooth module, an infrared transmitter and Wi-Fi communication to source information over the internet. One ESP32 module incorporates an LCD screen, a microphone and a speaker, which is ideal for an internet radio, as well as an accelerometer and gyroscope to trigger the display of specific information or an action.
Each chapter focuses on a communication protocol and is stand-alone, so they can be read without having to start from the beginning of the book. The chapters are loosely grouped into short- and long-range communication, image management for transmission to a webpage or a remote LCD screen and the required apps and IoT techniques for remote control of an ESP32-CAM robot vehicle.
Although Wi-Fi communication is incorporated in many internet-based applications, knowledge of alternative communication protocols is vital for optimal project development with a microcontroller, such as the ESP32. Information on the features of several ESP32 microcontroller formats enables the optimal combination of communication protocol and ESP32 format to achieve the requirements of a project. Several of the communication protocols and likewise, several of the ESP32 formats have only been available in the last few months or years, making the book very relevant.
What you'll learn
Who This Book Is For
A reader interested in understanding and recognizing the features of available communication protocols to then choose the appropriate protocol for a particular project. A level of C++ programming expertise with the Arduino IDE is assumed, although all sketches are comprehensively described and commented.
¿Neil Cameron is an experienced analyst and programmer with a deep interest in understanding the application of electronics. Neil wrote the books Arduino Applied: Comprehensive Projects for Everyday Electronics and Electronics Projects with the ESP8266 and ESP32: Building Web Pages, Applications, and WiFi Enabled Devices, which are published by Apress. He has previously taught at University of Edinburgh and Cornell University.
PREFACE
CHAPTER 1: ESP32 MICROCONTROLLER
USB to UART driver installation
Arduino IDE Boards Manager esp32 version 2.0.N
ESP32 DEVKIT DOIT
TTGO T-Display V1.1
Analog to digital conversion
TTGO LoRa32 V2.1 1.6
TTGO T-Watch V2
TTGO T-Watch installation
M5Stack Core2
M5Stack Core2 installation
M5Stack Core2 and sound
M5Stack Core2 M5G0 battery base
ESP32-CAM
ESP32-CAM-MB module
ESP32-CAM-CH340 module
Image resolution
Memory
Over The Air (OTA)
Software versions
CHAPTER: 2 I2S AUDIO
Analog to digital
Direct Memory Access
PDM microphone
Fast Fourier Transform
Digital to analog
PCM5102 decoder module
MAX98357 decoder module
Internet radio
Internet radio with ESP32 module
Audio data and Bluetooth
ESP32 to Bluetooth speaker
MP3 player
Play MP3 files from micro-SD card
Play MP3 files with M5Stack Core2
CHAPTER 3 : MESH COMMUNICATION
ESP-MESH
ESP-MESH and one Bluetooth device
ESP-MESH and several Bluetooth devices
CHAPTER 4: TTGO T-WATCH V2
Configuration file
Main sketch
Default display screen
Application menu
Screen brightness
GPS information
GPS satellite map
Bluetooth communication
Infrared signalling
Synchronisation with Network Time Protocol
Source OpenWeatherMap API data
Step counter and distance measure
Battery voltage and microcontroller temperature
Data storage on micro-SD card
Temperature, current and screen brightness
GPS tracking data
CHAPTER 5: BLE BEACONS
Eddystone beacons
Eddystone URL beacon
Eddystone TLM beacon
Eddystone UID beacon
iBeacon
Beacon raw data
BLE communication
GATT profile
Two-way communication
Notifications
nRF24L01 module as BLE transceiver
CHAPTER 6: LORA AND MICROSATELLITES
ESP32 as LoRa transmitter or receiver
ESP32 and LoRa satellites
Installation and configuration
Test station configuration and test message
Microsatellite tracking
CHAPTER 7: EMAIL AND QR CODES
QR codes
XML HTTP request
QR codes and XML HTTP request
QR codes and WebSocket
CHAPTER 8: WEBSOCKET, WEBSERIAL AND WEBDASHBOARD
WebSocket
WebSerial
Web Dashboard
CHAPTER 9: MQTT
Smart meter
MQTT and smart meter
Wi-Fi connection to router
ESP-NOW, MQTT and smart meter
Updating time
Wi-Fi or Wi-Fi and ESP-NOW
CO2 and TVOC
CO2 and TVOC with MQTT
CHAPTER 10: MANAGING IMAGES
Image bitmap
Display black and white image
Display colour image
Bitmap and X bitmap
Send image in email
Image URL in sketch
Display image as Sprite
LCD screen
M5Stack Core2 and accelerometer
Memory requirements
Display time with Sprites
Compress HTML code
CHAPTER 11: ESP32-CAM CAMERA
Stream images direct to LCD screen
Stream images to remote LCD screen
Stream images over Wi-Fi
WebSocket
esp_http_server
Webpage with image streaming and control functions
ESP32-CAM image resolution
CHAPTER 12: CONTROL APPS
app to display streamed images
app to transmit and receive data
app with image streaming and control functions
app sliders
Circular slider
Vertical slider
app to control WS2812 RGB LED
Bluetooth communication
Wi-Fi communication
CHAPTER 13: REMOTE CONTROL MOTORS
Servo motor
ledc function
app to control servo motor
DC motors
TB6612FNG motor driver board
L298N motor driver board
Motor driver control
app to control DC motors with heading angle
app with direction buttons
app with heading angle control
CHAPTER 15 LIBRARIES
TFT-eSPI library
Libraries used
Create a library
Source file
Header file
Keyword file
Information file