How to Program ESP32: Arduino, ESP-IDF, MicroPython, Rust & More
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:
| Your goal | Start with |
|---|---|
| First ESP32 project | Arduino |
| Production firmware and full control | ESP-IDF |
| Python and rapid prototyping | MicroPython |
| Rust development | Rust / esp-rs |
| Portable RTOS architecture | Zephyr |
| POSIX/ANSI-oriented embedded RTOS | NuttX |
| Home Assistant device | ESPHome |

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.

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.
What should you read next?
If you have not chosen an ESP32 device yet, see our ESP32 Family Comparison.
If you are comparing two popular newer families, read ESP32-S3 vs ESP32-C5.
If you are deciding between Espressif and STM32, see ESP32 vs STM32.
For commercial firmware architecture, board bring-up, drivers, connectivity or production debugging, see our Embedded Firmware Development Services.
Official references
Technical details should be checked against the latest documentation for the exact ESP32 device and software version used in your project.
Related articles
Embedded & Firmware
ESP32 Family Comparison 2026: Which ESP32 Should You Choose?
Choose by radio, workload and product constraints: a practical guide to ESP32-S3, C3, C5, C6, C61, H2, P4 and S31, with H4 and original ESP32 context.
Read article →Embedded & Firmware
ESP32-S3 vs ESP32-C5: Which Should You Choose in 2026?
Compare ESP32-S3 vs ESP32-C5 for CPU, USB, Wi-Fi 6, 5 GHz, Thread, Zigbee, Matter, memory and real embedded product use.
Read article →Embedded & Firmware
ESP32 vs STM32 in 2026: Which Microcontroller Should You Choose?
ESP32 or STM32? Compare connectivity, performance, power, peripherals, security and development workflows to choose the right MCU for your product.
Read article →