EpicMicrodev

How to Program ESP32: Arduino, ESP-IDF, MicroPython, Rust & More

Epic Micro Dev6 min read
In This Article

There is more than one way to program an ESP32.

You can use Arduino, ESP-IDF, MicroPython, Rust, Zephyr, NuttX or ESPHome depending on your experience, product requirements and development workflow.

The important thing is that these are not all the same type of tool.

  • Languages include C, C++, Python and Rust.
  • Frameworks, runtimes and RTOSes include ESP-IDF, Arduino Core, MicroPython, Zephyr and NuttX.
  • Development tools include Arduino IDE, VS Code, PlatformIO and command-line tools.

If you only want the quick answer:

Choose an ESP32 programming approach
Your goalStart with
First ESP32 projectArduino
Production firmware and full controlESP-IDF
Python and rapid prototypingMicroPython
Rust developmentRust / esp-rs
Portable RTOS architectureZephyr
POSIX/ANSI-oriented embedded RTOSNuttX
Home Assistant deviceESPHome
ESP32 programming ecosystem showing Arduino, ESP-IDF, MicroPython, Rust, Zephyr, NuttX, ESPHome and development tools
Figure 1. The main ESP32 programming approaches and the difference between languages, firmware frameworks/runtimes and development tools.

Language, framework and IDE are different

This is one of the most common sources of confusion when starting with ESP32.

A programming language is what you write code in, such as C++, Python or Rust.

A framework or runtime provides the APIs and software environment used by the application. Examples include ESP-IDF, Arduino Core and MicroPython.

A development environment is the tooling used to edit, build, flash or debug the project.

For example:

Arduino vs ESP-IDF is mainly a framework decision. Arduino IDE vs VS Code or PlatformIO is mainly a tooling decision.

PlatformIO is a third-party embedded development environment. It can be used with ESP32 frameworks such as Arduino and ESP-IDF, but it is not itself another ESP32 firmware framework.

1. ESP-IDF

ESP-IDF is Espressif's official development framework for the ESP32 family.

It primarily uses C and C++ and gives developers access to the full ESP32 software stack, including networking, peripherals, FreeRTOS, security, partitions, OTA updates, power management, logging and debugging.

It has a steeper learning curve than Arduino, but it offers much more control over how a production device behaves.

Best for: commercial firmware, complex embedded products and projects that need full ESP32 control.

Choose ESP-IDF if: you are building a product that is expected to move beyond a quick prototype.

2. Arduino Core for ESP32

Arduino is usually the easiest route for a first ESP32 project.

It uses C/C++ with familiar Arduino-style APIs and has a large ecosystem of libraries for sensors, displays, networking and other hardware.

You do not have to use Arduino IDE to use the Arduino framework. Arduino projects can also be developed with other compatible tooling.

Arduino can also run as a component inside an ESP-IDF project, allowing developers to combine Arduino APIs with ESP-IDF features.

Best for: beginners, education, prototypes and simpler connected devices.

Choose Arduino if: you want to get a project working quickly.

3. MicroPython

MicroPython lets you program supported ESP32 devices using Python.

It provides an interactive REPL and a much faster edit-test cycle than traditional compiled firmware, which makes it useful for experimentation and hardware validation.

MicroPython supports common ESP32 functionality such as GPIO, UART, SPI, I2C and Wi-Fi on supported devices.

The trade-off is that interpreted Python generally provides less performance and tighter resource efficiency than native C/C++ firmware.

Best for: Python developers, learning, experiments and rapid prototypes.

Choose MicroPython if: speed of development matters more than maximum low-level control.

4. Rust

ESP32 devices can also be programmed using Rust through the ESP Rust ecosystem, including projects such as esp-hal.

Rust is attractive to embedded developers because of its memory-safety model, strong type system and modern tooling.

The ecosystem supports bare-metal embedded development across many ESP32-family devices, although some advanced or less common features can still vary in maturity.

Best for: Rust teams and memory-safety-focused embedded development.

Choose Rust if: your team already uses Rust or specifically wants a Rust-based firmware architecture.

5. Zephyr RTOS

Zephyr is an open-source real-time operating system with support for a large number of microcontroller families, including many ESP32 boards.

It provides features such as drivers, threads, networking, device tree and Kconfig-based configuration.

Its main advantage is portability: firmware architecture can potentially span ESP32 and hardware from other MCU vendors.

Best for: multi-platform RTOS products and teams already using Zephyr.

Choose Zephyr if: portability across several MCU families is an important requirement.

6. Apache NuttX

Apache NuttX is another RTOS available for embedded development.

It focuses on a small footprint and standards compliance, with POSIX and ANSI standards forming a major part of its programming model.

It is powerful, but it is usually not the simplest starting point for someone new to ESP32.

Best for: standards-oriented embedded systems and teams already familiar with NuttX.

7. ESPHome

ESPHome takes a different approach.

Instead of manually writing most of the firmware, you normally describe the device using YAML configuration.

ESPHome uses Python during configuration and code generation, while generated C++ code runs on the microcontroller.

It is particularly popular for devices integrated with Home Assistant.

Best for: smart-home sensors, switches, relays and Home Assistant devices.

Choose ESPHome if: the goal is home automation rather than building a general-purpose embedded firmware platform.

Decision guide for choosing Arduino, ESP-IDF, MicroPython, Rust, Zephyr, NuttX or ESPHome for ESP32
Figure 2. A quick decision guide for choosing an ESP32 programming approach based on your project and development goals.

Which ESP32 programming method should you choose?

For most developers, the decision can be simplified to this:

  • Beginner or quick prototype → Arduino
  • Professional or production firmware → ESP-IDF
  • Python developer or rapid experiment → MicroPython
  • Rust-based project → Rust / esp-rs
  • Portable RTOS architecture → Zephyr
  • POSIX/ANSI-oriented RTOS → NuttX
  • Home Assistant device → ESPHome

There is no single best way to program an ESP32.

The right choice depends on the required hardware control, development speed, team experience, product lifecycle and whether the firmware must support other hardware platforms later.

For many commercial ESP32 products, ESP-IDF is the safest default starting point because it is Espressif's official framework and exposes the complete ESP32 software stack.

Arduino and MicroPython remain excellent choices when simplicity and rapid development matter more than low-level control.

Official references