ESP32 β Development Guide
Last reviewed: 2026-09-17
The ESP32 is a low-cost, low-power system-on-chip (SoC) microcontroller with integrated Wi-Fi and Bluetooth, developed by Espressif Systems. It's widely used in IoT projects, embedded systems prototyping, and production devices.
Overview
The ESP32 is a dual-core Xtensa LX6 CPU running at up to 240 MHz, with 520 KB of SRAM, integrated 802.11 b/g/n Wi-Fi, Bluetooth 4.2 (BR/EDR + BLE), and a rich set of peripherals (SPI, IΒ²C, IΒ²S, UART, ADC, DAC, PWM, Hall sensor, temperature sensor). It's Arduino-compatible via the Arduino-ESP32 core and also fully supported in PlatformIO and ESP-IDF (Espressif's native SDK).
Topics Covered
Display β ST7789 TFT (240Γ240)
A key hands-on project: connecting a 1.3" 240Γ240 IPS TFT display with ST7789 controller to the ESP32 via SPI.
Pin roles:
| Signal | ESP32 GPIO | Function |
|---|---|---|
| VCC | 3.3V | Display logic power |
| GND | GND | Ground |
| BLK | 3.3V | Backlight (HIGH = on) |
| SCK | GPIO18 | SPI Clock |
| MOSI | GPIO23 | SPI Data out |
| DC | GPIO15 | Data/Command select |
| RST | GPIO27 | Hardware reset |
| CS | Not used (always selected) |
Key concepts: - SPI communication: ESP32 acts as master, clocks data out on MOSI with SCK - The DC pin differentiates commands from pixel data - No CS pin β display is permanently selected - Correct SPI mode (MODE 3) is critical - Adafruit_ST7789 + Adafruit_GFX libraries handle command sequencing
Wiring caution: Avoid GPIO12, GPIO0, GPIO2 as they affect boot mode. The pinout above uses all safe GPIOs.
MQTT IoT Telemetry Pipeline
The telemetry pipeline covered here is: - ESP8266/ESP32 as the sensor node - BMP280 temperature/pressure sensor - Mosquitto MQTT broker - Python subscriber on the backend
Architecture: Sensor β ESP32 β Wi-Fi β MQTT Broker β Python subscriber β data processing.
Servo Motor Control
A servo motor controlled via a rotary angle sensor on the ESP32: - Uses PWM (LEDC peripheral) to drive servo - Rotary sensor (potentiometer) read via ADC - Mapping sensor values to servo angles (0β180Β°)
Additional Reference Topics
- Display library setup β installing Adafruit_ST7789 / Adafruit_GFX under PlatformIO and the Arduino IDE
- Board pinouts β pin maps for the ESP8266/ESP32 dev boards usually paired with this display
- Panel datasheets β what to read off them: controller, resolution, supply voltage, SPI mode
Why ESP32?
- Built-in Wi-Fi/BT β no external modules needed
- Dual-core β run networking on one core, application on the other
- Deep sleep β microamps in sleep mode for battery-powered projects
- Arduino + PlatformIO β beginner-friendly toolchain
- ESP-IDF β production-grade SDK for advanced use
- Rich peripheral set β enough for most IoT and embedded projects
Getting Started
- Install PlatformIO in VS Code (or Arduino IDE + ESP32 board package)
- Wire your ESP32 to the ST7789 display using the pin table above
- Install Adafruit_ST7789 and Adafruit_GFX libraries
- Run a basic sketch that fills the screen with color
- Progress to text rendering, shapes, and sensor data display
Pin Safety Reminder
Some ESP32 GPIOs affect boot behavior: - GPIO0 β boot mode select (pull low for flash mode) - GPIO2 β strapping pin, must be high for normal boot - GPIO12 β flash voltage selection - GPIO15 β strapping pin (also used here for DC β safe post-boot)
Always use safe GPIOs for display and sensor connections.
To-do
Status: incomplete. Still to write:
- Write the ST7789 display section in full: a complete sketch (SPI init, ST7789 at SPI MODE 3, fill-screen, text and shapes) and the wiring diagram β currently only a pin table and concept bullets exist.
- Write the BMP280 β ESP32 β Mosquitto β Python subscriber telemetry pipeline end to end: firmware publish code plus the Python subscriber that consumes the topic.
- Write the servo control example: LEDC/PWM setup, ADC read of the rotary angle sensor, and the value mapping to 0β180Β°.
- Replace the 'Additional Reference Topics' list with real content: Adafruit_ST7789/Adafruit_GFX installation under PlatformIO and the Arduino IDE, the ESP8266/ESP32 board pinouts, and the panel datasheet values (controller, resolution, supply voltage, SPI mode).
- Add the display and sensor sections to 'Topics Covered' as written sections β the heading currently carries only pin roles and key concepts.