Skip to content

CdxCoder/esp32-downg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 

Repository files navigation

ESP32 Arduino Development Guide

Comprehensive guide for ESP32 development with Arduino IDE - covering partition schemes, model selection, and best practices for optimizing flash memory usage.

πŸ“š Documentation

This repository contains detailed guides to help you get the most out of your ESP32 projects:

Learn how to properly configure ESP32 partition schemes to optimize flash memory usage between your application code and file system storage.

Topics covered:

  • What are partition schemes and why they matter
  • Available partition schemes in Arduino IDE
  • How to select the right scheme for your project
  • OTA (Over-The-Air) update configurations
  • Custom partition tables
  • File system options (SPIFFS, LittleFS, FAT)
  • Best practices and troubleshooting

Comprehensive comparison of all ESP32 variants to help you choose the right model for your project.

Models covered:

  • ESP32 (original) - The proven workhorse
  • ESP32-S2 - Security and USB focused
  • ESP32-S3 - Flagship with AI acceleration
  • ESP32-C3 - Cost-effective RISC-V
  • ESP32-C6 - Matter/Thread ready
  • ESP32-H2 - Zigbee/Thread specialist

Includes:

  • Detailed specifications comparison
  • Feature matrix and capabilities
  • Use case recommendations
  • Power consumption analysis
  • Popular development boards

Complete guide to the recommended ESP32 Arduino library with installation, configuration, and optimization tips.

Topics covered:

  • Why arduino-esp32 by Espressif is the best choice
  • Step-by-step installation guide (Arduino IDE & PlatformIO)
  • Version management and update strategies
  • Library features and capabilities
  • Performance optimization techniques
  • Best practices for production use
  • Common issues and troubleshooting

Balanced guidance on when Arduino-ESP32 falls short compared to ESP-IDF, with a comparison table, decision checklist, and tips on when Arduino is still the right fit.

πŸš€ Quick Start

1. Choose Your ESP32 Model

Not sure which ESP32 to use? Check our ESP32 Models Overview for recommendations:

  • Beginner projects: ESP32 or ESP32-C3
  • General purpose: ESP32-S3 (best all-around)
  • Budget projects: ESP32-C3
  • AI/ML projects: ESP32-S3
  • Smart home (future): ESP32-C6 (Matter support)
  • Audio projects: ESP32 (Bluetooth Classic)

2. Install the Arduino Library

Follow our Arduino Library Guide to install arduino-esp32 by Espressif:

Arduino IDE β†’ File β†’ Preferences β†’ Additional Boards Manager URLs:
https://espressif.github.io/arduino-esp32/package_esp32_index.json

Tools β†’ Board β†’ Boards Manager β†’ Search "esp32" β†’ Install

3. Configure Partition Scheme

Select the appropriate partition scheme based on your needs (detailed guide):

Arduino IDE β†’ Tools β†’ Partition Scheme β†’ [Select scheme]

Common selections:

  • Default 4MB with SPIFFS - Balanced for most projects
  • Minimal SPIFFS - Large applications
  • Huge APP - Very large applications (3MB)
  • Default with OTA - Production devices with remote updates

πŸ’‘ Key Concepts

Memory Management

ESP32 flash memory typically ranges from 4MB to 16MB, divided between:

  • App partition: Your compiled Arduino sketch
  • File system: SPIFFS/LittleFS/FAT for data storage
  • OTA partitions: For Over-The-Air firmware updates
  • System: NVS, bootloader, partition table

Choosing a Partition Scheme

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Quick Decision Guide                            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Need OTA updates?                               β”‚
β”‚ └─ Yes β†’ Choose scheme with "OTA" in name       β”‚
β”‚                                                 β”‚
β”‚ App size > 1.5MB?                               β”‚
β”‚ └─ Yes β†’ Choose "Huge APP" or "Minimal SPIFFS" β”‚
β”‚                                                 β”‚
β”‚ Need large file storage?                        β”‚
β”‚ └─ Yes β†’ Choose "No OTA (2MB APP/2MB SPIFFS)"  β”‚
β”‚                                                 β”‚
β”‚ Standard project?                               β”‚
β”‚ └─ Default 4MB with SPIFFS                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“Š Space Optimization Tips

1. Check Current Usage

void printSpaceInfo() {
  Serial.printf("Sketch Size: %d bytes\n", ESP.getSketchSize());
  Serial.printf("Free Sketch Space: %d bytes\n", ESP.getFreeSketchSpace());
  Serial.printf("Flash Size: %d bytes\n", ESP.getFlashChipSize());
}

2. File System Usage

#include <SPIFFS.h>

void checkFileSystem() {
  if(SPIFFS.begin(true)) {
    Serial.printf("Total: %d bytes\n", SPIFFS.totalBytes());
    Serial.printf("Used: %d bytes\n", SPIFFS.usedBytes());
  }
}

3. Optimize Code Size

  • Use F() macro for string constants
  • Remove unused libraries
  • Enable compiler optimization
  • Choose appropriate partition scheme

🎯 Use Case Examples

IoT Sensor (Small App, Minimal Storage)

Model: ESP32-C3
Library: arduino-esp32 3.0.x
Partition: Minimal SPIFFS (1.9MB APP/190KB SPIFFS)

Web Server with Files

Model: ESP32 or ESP32-S3
Library: arduino-esp32 3.0.x
Partition: Default 4MB with SPIFFS (1.2MB APP/1.5MB SPIFFS)

Production IoT Device

Model: ESP32-S3
Library: arduino-esp32 3.0.x
Partition: Default 4MB with OTA (dual partition for updates)

Machine Learning Application

Model: ESP32-S3 (with AI acceleration)
Library: arduino-esp32 3.0.x
Partition: Huge APP (3MB No OTA/1MB SPIFFS)

Data Logger

Model: ESP32
Library: arduino-esp32 3.0.x
Partition: No OTA (2MB APP/2MB SPIFFS)
Plus: External SD card for extended storage

πŸ› οΈ Troubleshooting

"Sketch too big" Error

Upload Failed

Out of Memory

  • This is RAM, not flash - different from partition schemes
  • Optimize heap usage
  • Consider ESP32 models with more RAM or PSRAM support

πŸ“ Best Practices Summary

βœ… Choose the right ESP32 model for your requirements
βœ… Use the official arduino-esp32 library by Espressif
βœ… Select appropriate partition scheme before first upload
βœ… Enable OTA for production devices that need remote updates
βœ… Leave 20-30% headroom in app partition for future growth
βœ… Use SPIFFS/LittleFS for small files, SD cards for large data
βœ… Test thoroughly before deploying to production
βœ… Erase flash when changing partition schemes

πŸ”— Additional Resources

Official Documentation

Learning Resources

Tools

🀝 Contributing

Found an error or want to improve the documentation? Contributions are welcome! Please feel free to submit issues or pull requests.

πŸ“„ License

This documentation is provided as-is for educational purposes. ESP32 and related trademarks are property of Espressif Systems.


Last Updated: December 2025

For detailed information, explore the documentation files in the docs/ directory.

About

Guide how to use proper FS and ESP32 Arduino library

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published