A lightweight serial command interface for controlling ESP32-S3 GPIO pins via serial communication. All command strings are stored in flash memory (PROGMEM) to maximize available RAM for additional commands and functionality.
- Board: Arduino Nano ESP32 (ESP32-S3)
- USB Connection: USB-C for power and serial communication
- Baud Rate: 115200
- ✅ Control GPIO pins via simple serial commands
- ✅ All command strings stored in flash memory (PROGMEM) to save RAM
- ✅ Built-in command validation and error handling
- ✅ Pin safety checks (avoids USB and UART pins)
- ✅ Interactive command prompt with echo
- ✅ System status information
- ✅ Case-insensitive commands
| Command | Description | Example |
|---|---|---|
pin <num> high |
Set pin to HIGH | pin 13 high |
pin <num> low |
Set pin to LOW | pin 13 low |
pin <num> read |
Read digital value from pin | pin 2 read |
pinmode <num> output |
Set pin mode to OUTPUT | pinmode 13 output |
pinmode <num> input |
Set pin mode to INPUT | pinmode 2 input |
status |
Show system status (heap, CPU, etc.) | status |
help |
Display help information | help |
- Arduino IDE 2.0+ or PlatformIO
- ESP32 board support installed
- Arduino Nano ESP32 board definitions
- Install the Arduino IDE from arduino.cc
- Add ESP32 board support:
- Go to File → Preferences
- Add to "Additional Board Manager URLs":
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json - Go to Tools → Board → Boards Manager
- Search for "esp32" and install "esp32 by Espressif Systems"
- Select your board: Tools → Board → esp32 → Arduino Nano ESP32
- Open the project folder in VS Code with PlatformIO extension
- PlatformIO will automatically detect the
platformio.iniconfiguration - Click "Build" or "Upload" in the PlatformIO toolbar
- Connect your Arduino Nano ESP32 via USB-C
- Open the sketch
esp32-serial-commander.ino - Select the correct port under Tools → Port
- Click Upload
- Open Serial Monitor at 115200 baud
- Start typing commands!
> pin 13 high
Pin 13: Set to HIGH
> pin 13 low
Pin 13: Set to LOW
> pinmode 2 input
Pin 2: Set to INPUT mode
> pin 2 read
Pin 2 = LOW
> status
=== System Status ===
Free Heap: 327680 bytes
Chip Model: ESP32-S3
CPU Frequency: 240 MHz
The following pins are reserved and cannot be used:
- GPIO 19, 20: USB communication
- GPIO 43, 44: UART communication
All other GPIO pins (0-48) can be controlled, but always refer to your board's pinout diagram for the best pins to use.
This project uses PROGMEM to store all command strings and help text in flash memory rather than RAM. This is crucial for ESP32 projects that need to scale up with many commands, as it preserves precious RAM for runtime operations.
Benefits:
- Command strings don't consume RAM
- More memory available for buffers and variables
- Easy to add many more commands without RAM concerns
To add new commands:
-
Define command strings in flash:
const char CMD_NEWCMD[] PROGMEM = "newcommand";
-
Add command parsing in
processCommand():if (compareProgmem(token, CMD_NEWCMD)) { // Your command logic here return; }
-
Update the help text in
HELP_TEXT
MIT License - See LICENSE file for details
Feel free to submit issues and pull requests!
Created for Arduino Nano ESP32 (ESP32-S3) development