GPIO
Browse / ESP32 Cheatsheet
ESP32 Cheatsheet
A comprehensive cheat sheet covering essential information about the ESP32 microcontroller, its pinout, programming, and common functionalities. Perfect for quick reference during development.
ESP32 Pinout and Specifications
Pin Configuration
|
|
General Purpose Input/Output pins. Configurable for various functions. |
|
ADC1 & ADC2 |
Analog-to-Digital Converter channels for reading analog signals. |
|
DAC1 & DAC2 |
Digital-to-Analog Converter channels for generating analog signals. |
|
I2C SDA & SCL |
Serial Data (SDA) and Serial Clock (SCL) pins for I2C communication. |
|
SPI MOSI, MISO, CLK, CS |
Master Out Slave In (MOSI), Master In Slave Out (MISO), Clock (CLK), Chip Select (CS) pins for SPI communication. |
|
UART TX & RX |
Transmit (TX) and Receive (RX) pins for UART communication. |
|
EN |
Enable pin. Pull low to disable/reset the ESP32. |
|
RST |
Reset pin. Active low reset. |
Key Specifications
|
CPU |
Tensilica LX6 Dual-Core Processor |
|
Clock Speed |
Up to 240 MHz |
|
Flash Memory |
4MB or more (external) |
|
SRAM |
520 KB |
|
Wi-Fi |
802.11 b/g/n |
|
Bluetooth |
Bluetooth v4.2 BR/EDR and BLE |
|
Operating Voltage |
3.3V |
|
Power Consumption |
Varies, ~80mA typical |
Power Pins
|
VCC |
3.3V power supply |
|
GND |
Ground |
|
VIN |
Voltage Input (e.g., from USB or battery) |
Programming with Arduino IDE
Setting up Arduino IDE
|
Basic Code Structure
|
Common Functions
|
`pinMode(pin, mode)` |
Sets the specified pin to either |
|
`digitalWrite(pin, value)` |
Writes either |
|
`digitalRead(pin)` |
Reads the value ( |
|
`analogRead(pin)` |
Reads the analog value from the specified analog pin (ADC). |
|
`analogWrite(pin, value)` |
Writes an analog value (PWM wave) to a pin (DAC). |
|
`Serial.begin(baudRate)` |
Initializes serial communication at the specified baud rate. |
|
`Serial.print(data)` |
Prints data to the serial port. |
Wi-Fi and Bluetooth Connectivity
Connecting to Wi-Fi
|
Using Bluetooth
|
Wi-Fi Functions
|
`WiFi.begin(ssid, password)` |
Connects to the specified Wi-Fi network. |
|
`WiFi.status()` |
Returns the current Wi-Fi connection status. |
|
`WiFi.localIP()` |
Returns the IP address of the ESP32. |
|
`WiFi.macAddress()` |
Returns the MAC address of the ESP32. |
Bluetooth Functions
|
`SerialBT.begin(deviceName)` |
Initializes Bluetooth serial communication with a given device name. |
|
`SerialBT.available()` |
Returns the number of bytes available to read from the Bluetooth serial port. |
|
`SerialBT.read()` |
Reads a byte from the Bluetooth serial port. |
|
`SerialBT.write(data)` |
Writes data to the Bluetooth serial port. |
Deep Sleep and Power Management
Entering Deep Sleep
|
Wake-up Sources
|
Timer Wakeup |
Wake up after a specified time interval. |
|
External Wakeup (GPIO) |
Wake up when a specific GPIO pin changes state (high or low). |
|
Touch Wakeup |
Wake up when a touch sensor is activated. |
Power Saving Tips
|