Arduino IDE vs PlatformIO vs ESP-IDF vs MicroPython: Which ESP32 Environment Should You Use?

Last updated: 2026-11-22

Pick Arduino IDE if you are starting out and want the fastest first blink. Pick MicroPython if you know Python and want the fastest learning loop. Pick PlatformIO when your project grows past one board or one sketch. Pick ESP-IDF when you ship a product or need every feature the chip offers. The rest of this guide proves it: what each environment is, how setup, debugging, libraries, and speed compare, and the same blink and button program written in each one.

Table of contents

What is Arduino IDE?

Arduino IDE is the simplest way to program an ESP32: a free editor from Arduino, currently version 2.3.x, with one job: open a sketch, pick a board and a port, and upload. There is no project file, no build system, and no terminal to open. You write C++ with the Arduino functions you already know, and the IDE compiles it and flashes it.

Setup takes about ten minutes. Download Arduino IDE from the Arduino software page, then teach it about ESP32 boards: open File, Preferences, and paste Espressif's board manager URL, https://espressif.github.io/arduino-esp32/package_esp32_index.json, into the Additional boards manager URLs field. Open the Boards Manager, search for esp32, and install esp32 by Espressif Systems. Do not install Arduino ESP32 Boards by Arduino; that package only covers Arduino's own boards such as the Nano ESP32. The current Arduino-ESP32 core is 3.3.12, based on ESP-IDF 5.5.5. The full walkthrough, board by board, is in the Arduino IDE ESP32 setup guide.

Arduino IDE is best for a first board, a first sketch, a classroom, and any project that fits in one file. It holds one sketch per window and one board at a time, its Library Manager installs libraries globally, and there is no unit testing or per-project version pinning. When a library update breaks an old sketch, you find out at compile time.

What is PlatformIO?

PlatformIO is a professional build system that lives inside VS Code. It is free and open source, and the current release is PlatformIO Core 6.2.0. You still write Arduino C++ if you want to, but the project is defined by a text file called platformio.ini, which records the board, the framework, and every library version. The same project builds the same way on any computer, and you can keep the file in version control next to your code.

A minimal platformio.ini for a DevKit V1 looks like this:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200

Change framework = arduino to framework = espidf and the same project builds against Espressif's native framework instead. One project can hold several environments, so a DevKit V1, an S3 DevKitC-1, and a C3 SuperMini can all build from the same folder. Libraries are declared per project with lib_deps, and PlatformIO downloads the exact versions you named. The full walkthrough is in the PlatformIO ESP32 setup guide.

One version warning, because old tutorials get this wrong: before platform 8.x, the official PlatformIO platform topped out at 6.12.0 with Arduino core 2.0.17, and 3.x needed a community fork called pioarduino. Platform 8.0.0 ships Arduino core 3.3.12, and the sketch in this guide compiled against it. If a tutorial tells you to pin platform = [email protected], it is out of date.

PlatformIO is best when your project grows past one board, when you want reproducible builds or real debugging, or when you already live in VS Code. It costs about thirty minutes to set up the first time, and for a single blink sketch it is overkill.

What is ESP-IDF?

ESP-IDF is Espressif's own framework for the ESP32, written in C. It is the layer everything else sits on: the Arduino core is built on ESP-IDF, and PlatformIO can build ESP-IDF projects directly. With ESP-IDF you talk to the chip with no middleman, so every peripheral, every power mode, and every Wi-Fi and Bluetooth option is available, usually months before it reaches the Arduino core.

The current stable release is ESP-IDF 5.5. Install it with the ESP-IDF Installation Manager, or clone it with git clone -b v5.5 --recursive https://github.com/espressif/esp-idf.git and run ./install.sh. A project starts from the hello_world example, and the commands you will use most are idf.py set-target esp32, idf.py menuconfig, idf.py build, idf.py flash, and idf.py monitor. The menuconfig step opens a text menu for the chip, flash size, Wi-Fi settings, and hundreds of other options, and the VS Code ESP-IDF extension (version 2.0 or newer) finds your installation automatically. The full first project is in the ESP-IDF first project guide.

ESP-IDF is best for a product you will ship, for battery work where every milliamp matters, for code that needs the newest chip features, and for learning how the ESP32 really works. It is the hardest of the four: no single-click upload, no simplified pin functions, and a slower build. One measured comparison on an ESP32-S3 took 21.8 seconds for a clean ESP-IDF build against 5.9 seconds for the same blink in Arduino, but the firmware was the smallest of the four, 211,541 bytes against 288,426 for Arduino. Do not put spaces in your ESP-IDF project path; the build system does not support them.

What is MicroPython?

MicroPython is Python 3 running on the microcontroller itself. You flash the firmware onto the board once, and after that there is no compile step at all. You type Python at a live prompt called the REPL, and the board answers at once. You save your program as main.py, the board runs it at boot, and editing a line means copying the file again.

Setup takes about fifteen minutes. Download the firmware for your board from the MicroPython download page; the current release is 1.29, with 1.28 the release before it. Erase the flash with esptool.py erase_flash, then write the firmware with esptool.py --baud 460800 write_flash 0x1000 ESP32_GENERIC-20260406-v1.28.0.bin, using your own filename and port. Thonny can do the whole flash for you, and mpremote repl opens the prompt from a terminal. The full walkthrough is in the MicroPython ESP32 getting started guide.

MicroPython is best if you already know Python, if you are teaching, if you are prototyping a sensor or a web page, or if you want to test hardware by typing commands. It is not for hard real-time work or code that must run at full speed: Python on the board is interpreted, so tight loops run roughly 10 to 20 times slower than the same logic in C, and one benchmark measured a GPIO toggle at about 50 kHz in MicroPython against about 1 MHz in C++. The interpreter also takes RAM and flash, so big buffers and camera frames run out sooner, though boards with PSRAM give MicroPython far more headroom. For reading a sensor every few seconds or sending an MQTT message, the speed never matters. For bit-banging a fast protocol, it does.

The four environments at a glance

Arduino IDE PlatformIO ESP-IDF MicroPython
Language C++ (Arduino functions) C++ (Arduino or ESP-IDF) C Python 3
Editor Arduino IDE 2.3.x VS Code VS Code or terminal Thonny or VS Code
Setup time, first time About 10 minutes About 30 minutes About 30 to 60 minutes About 15 minutes
First blink Board URL, install core, upload New project, platformio.ini, upload Install IDF, set target, build, flash Flash firmware, save main.py
Debugging Serial Monitor, exception decoder Breakpoints, JTAG, variable watch Breakpoints, JTAG, GDB REPL, print, Thonny debugger
Libraries Global Library Manager Per-project lib_deps, pinned versions Components, IDF Component Manager micropython-lib, frozen modules
Multi-board projects One sketch, one board Several environments in one project One target per build One board per session
Unit tests No Yes, built in Yes, with Unity No, test by hand
Code speed Full speed Full speed Full speed, smallest firmware 10 to 20 times slower in tight loops
Learning curve Easiest Medium Steepest Easiest if you know Python
Best for First board, classroom Growing projects, teams Products, low power, new features Learning, prototyping, sensors
Not for Multi-board or versioned work A single quick blink A first project Hard real-time, fast bit-banging

How does debugging compare?

Debugging is where the four environments split most clearly. Arduino IDE gives you the Serial Monitor and the exception decoder, which prints a readable stack trace when your sketch crashes. Its built-in debugger exists, but for ESP32 it is limited: it is built on Cortex-Debug, which targets ARM Cortex cores, while the ESP32 uses Tensilica cores and the C3 and C6 use RISC-V. The ESP32-S3 can debug over its built-in USB JTAG connection, but the support that landed in Arduino IDE 2.3.0 was rough at first and still needs a compatible board definition. In practice, most ESP32 work in Arduino IDE is still Serial.print debugging.

PlatformIO and ESP-IDF debug properly. Both use OpenOCD and GDB over JTAG, so you can set breakpoints, step through code, and watch variables change. On the S3 the built-in USB JTAG works with no extra probe; on the original ESP32 you need an external JTAG adapter such as an ESP-Prog. This is the single biggest reason to move a stubborn project from Arduino IDE to PlatformIO: when Serial.print stops telling you enough, a breakpoint will.

MicroPython debugs differently. There is no compiled firmware to step through, so you debug by talking to the board: type a line at the REPL and see the answer, print values as the program runs, and use Thonny's debugger to step through Python lines. For sensor work this is often faster than a breakpoint.

How does library management compare?

Arduino IDE installs libraries globally through its Library Manager. That is simple until two projects want two versions of the same library, and then it is a problem, because there is only one installed copy. The library install guide shows both sides of this: the Arduino IDE steps and the PlatformIO steps, side by side.

PlatformIO pins every library in platformio.ini with lib_deps, so each project carries its own exact versions and a teammate gets the same build. ESP-IDF does the same with components and the IDF Component Manager, versioned against the ESP-IDF release you use. MicroPython has the smallest library story: the micropython-lib collection covers the common drivers, and anything unusual you write yourself in Python. For a project with more than a handful of dependencies, per-project pinning is the difference between a build that works twice and a build that works once.

How fast is the code in each environment?

Arduino, PlatformIO with the Arduino framework, and ESP-IDF all compile to native code, so they run at full speed. The difference between them is firmware size and build time, not runtime speed. One measured comparison on an ESP32-S3 built the same blink program three ways: Arduino took 5.9 seconds and produced 288,426 bytes, ESP-IDF took 21.8 seconds and produced 211,541 bytes, and MicroPython had no compile step, copying a 217-byte main.py onto a 1,783,296-byte firmware image.

MicroPython is the slow one at runtime, and you should know the size of the gap before you choose it. In tight loops it runs roughly 10 to 20 times slower than the same logic in C, and one benchmark measured a GPIO toggle at about 50 kHz in MicroPython against about 1 MHz in C++. Reading a temperature sensor every five seconds, serving a small web page, or sending an MQTT message never notices the gap, because the waiting time dwarfs the compute time. Bit-banging a fast protocol, driving WS2812 LEDs by hand, or sampling an ADC at high speed does notice it. MicroPython has two escapes for hot code: the @micropython.native and @micropython.viper decorators compile a function to machine code, and the hardware peripherals (PWM, SPI, I2C, UART, RMT) run at full speed in any language.

Memory follows the same pattern. The MicroPython interpreter and its heap take a share of the ESP32's RAM, so large buffers and big JSON documents run out sooner than in C. Boards with PSRAM give MicroPython far more headroom. The garbage collector can also pause your program briefly, which is one more reason MicroPython is not for hard real-time work.

Which one should you pick?

If you are… Pick… Because…
Holding your first ESP32 Arduino IDE Fastest first blink, most tutorials, least to learn; same functions if you come from an Uno
A Python programmer MicroPython No new language, instant REPL feedback
Teaching a class or a club Arduino IDE or MicroPython Both give a result in the first session
Prototyping a sensor or a web page MicroPython Edit and run in seconds, no compile wait
Growing past one board PlatformIO One project, several boards, pinned libraries
Working with a team PlatformIO Same build on every computer, version control friendly
Shipping a product ESP-IDF Every feature, smallest firmware, full control
Writing hard real-time code ESP-IDF or Arduino Native code, deterministic timing

If you are still unsure, start with Arduino IDE. It is the default for a reason, and everything you learn there transfers: the same sketch runs in PlatformIO, and the same C++ carries into ESP-IDF when you are ready.

Can you switch environments later?

Yes, and the cost depends on the direction. Arduino IDE to PlatformIO costs nothing: copy the sketch into a PlatformIO project, add a platformio.ini, and it compiles with the same core. An ESP-IDF project does not run in Arduino IDE, and a MicroPython script runs nowhere except on a MicroPython board. PlatformIO to ESP-IDF costs a rewrite, because ESP-IDF uses different APIs for Wi-Fi, GPIO, and tasks, although the C knowledge transfers. MicroPython to anything else costs a full rewrite in C or C++, because Python does not compile to native firmware.

The one switch to avoid is mixing environments in the same project without a plan. Pick one environment per project, keep its files together, and note the versions you used.

The same program in three environments

One program, three listings: it blinks the onboard LED on GPIO 2, watches a push button on GPIO 4, and prints a count each time the button is pressed. The button is wired from GPIO 4 to GND, with the internal pull-up holding the pin HIGH until the button pulls it LOW.

Arduino IDE and PlatformIO use the same C++ sketch. In Arduino IDE, save it as blink-button.ino and upload it. In PlatformIO, save it as src/main.cpp with #include <Arduino.h> at the top, plus the platformio.ini from the PlatformIO section above.

// Blink + button counter - Arduino-ESP32 core 3.x
// Board: ESP32 DevKit V1 (30-pin), onboard LED on GPIO 2, button on GPIO 4
// Wiring: one side of the push button to GPIO 4, the other side to GND.
const int LED_PIN = 2;      // onboard LED on the DevKit V1
const int BUTTON_PIN = 4;   // push button wired from GPIO 4 to GND
int pressCount = 0;
bool lastButtonState = HIGH;

void setup() {
  Serial.begin(115200);
  pinMode(LED_PIN, OUTPUT);
  pinMode(BUTTON_PIN, INPUT_PULLUP);  // button pulls the pin LOW when pressed
  Serial.println("Blink + button counter ready. Press the button.");
}

void loop() {
  digitalWrite(LED_PIN, HIGH);
  delay(500);
  digitalWrite(LED_PIN, LOW);
  delay(500);
  bool buttonState = digitalRead(BUTTON_PIN);
  if (buttonState == LOW && lastButtonState == HIGH) {
    pressCount++;
    Serial.print("Button pressed. Count: ");
    Serial.println(pressCount);
  }
  lastButtonState = buttonState;
}

This sketch compiled in PlatformIO 6.2.0 (espressif32 8.0.0, Arduino core 3.3.12) in 24.92 seconds: 6.7 percent of RAM, 20.5 percent of flash.

MicroPython does the same thing in Python. Save it as main.py on the board; it runs at boot, after boot.py. The REPL stays live, so you can type led.value(1) at the >>> prompt and turn the LED on by hand. This listing was not run on a board during the draft check; it is the same logic as the compiled C++ program above.

# Blink + button counter - MicroPython 1.28+ on ESP32 DevKit V1
# Onboard LED on GPIO 2, button on GPIO 4 wired to GND.
from machine import Pin
import time

led = Pin(2, Pin.OUT)
button = Pin(4, Pin.IN, Pin.PULL_UP)
press_count = 0
last_state = 1

print("Blink + button counter ready. Press the button.")
while True:
    led.value(1)
    time.sleep_ms(500)
    led.value(0)
    time.sleep_ms(500)
    state = button.value()
    if state == 0 and last_state == 1:
        press_count += 1
        print("Button pressed. Count:", press_count)
    last_state = state

ESP-IDF has no listing here: its version needs a full project with a CMake file and a sdkconfig, not a single pasted file. That is the point: ESP-IDF is a project, not a sketch. The ESP-IDF first project guide walks through its hello_world example.

What goes wrong?

Mistake What happens Fix
Installing "Arduino ESP32 Boards" in Arduino IDE Your DevKit board never appears in the board list Install "esp32 by Espressif Systems" from Espressif's board manager URL
Old core 2.x code on core 3.x "invalid conversion" and missing function errors Update the code to the 3.x APIs, or pin core 2.0.17 in a separate install
Forgetting erase_flash before MicroPython Old firmware or settings fight the new flash Run esptool.py erase_flash before the first flash
Overwriting boot.py in MicroPython The board can stop responding and need a reflash Leave boot.py alone; put your program in main.py
Spaces in an ESP-IDF project path The build fails with a path error Move the project to a path with no spaces
Expecting C speed from MicroPython A fast loop or bit-banged protocol misses timing Use hardware peripherals, @micropython.native, or switch to C
Using a charge-only USB cable The board powers on but the port never appears Use a data cable; the upload failed guide covers this

Frequently asked questions

Which environment is best for an ESP32 beginner?

Arduino IDE, unless you already know Python, in which case MicroPython. Both give you a blinking LED in the first session. Arduino IDE has the most tutorials written for it, and the skills transfer directly to PlatformIO later. MicroPython has the fastest feedback loop, because there is no compile step at all.

Can I use Arduino libraries in PlatformIO?

Yes. PlatformIO uses the same Arduino core, so Arduino libraries work unchanged. You declare them in platformio.ini under lib_deps instead of installing them through a Library Manager, and each project pins its own versions.

Can I use Arduino code in ESP-IDF?

Not directly. ESP-IDF has its own APIs for GPIO, Wi-Fi, tasks, and timers, so an Arduino sketch needs rewriting, though the concepts transfer. PlatformIO lets you mix the two in one project with framework = arduino, espidf, which is the usual halfway step.

Is MicroPython too slow for a real project?

For most sensor, display, and network projects, no. MicroPython runs 10 to 20 times slower than C in tight loops, but reading a sensor every few seconds or serving a web page never notices the gap. It is too slow for hard real-time work, fast bit-banging, and large camera frames. If your program spends its time waiting, it is fast enough; if it spends its time computing, use C.

Do I need to pick one environment and stay in it?

No, but pick one per project. Arduino sketches move to PlatformIO for free, and MicroPython prototypes tell you exactly what the C version needs to do. Note the environment and versions you used when you start, so a switch mid-project does not break the build.

Which environment works on the ESP32-C3, S3, and C6?

All four. Arduino IDE, PlatformIO, ESP-IDF, and MicroPython all support the C3, S3, and C6, with board-specific firmware for MicroPython and board entries for the rest. The ESP32-H2 has no Wi-Fi radio, so it cannot run Wi-Fi code in any environment.

Parts used in this guide

Shipped fast and securely from our secure facility in New York, providing fast, high quality USA shipping.

In this series

Sources

ESP-NOW Explained: Two ESP32 Boards, No Router

Last updated: 2026-11-22

Yes, two ESP32 boards can talk to each other with no router, no Wi-Fi password, and no internet connection. The protocol is called ESP-NOW. Each board sends small packets of up to 250 bytes straight to the other board's MAC address, usually arriving in a few milliseconds. This guide explains how ESP-NOW works, its limits, how to encrypt it, when to pick it over Wi-Fi or Bluetooth, and gives you a working two-way sketch.

Table of contents

What is ESP-NOW?

ESP-NOW is a connectionless wireless protocol from Espressif that lets ESP32 and ESP8266 boards send data directly to each other using the Wi-Fi radio, without joining a network. There is no router, no access point, no password, no DHCP, and no IP address. The sender puts its data inside a short Wi-Fi packet called a vendor-specific action frame and addresses it to the receiver's MAC address. The receiver's hardware answers with an acknowledgement frame, and a callback on the sender reports whether it was delivered.

With normal Wi-Fi, a board first connects to the router, checks the password, gets an IP address, and only then sends data, which usually takes 1 to 3 seconds. ESP-NOW skips all of it, so a battery sensor can wake up, send its reading, and go back to sleep within a few hundred milliseconds. While connecting to Wi-Fi the radio draws more than 100 mA for seconds; with ESP-NOW the board is awake for a fraction of a second. That is why ESP-NOW is the standard choice for battery sensors, remote controls, and two-board robot cars.

ESP-NOW is not a replacement for Wi-Fi. It has no internet, no phone can talk to it, and it only works between Espressif chips. If you need a web page or a cloud dashboard, one board acts as a gateway: it talks ESP-NOW to the sensors and Wi-Fi to your router.

What are the ESP-NOW limits?

Learn these limits before you design the network, because they decide the packet format and the number of boards you can use.

Limit Value What it means
Data per packet 250 bytes (ESP-NOW v1) Sensor values fit easily; a photo does not
Data per packet, v2 1470 bytes (ESP-IDF 5.4 and later) Arduino core 3.2+; a v1 board truncates or drops packets over 250 bytes, so stay at 250 in mixed networks
Registered peers Up to 20 per board The boards you send to; a gateway can listen to more sensors if it only receives unencrypted packets
Encrypted peers 7 by default Older Arduino cores allowed 10; the limit is configurable in ESP-IDF up to 17
Default data rate 1 Mbps Higher rate means shorter range; Long Range drops to 0.5 or 0.25 Mbps
Frequency 2.4 GHz, channels 1 to 13 Both boards must use the same channel
Delivery acknowledgement Yes for unicast, none for broadcast Unicast gets a hardware ACK; broadcast never confirms arrival

The 250-byte limit is the one that shapes your code. ESP-NOW only sends an array of bytes, so the clean way to send several values at once is to group them in a struct and send the struct's bytes exactly as they sit in memory. The receiver defines the same struct and copies the incoming bytes onto it with memcpy, and the struct must have the same order, types, and size on both sides. Add __attribute__((packed)) so the compiler inserts no padding bytes between fields; the sketch below also has a static_assert that stops compilation with a clear message if the struct grows past 250 bytes. Never send a String or a pointer: only a memory address goes out, which means nothing on the other board.

How do the send and receive callbacks work?

ESP-NOW reports results through two callback functions, one for sending and one for receiving. Setup order matters: start Wi-Fi in station mode, then call esp_now_init(), then register the callbacks, then add the peer. ESP-NOW cannot work without the Wi-Fi radio, so esp_now_init() must always come after the WiFi.mode() line.

Adding a peer registers the other board by its MAC address. Clear the peer struct with = {} first; leftover values in uncleared fields cause a "Peer interface is invalid" error. Set channel to the channel both boards use, or to 0 to mean "use the board's current channel", and set encrypt to false for plain packets. If esp_now_add_peer() returns ESP_ERR_ESPNOW_FULL, the peer list is full at 20 entries; remove peers you no longer need with esp_now_del_peer().

esp_now_send() puts the packet in a queue and returns immediately; its return value only means the packet was accepted for sending. The real result arrives a few milliseconds later in the send callback: ESP_NOW_SEND_SUCCESS means the receiver's Wi-Fi hardware acknowledged the packet. "Delivered" means the packet reached the receiver's hardware, not that its program processed it. For commands that must not be lost, add a counter and a software acknowledgement: if the receiver sees the counter jump, it knows how many packets were lost, and if the same number arrives twice, it ignores the duplicate.

The receive callback runs in the Wi-Fi task, not in your loop(), so keep it short: no Serial.print, no delay, no long calculations. Copy the data into your own variable with memcpy, set a volatile flag, and let loop() do the work. On Arduino core 3.x the callback also tells you who sent the packet and the signal strength in dBm; copy those values inside the callback, because they are only valid there. A receiver need not add the sender as a peer for unencrypted unicast or broadcast; it only needs the sender on its list for encrypted packets.

Most ESP-NOW examples on the internet were written for Arduino core 2.x, and that code does not compile on core 3.x because Espressif changed the callback forms: core 3.0 changed the receive callback, and core 3.3 changed the send callback. Compiling old code on 3.x gives an "invalid conversion" error. The sketch below uses ESP_IDF_VERSION checks to pick the right form, so it compiles unchanged on 2.x, 3.0 to 3.2, and 3.3 and later.

Unicast vs broadcast: which one do I use?

Unicast sends a packet to one board by its MAC address. Broadcast sends one packet to every ESP-NOW board on the same channel. Use unicast when delivery matters, and broadcast when you need to reach boards whose addresses you do not know.

Feature Unicast Broadcast
Address One board's MAC address FF:FF:FF:FF:FF:FF
Delivery acknowledgement Yes, hardware ACK None; the send result always looks successful
Encryption Yes, with PMK and LMK No, broadcast packets cannot be encrypted
Peer list Add the board as a peer first Add the broadcast address as a peer first
Best for Commands and sensor readings Discovery and announcements

A practical pattern is to let the boards find each other with a broadcast on first boot, then learn their MAC addresses and switch to acknowledged unicast. Passing NULL as the address to esp_now_send() sends the packet separately to every peer on the list; if the broadcast address is on the list too, the packet also goes out once as a broadcast.

How do I encrypt ESP-NOW packets?

By default ESP-NOW packets are unencrypted: anyone on the same channel can capture them and send fake packets that imitate your struct. Use encryption for anything that controls something physical, such as a door lock, a garage door, or a relay.

ESP-NOW uses CCMP, the same method as WPA2, with two keys. The Primary Master Key (PMK) is 16 bytes and is the same on all devices; set it with esp_now_set_pmk(), or a default PMK is used. The Local Master Key (LMK) is 16 bytes per peer; set it when you add the peer, with encrypt set to true, and the other side must also add you as an encrypted peer with the same LMK. To receive encrypted packets, the receiver must add the sender to its list; that rule does not apply to unencrypted packets.

Two limits apply. Broadcast packets cannot be encrypted, so a network that needs encryption must use unicast. And only 7 of the 20 peers can be encrypted by default in current ESP-IDF; older Arduino cores allowed 10, and the limit is configurable up to 17.

ESP-NOW vs Wi-Fi vs Bluetooth

ESP-NOW sits between Wi-Fi and Bluetooth. Pick it when several ESP32 boards only need to talk to each other.

Method Extra module Router Packet size Typical range (open space) Best for
ESP-NOW Not needed Not needed 250 bytes 100 to 200 m Commands and sensor data between boards
Wi-Fi (HTTP, MQTT) Not needed Required Practically unlimited The router's coverage Internet, web pages, cloud
Bluetooth (BLE) Not needed Not needed 20 bytes by default 10 to 20 m indoors Connecting to a phone

Talk to a phone: use Bluetooth. Need the internet: use Wi-Fi. Several ESP32 boards that only need to talk to each other: ESP-NOW is usually the simplest way, with no extra module, cable, or router, and only a few lines of code. Its latency is a few milliseconds per packet, against 50 to 500 ms for a Wi-Fi round trip and 10 to 100 ms for BLE. The trade is that ESP-NOW only works between Espressif chips, the packet is at most 250 bytes, and there is no built-in routing or internet connection.

Which boards support ESP-NOW?

ESP-NOW needs a Wi-Fi radio, so it runs on every ESP32 chip that has one, plus the ESP8266.

Board or chip ESP-NOW Note
ESP32 (WROOM-32, DevKit V1) Yes Also supports Long Range mode
ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6 Yes Same code, only the board selection changes
ESP32-C2 (ESP8684) Yes No Long Range mode
ESP32-H2 No No Wi-Fi radio, so no ESP-NOW
ESP8266 (NodeMCU, Wemos D1 Mini) Yes Different library (espnow.h), v1 only
Raspberry Pi Pico W / Pico 2 W No Its Wi-Fi chip cannot run ESP-NOW
Arduino Uno, Nano, Mega No Use a small ESP32 over UART as a bridge

ESP-NOW also works between different ESP chips: an ESP32-C3 sensor can send packets to a classic ESP32 gateway or to an ESP8266 board. The only requirements are that both sides are on the same Wi-Fi channel and that the data struct is defined exactly the same on both sides. The examples in this guide use two ESP32 DevKit V1 boards.

Can ESP-NOW and Wi-Fi run at the same time?

Yes. The gateway pattern depends on it. One board connects to your router over Wi-Fi, talks ESP-NOW to the sensors, and forwards the readings to a web page, MQTT, or Home Assistant. But the ESP32 has a single 2.4 GHz radio that can only work on one channel at a time. Once the gateway connects to a router, the router decides the channel: if the router is on channel 6, ESP-NOW also runs on channel 6, so every sensor must switch to the router's channel too.

The sensors in that pattern are usually battery-powered deep sleep nodes: the battery sensor node post shows the wake, send, and sleep cycle, and the LiPo power post covers the battery and regulator side.

Follow four rules for a trouble-free setup. First, the gateway connects to Wi-Fi first, starts ESP-NOW after that, and prints the router's channel with WiFi.channel(). Second, the sensors do not connect to the router; they find the channel by scanning for the network name or use a fixed channel in the code, and they do not need the Wi-Fi password. Third, set your router's channel from Auto to a fixed channel (1, 6, or 11). In Auto mode, if the router changes channel, the sensors lose the gateway. Fourth, turn off power saving on the gateway with WiFi.setSleep(false); by default a connected ESP32 puts its radio to sleep at intervals and can miss ESP-NOW packets.

If the channels do not match, the sender prints "failed", and if you added the peer with a non-zero channel, the Serial Monitor also shows "ESPNOW: Peer channel is not equal to the home channel, send fail!". Read WiFi.channel() on the gateway and set the sender to match.

What range can I expect?

ESP-NOW range is similar to a Wi-Fi link, because it uses the same radio. With the onboard PCB antenna, expect 100 to 200 m in open space and 20 to 40 m indoors through one to three walls. Reinforced concrete walls and metal objects weaken the signal the most, so place the boards high and keep the antenna clear of metal plates, batteries, and cables.

Metric Typical value Note
Indoor range 20 to 40 m (1 to 3 walls) Concrete and metal cut it fastest
Open-space range 100 to 200 m PCB antenna, higher is better
Long Range mode Up to 1 km Espressif line-of-sight figure
Default data rate 1 Mbps A higher rate means a shorter range
Airtime, 250-byte packet About 2.5 ms Including ACK and waiting
Theoretical packet rate About 300 packets per second Lower in practice
Command latency A few milliseconds No connection setup or server needed

To increase range, use modules with an external antenna, such as the ESP32-WROOM-32U, and enable Long Range mode on both sides with esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_LR). Long Range only works between two ESP32 boards; an interface set to Long Range cannot connect to normal routers, and the ESP8266 and ESP32-C2 do not support it. When testing range on core 3.x, print the received signal strength: minus 50 dBm is very strong, minus 80 dBm is close to the limit, and packet loss starts around minus 90 dBm.

The two-way sketch: a button on one board, an LED on the other

This sketch runs on both boards; the only line that differs is the peer MAC address, since each board holds the other board's address. Press the button on one board and the LED on the other board toggles, and the other board sends an acknowledgement back, so you see both the hardware ACK and the proof that the LED really changed.

Wire each board the same way: the button goes between GPIO 4 and GND and uses the internal pull-up, so no resistor is needed. The LED is the onboard blue LED on GPIO 2 on most DevKit V1 boards; use a 220 ohm resistor and an external LED if yours has none there.

Part ESP32 pin Note
Push button GPIO 4 and GND Internal pull-up, no extra resistor
LED GPIO 2 Onboard blue LED on most DevKit V1 boards
Power USB Both boards can use separate USB ports or adapters

Upload the sketch to the first board and open the Serial Monitor at 115200 baud. It prints that board's STA MAC address, both as text and as an array line you can paste straight into the other board's code. Do the same on the second board, paste each address into the other board's peerMac array, and upload again. Use the STA address, not the AP address: the AP address is usually the STA address with the last byte increased by one, and using the wrong one is the most common reason for a "failed" message. On core 3.x, WiFi.macAddress() can return all zeros if called too early, so this sketch reads the address with esp_wifi_get_mac() instead.

// ESP-NOW two-way sketch: two ESP32 boards, no router.
// Upload this SAME sketch to both boards. The only line that differs
// between the two boards is peerMac below: each board holds the OTHER
// board's STA MAC address (printed at startup).
// Board: ESP32 DevKit V1 (30-pin WROOM-32), Arduino-ESP32 core.
// Libraries: built-in only (WiFi.h, esp_now.h, esp_wifi.h). Nothing to
// install from the Library Manager.
// Wiring on EACH board: push button between GPIO 4 and GND (internal
// pull-up, no resistor). LED is the onboard blue LED on GPIO 2.
// Press the button on one board: the LED on the other board toggles,
// and the other board sends an acknowledgement back.
#include <Arduino.h>
#include <WiFi.h>
#include <esp_now.h>
#include <esp_wifi.h>
#include <esp_idf_version.h>

#define BUTTON_PIN 4  // push button between GPIO 4 and GND
#define LED_PIN 2     // onboard blue LED on most DevKit V1 boards

// Paste the OTHER board's STA MAC address here. Run the sketch once
// with any value and read "My STA MAC" from the Serial Monitor.
uint8_t peerMac[6] = {0x24, 0x6F, 0x28, 0x00, 0x00, 0x00};

typedef struct __attribute__((packed)) {
  uint8_t type;      // 1 = command (set the LED), 2 = acknowledgement
  bool ledOn;        // the LED state the sender wants on the other board
  uint32_t counter;  // packet number, so the receiver spots lost or duplicate packets
} EspNowMessage;
static_assert(sizeof(EspNowMessage) <= 250, "ESP-NOW v1 packet limit is 250 bytes");

EspNowMessage outMsg;
volatile bool haveIncoming = false;
volatile bool lastSendOk = false;
volatile bool haveSendResult = false;
volatile int8_t lastRssi = 0;
EspNowMessage inMsg;

// Receive callback. It runs in the Wi-Fi task, so it only copies the
// packet and sets a flag; loop() does the real work.
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
void onDataRecv(const esp_now_recv_info_t *info, const uint8_t *data, int len) {
  if (len != (int)sizeof(EspNowMessage)) return;
  memcpy((void *)&inMsg, data, len);
  lastRssi = info->rx_ctrl->rssi;
  haveIncoming = true;
}
#else
void onDataRecv(const uint8_t *mac, const uint8_t *data, int len) {
  if (len != (int)sizeof(EspNowMessage)) return;
  memcpy((void *)&inMsg, data, len);
  haveIncoming = true;
}
#endif

// Send callback. Fires a few milliseconds after esp_now_send() with the
// hardware acknowledgement result. "Delivered" means the other board's
// Wi-Fi hardware answered, not that its program processed the packet.
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0)
void onDataSent(const esp_now_send_info_t *info, esp_now_send_status_t status) {
  lastSendOk = (status == ESP_NOW_SEND_SUCCESS);
  haveSendResult = true;
}
#else
void onDataSent(const uint8_t *mac, esp_now_send_status_t status) {
  lastSendOk = (status == ESP_NOW_SEND_SUCCESS);
  haveSendResult = true;
}
#endif

void setup() {
  Serial.begin(115200);
  pinMode(BUTTON_PIN, INPUT_PULLUP);
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, LOW);

  // ESP-NOW needs the Wi-Fi radio, so start Wi-Fi in station mode.
  // No router is joined and no password is needed.
  WiFi.mode(WIFI_STA);

  // Print this board's STA MAC address. Use the STA address, not the
  // AP address (the AP address is usually the STA address plus one).
  uint8_t mac[6];
  esp_wifi_get_mac(WIFI_IF_STA, mac);
  Serial.printf("My STA MAC: %02X:%02X:%02X:%02X:%02X:%02X\n",
                mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
  Serial.printf("Paste as: {0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X}\n",
                mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);

  if (esp_now_init() != ESP_OK) {
    Serial.println("esp_now_init failed");
    while (true) { delay(1000); }
  }
  esp_now_register_recv_cb(onDataRecv);
  esp_now_register_send_cb(onDataSent);

  esp_now_peer_info_t peer = {};
  memcpy(peer.peer_addr, peerMac, 6);
  peer.channel = 1;      // both boards must use the same channel
  peer.encrypt = false;  // unencrypted; see the guide for PMK/LMK encryption
  if (esp_now_add_peer(&peer) != ESP_OK) {
    Serial.println("esp_now_add_peer failed: check the peer MAC address");
  }

  outMsg.type = 1;
  outMsg.ledOn = false;
  outMsg.counter = 0;
  Serial.println("Ready. Press the button to toggle the other board's LED.");
}

void loop() {
  static int buttonState = HIGH;  // stable, debounced button state
  static int lastButton = HIGH;   // raw reading from the previous loop
  static unsigned long lastDebounce = 0;
  static bool ledState = false;   // the LED state we last asked the other board for

  int reading = digitalRead(BUTTON_PIN);
  if (reading != lastButton) lastDebounce = millis();
  lastButton = reading;
  if ((millis() - lastDebounce) > 30 && reading != buttonState) {
    buttonState = reading;
    if (buttonState == LOW) {
      // Button pressed: toggle the LED we want on the other board.
      ledState = !ledState;
      outMsg.type = 1;
      outMsg.ledOn = ledState;
      outMsg.counter++;
      haveSendResult = false;
      if (esp_now_send(peerMac, (uint8_t *)&outMsg, sizeof(outMsg)) != ESP_OK) {
        Serial.println("esp_now_send rejected the packet");
      }
    }
  }

  if (haveSendResult) {
    haveSendResult = false;
    Serial.println(lastSendOk ? "Delivered (hardware ACK)" : "Failed (no ACK)");
  }

  if (haveIncoming) {
    haveIncoming = false;
    if (inMsg.type == 1) {
      // Command: set our LED to the state the other board asked for,
      // then send an acknowledgement back.
      digitalWrite(LED_PIN, inMsg.ledOn ? HIGH : LOW);
      Serial.printf("Command #%u: LED %s (RSSI %d dBm)\n",
                    inMsg.counter, inMsg.ledOn ? "ON" : "OFF", lastRssi);
      EspNowMessage ack;
      ack.type = 2;
      ack.ledOn = inMsg.ledOn;
      ack.counter = inMsg.counter;
      esp_now_send(peerMac, (uint8_t *)&ack, sizeof(ack));
    } else if (inMsg.type == 2) {
      Serial.printf("Ack #%u: the other board set its LED %s\n",
                    inMsg.counter, inMsg.ledOn ? "ON" : "OFF");
    }
  }
}

The sketch compiles as written. With both boards running, press the button on one board and watch the Serial Monitor on both: the sender prints "Delivered (hardware ACK)", the receiver prints the command number, the LED state, and the signal strength, then the sender prints the acknowledgement. If the button press does nothing, check the troubleshooting table below before changing the code.

What goes wrong?

Symptom Cause Fix
Send callback says "Failed (no ACK)" The boards are on different channels Set the same channel on both boards; if one board also joins Wi-Fi, match the router's channel
"Peer channel is not equal to the home channel" Peer added with a non-zero channel that differs from the board's channel Set the peer channel to 0 (current channel) or to the channel the board actually uses
Packets send fine and never arrive Wrong MAC address: AP address used instead of STA Use the STA address the sketch prints; the AP address is usually STA plus one
Receiver reads garbage Struct differs between the two boards Same order, types, and size on both sides; add __attribute__((packed))
Old example will not compile on core 3.x Callback signatures changed in core 3.0 and 3.3 Use the ESP_IDF_VERSION guards from the sketch above
It works between two boards and breaks when one joins Wi-Fi The Wi-Fi board followed the router to another channel Read WiFi.channel() on the gateway and match it; fix the router channel to 1, 6, or 11
Gateway misses packets Power saving puts the radio to sleep Call WiFi.setSleep(false) on the gateway
Range is much worse than Wi-Fi Antenna blocked or board in a metal case Keep the antenna clear, raise the boards, or try an external antenna or Long Range mode

Frequently asked questions

Does ESP-NOW need a router?

No. ESP-NOW sends packets directly from one ESP32 board to another by MAC address, with no router, no Wi-Fi password, and no internet connection.

What is the biggest ESP-NOW packet?

250 bytes with ESP-NOW v1, which is what the Arduino core uses by default. ESP-NOW v2 on ESP-IDF 5.4 and later allows 1470 bytes, but a v1 board truncates or drops packets over 250 bytes, so stay at 250 in a mixed network.

How many ESP32 boards can talk ESP-NOW at once?

One board can register up to 20 peers it sends to. A gateway that only receives unencrypted packets can listen to more than 20 sensors, because receiving does not need the sender on the list.

Can ESP-NOW reach the internet?

No. ESP-NOW has no TCP/IP and no routing. Use one board as a gateway: it talks ESP-NOW to the sensors and Wi-Fi to your router.

Does ESP-NOW work on the ESP32-S3 and ESP32-C3?

Yes, on the ESP32, S2, S3, C2, C3, and C6, and on the ESP8266 with a different library. It does not work on the ESP32-H2, which has no Wi-Fi radio.

Why does my ESP-NOW code not compile on Arduino core 3.x?

Espressif changed the callback signatures: the receive callback changed in core 3.0 and the send callback in core 3.3. The sketch in this guide uses ESP_IDF_VERSION checks to pick the right form, so it compiles on 2.x, 3.0 to 3.2, and 3.3 and later.

Parts used in this guide

In this series

Sources

ESP32-CAM RTSP Streaming: Setup Guide for VLC and NVR

The ESP32-CAM is a cheap way to build a WiFi camera, but the sketch most beginners start with does not speak RTSP. The stock Espressif CameraWebServer example streams MJPEG over HTTP, and that is all it does. If you want VLC, Frigate, Blue Iris, or an NVR to pick the camera up as a standard network camera, you need RTSP, which needs different firmware or a different library.

This guide covers the working routes, the board each one fits, the exact RTSP URL each serves, VLC viewing, Frigate and Home Assistant setup, and expected frame rate. Nothing here needs a paid app or a cloud account.

What is RTSP, and when does it beat MJPEG?

RTSP, Real Time Streaming Protocol, is the standard way network cameras hand video to players and recorders. A client asks for a stream, the two agree on transport settings, and video flows over RTP. VLC, ffmpeg, Frigate, Blue Iris, ZoneMinder, and most NVR software all speak RTSP.

MJPEG over HTTP, the /stream endpoint in the stock CameraWebServer sketch, is simpler: the camera sends one JPEG image after another in a single HTTP response, and any browser can show it. NVR software generally cannot record it, and detection tools cannot consume it directly.

Use RTSP to record footage, run motion or person detection, watch several cameras in one app, or feed the camera into Home Assistant through Frigate or go2rtc. Stick with MJPEG over HTTP for a quick live view in a browser. If you have not set up the board yet, start with our ESP32-CAM getting started guide first.

How do I watch the stream in a browser?

The stock CameraWebServer example is the fastest way to a live picture in a browser. It serves MJPEG over HTTP: the camera sends one JPEG image after another in a single HTTP response, and any browser shows it with no plugin and no extra app.

Flash it from the Arduino IDE. Open File, then Examples, then ESP32, then Camera, then CameraWebServer. Select the AI-Thinker camera model in board_config.h, enter your 2.4 GHz WiFi network name and password, and set the partition scheme to Huge APP (3MB No OTA/1MB SPIFFS); the camera example needs at least 3 MB of app space. Flash the board the same way the flashing walkthrough shows.

Watch the serial monitor at 115200 baud. When the board connects it prints “Camera Ready! Use ‘http://’ followed by its IP address”. Open that address in a browser on the same network. Press Start Stream for the live picture, or Get Still for a single photo. The example starts at QVGA resolution for a higher initial frame rate; raise it from the menu once the stream is stable.

The page has two servers behind it. The settings page and the single-photo endpoint live on port 80, and the live stream lives on port 81.

AddressWhat it servesUse it for
http://<IP>/Settings page with Start Stream and Get Still buttonsWatching and changing settings in a browser
http://<IP>/captureOne JPEG photo, port 80Saving a single still from a browser or a script
http://<IP>:81/streamLive MJPEG stream, port 81Embedding the stream in your own page or home automation software

Use the left-hand menu on the settings page to change the resolution, JPEG quality, brightness, contrast, and white balance while the stream runs. With PSRAM the example starts at UXGA and a JPEG quality of 10; without PSRAM it drops to SVGA and a quality of 12, because the frame buffer does not fit in internal RAM. If the picture stutters, lower the resolution first; the frame rate section below shows what to expect at each size.

Which board works for RTSP?

Any ESP32 camera board with PSRAM can run an RTSP server. The classic AI-Thinker style ESP32-CAM has an ESP32 chip with 4 MB PSRAM and an OV2640 camera. The ESP32-S3-N16R8 CAM board runs an ESP32-S3 chip with 8 MB PSRAM and an OV5640 camera, and its two USB-C ports mean no serial adapter is needed. Both boards stream MJPEG video over RTSP, not H.264, which matters for bandwidth and Home Assistant (see the frame rate section).

Pin tables conflict across sources. A wrong camera pin map is the most common reason a build compiles cleanly and shows no video, so verify the pins against your exact board variant before flashing, using that variant’s own documentation.

What are the RTSP setup options?

There is no single official RTSP example from Espressif for the classic ESP32-CAM. The working routes are community firmware and libraries. Pick one row and follow its section.

Approach Best for Boards RTSP URL pattern Code or config needed
esp32cam-rtsp firmware by rzeldent Fastest setup, no code changes ESP32, ESP32-S2, ESP32-S3 camera modules rtsp://IP:554/mjpeg/1 Flash with PlatformIO, configure in a browser
Micro-RTSP library by geeksville Arduino or PlatformIO sketch you control Classic ESP32-CAM (OV2640) rtsp://IP:8554/mjpeg/1 Arduino sketch plus the Micro-RTSP library
Tasmota32 webcam firmware Users who already run Tasmota and want MQTT control Classic ESP32-CAM (AI-Thinker template) rtsp://IP:8554/mjpeg/1 Flash the webcam binary, run one command
ESPHome rtsp_server component ESP32-S3 boards already in ESPHome ESP32 camera boards running ESPHome rtsp://IP:554/ Add two lines to your ESPHome YAML

Sources: esp32cam-rtsp at https://www.esp32.diy/esp32cam-rtsp/ ; Micro-RTSP at https://github.com/geeksville/Micro-RTSP ; circuit.rocks tutorial at https://learn.circuit.rocks/esp32-cam-with-rtsp-video-streaming ; Tasmota guide at https://cgomesu.com/blog/Esp32cam-tasmota-webcam-server/ ; ESPHome docs at https://beta.esphome.io/components/rtsp_server/ .

How do I set up esp32cam-rtsp, the no-code route?

Recommended route for most buyers. The firmware turns the board into an RTSP server, an HTTP MJPEG streamer, and a snapshot endpoint at once, all configured through a web page, with no code changes. Latest release at the time of writing: 1.0.8 (2026-09-29).

  1. Install PlatformIO (VS Code extension or CLI) and clone the project: git clone https://github.com/rzeldent/esp32cam-rtsp.git.
  2. Enter download mode. USB-C boards do this on their own; if an upload fails, hold BOOT, press and release RESET, then release BOOT. On a classic ESP32-CAM, use a 3.3 V USB-to-serial adapter or an ESP32-CAM-MB carrier, and hold GPIO0 low while resetting. 5 V logic damages the board.
  3. Flash your board target, for example pio run -t upload -e esp32cam_ai_thinker for the AI-Thinker board.
  4. On first boot the firmware starts its own WiFi access point. Join it, open the config page shown in the serial monitor, enter your WiFi credentials and camera settings, then save. The board reboots onto your network.
  5. Open VLC and play rtsp://<ip address>:554/mjpeg/1.

The same firmware also serves MJPEG at http://<ip address>/stream and a still at http://<ip address>/snapshot. Turn on RTSP authentication in the web interface if anyone outside your household can reach your network, and never forward port 554 through your router.

How do I set up Micro-RTSP in an Arduino sketch?

Use this route when you want the RTSP server inside your own sketch, for example a camera that also reads sensors or drives outputs. Micro-RTSP is a small RTSP server library implementing RTSP and JPEG-over-RTP, with a reference streamer built for the OV2640 on the classic ESP32-CAM.

  1. Install Micro-RTSP from the ZIP in the circuit.rocks ESP32-RTSP repo, or as a PlatformIO dependency; it is not in the Arduino Library Manager. Full example: https://github.com/circuitrocks/ESP32-RTSP .
  2. Put your WiFi credentials in the sketch’s credentials header before compiling.
  3. Wire the classic ESP32-CAM: 5 V and ground to the header pins, adapter TX to board U0R and RX to U0T, and a button between IO0 and ground. Use a 5 V, 2 A supply; a computer USB port is often not enough.
  4. Hold the download button while powering up or resetting, then upload. The serial monitor at 115200 baud shows the boot message and board IP.
  5. In VLC play rtsp://<ip address>:8554/mjpeg/1. Note the port: 8554, not 554.

The example loop sends a frame about every 100 ms, roughly 10 fps at 800 by 600, per the Micro-RTSP docs for that example. Run only one streaming server at a time; enabling both web and RTSP makes streaming very slow.

How do I enable RTSP on Tasmota?

Use this route only if you already run Tasmota or want its MQTT control and web interface. Flash the tasmota32-webcam firmware, apply the AI-Thinker template, then enable the RTSP server from the Tasmota console:

WcRtsp 1

The stream is then live at rtsp://<device IP>:8554/mjpeg/1. Enable it once; the RTSP server runs independently of the HTTP stream. The Tasmota guide reports VLC is the most reliable viewer. Full steps: https://cgomesu.com/blog/Esp32cam-tasmota-webcam-server/ .

How do I add RTSP to an ESPHome camera?

If your camera already runs ESPHome, add the RTSP server component next to your configured esp32_camera block:

rtsp_server:

That is the whole configuration. The stream is served at rtsp://<device IP>:554/ with no path after the port. Optional settings: port (default 554), max_connections (1 to 4, default 2), and allowed_ips (addresses or networks allowed to connect).

Two facts catch people out. First, the stream is MJPEG over RTSP, and the camera only streams while at least one client is playing. Second, there is no encryption or authentication; allowed_ips filters by address but authenticates nobody, so use it only on a trusted local network. Source: ESPHome RTSP docs.

How do I watch the stream in VLC?

VLC is the best first test for any of the four routes, because its RTSP support is solid and its error messages point at the real problem.

  1. Open VLC, go to Media, then Open Network Stream, or press Ctrl+N.
  2. Paste the RTSP URL for your firmware: port 554 for esp32cam-rtsp and ESPHome, port 8554 for Micro-RTSP and Tasmota. The path is /mjpeg/1 for esp32cam-rtsp, Micro-RTSP, and Tasmota, and the root path / for ESPHome.
  3. Click Play. If the picture appears, the camera, firmware, and network path all work, and any later failure is in the next app, not the camera.

If the video lags by a second or more, the cause is usually VLC network caching, not the camera. VLC buffers network streams at 1000 ms by default. In the stream dialog, click Show more options and lower caching to 300 ms, or to 0 ms for the lowest delay. Zero caching makes the picture more sensitive to WiFi jitter, so on a weak signal keep some caching and fix the signal instead.

How do I add the camera to Home Assistant and Frigate?

Two warnings first, because most tutorials get this part wrong.

Warning one: Home Assistant Generic Camera cannot play this stream. Its pipeline plays only H.264 and HEVC, and every RTSP route in this guide serves MJPEG. The ESPHome docs state this directly. Source: ESPHome RTSP docs.

Warning two: if the camera runs ESPHome, Home Assistant does not need RTSP at all. The ESPHome native API already exposes the camera entity. RTSP is for other software.

The route that works is Frigate, with go2rtc if your Frigate version uses it. Frigate reads the MJPEG RTSP stream with ffmpeg and handles detection and recording. A working Frigate camera entry from the Home Assistant community, using the Tasmota or Micro-RTSP URL:

cameras:
  esp32_cam:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.72:8554/mjpeg/1
          roles:
            - detect
            - record
    detect:
      width: 640
      height: 360
      fps: 5

Replace the IP address with your camera IP, and use port 554 with the matching path for esp32cam-rtsp or ESPHome. Keep detection resolution low; community users run 640 by 360 at 5 frames per second. Source: Home Assistant community Frigate thread.

If you only want a live dashboard view, skip RTSP and use the ESPHome native camera entity or the HTTP MJPEG stream. RTSP earns its place when Frigate or an NVR must record or analyze the feed.

How do I save a snapshot or record the stream?

A live stream is only useful while you watch it. Three ways to keep what the camera sees: a single still from the browser, a photo saved to the SD card, or a recording of the RTSP stream on your computer.

For one still, open http://<IP>/capture in a browser and save the JPEG it returns. The esp32cam-rtsp firmware serves the same thing at http://<IP>/snapshot. Both return a single frame, so you can also fetch them from a script on a schedule.

For a photo saved on the board itself, use the SD card slot. The sketch below wakes the camera, takes one photo when you press the button on GPIO 13, and saves it as /photo001.jpg, /photo002.jpg, and so on, with the counter kept in flash so it survives a reset. The card must be FAT32, 32 GB or less. The sketch mounts the card in 1-bit mode, which uses GPIO 2, 14, and 15 only, so GPIO 13 stays free for the button.

camera_fb_t *fb = esp_camera_fb_get();
if (fb) {
  File file = SD_MMC.open("/photo001.jpg", FILE_WRITE);
  file.write(fb->buf, fb->len);
  file.close();
  esp_camera_fb_return(fb);
}

The full sketch is the compiled source for this section: it sets up the AI-Thinker camera pins, mounts the card, and saves one numbered photo per button press. It compiled clean with PlatformIO on the ESP32-CAM board.

For a recording, use ffmpeg on your computer against the RTSP URL. The command below copies the stream straight to a file with no re-encoding, so it costs almost no CPU and loses no quality. TCP transport keeps packets from dropping, which matters for MJPEG because a lost packet corrupts the frame it lands in.

ffmpeg -rtsp_transport tcp -i "rtsp://<IP>:554/mjpeg/1" -c copy capture.mp4

Replace <IP> with your camera IP and 554 with 8554 for Micro-RTSP or Tasmota. For long recordings, split the file every 15 minutes so one crash does not lose the whole capture: add -f segment -segment_time 900 -segment_format mp4 -reset_timestamps 1 and name the output capture_%03d.mp4. Frigate does the same job continuously if you already run it; its camera entry in this guide has a record role for exactly this.

What latency and frame rate should I expect?

No source gives one tested frame rate for every board and firmware, so this guide gives no universal number. The numbers below are what named sources measured on their own setups. Your result moves with resolution, JPEG quality, WiFi signal, and client count.

  • ESPHome measured about 5 fps over WiFi and 10 over Ethernet at 640 by 480 on an ESP32-S3 with an OV5640, using its high performance network settings; without them the same test ran at about 1 fps over WiFi. Source: ESPHome RTSP docs.
  • The Micro-RTSP example sends a frame about every 100 ms, roughly 10 fps at 800 by 600 in its own documentation. Source: Micro-RTSP docs.
  • The esp32cam-rtsp project states that resolution and frame rate are bounded by the ESP32 processor and available PSRAM. Source: esp32cam-rtsp project page.

Start at 640 by 480 and raise resolution only after the stream is stable. MJPEG uses more bandwidth than H.264 at the same picture quality, since every frame is a full JPEG. Assume one viewer at a time on a classic ESP32-CAM; ESPHome defaults to two RTSP clients.

How much bandwidth does MJPEG need?

MJPEG sends every frame as a full JPEG image, so the bandwidth is the frame size times the frame rate. A higher resolution means a bigger frame and a lower frame rate, and there is no compression between frames to hide it. The table below uses measured frame rates from the sources cited; your result moves with JPEG quality, WiFi signal, and how many viewers are connected.

ResolutionExpected frame rateWhat it is good for
QVGA 320 by 24020 to 30 fpsFastest motion, lowest detail; best first test of a new setup
VGA 640 by 480About 5 fps over WiFi, 10 over Ethernet on an ESP32-S3The starting point this guide recommends; good balance of detail and speed
SVGA 800 by 600About 10 fpsMore detail for a door or driveway camera on a strong signal
UXGA 1600 by 12002 to 5 fpsStill photos and slow scenes only; a 1600 by 1200 JPEG frame is 100 to 250 KB

Worked example, from the cited frame sizes: a UXGA frame of 100 to 250 KB at 3 frames per second is 300 to 750 KB per second, about 2.4 to 6 Mbit per second, for one viewer. Drop to 640 by 480 and the same stream needs a fraction of that, which is why this guide starts there. Assume one viewer at a time on a classic ESP32-CAM; a second viewer halves the rate each one sees. ESPHome defaults to two RTSP clients for the same reason.

If the stream is slow, do not add bandwidth first. Lower the resolution, raise the JPEG quality number (a higher number means more compression and a smaller frame), disconnect other viewers, and move the board closer to the router. The frame rate section above shows the numbers each route measured on its own setup.

What are the common mistakes?

  • Flashing the stock CameraWebServer sketch and expecting RTSP. It serves MJPEG over HTTP only.
  • Using the wrong port. Port 554 belongs to esp32cam-rtsp and ESPHome; port 8554 belongs to Micro-RTSP and Tasmota. The wrong port gives a connection refused error even when the camera runs fine.
  • Using the wrong path. The path is /mjpeg/1 for esp32cam-rtsp, Micro-RTSP, and Tasmota, and the root path / for ESPHome.
  • Powering the classic ESP32-CAM from a weak USB port. The board needs a stable 5 V, 2 A supply. Brownouts during WiFi connection look like firmware bugs and are usually power.
  • Running two streaming servers at once in the Micro-RTSP sketch. The tutorial warns this makes streaming very slow. Pick one.
  • Pointing Home Assistant Generic Camera at an MJPEG RTSP URL. It cannot play it. Use Frigate or go2rtc, or the ESPHome native camera entity.
  • Opening RTSP to the internet. None of these routes is built for that, and ESPHome RTSP has no authentication at all. Keep the camera on your local network.
  • Trusting a pin table from a different board variant. Pin maps conflict across sources. Verify the camera pins against your exact board variant before blaming the firmware.

How do I troubleshoot a stream that will not play?

Work through this list in order; each step rules out one layer.

VLC says “Your input can’t be opened” or times out. Check the board IP in the serial monitor or your router, confirm the camera and computer share a network, and confirm the port and path match your firmware in the table above. Check the router is not isolating WiFi clients (AP isolation) and that no firewall blocks the RTSP port.

VLC connects but shows a black or frozen frame. Drop to 640 by 480 and move closer to the router. The ESP32-CAM is 2.4 GHz only, so a 5 GHz network name will never work.

The stream stutters or drops frames. Lower the resolution and frame rate, disconnect other viewers, and check the power supply, since a marginal 5 V supply causes this under load. In VLC, force RTP over RTSP (TCP) when UDP packets drop.

The camera boots but never joins WiFi. Re-enter the network name and password, watching case and trailing spaces. Check the serial monitor at 115200 baud for connection messages and the assigned IP. A reboot loop usually means power first, then a loose camera ribbon cable.

The camera works in VLC but Frigate reports “Unable to read frames”. Confirm the URL in VLC first, then copy it exactly into Frigate. The common cause is port 554 when the firmware serves on 8554, or an ESPHome web server port, which is HTTP, not RTSP. Source: Home Assistant community thread.

Wrong colors or artifacts. Reseat the camera ribbon cable and lower the resolution.

Parts used in this guide

Prices and stock were verified live on qualityrcparts.com on 2026-11-21 through the public Store API. All three items are in stock and purchasable; the live product page is the current price.

Shipped fast and securely from our secure facility in Queensbury, NY. QRC ships within the USA only.

Related guides

Frequently asked questions

Does the ESP32-CAM support RTSP out of the box?

No. The stock CameraWebServer example serves MJPEG over HTTP only, with no RTSP server. Add RTSP with esp32cam-rtsp firmware, the Micro-RTSP library, Tasmota webcam firmware, or the ESPHome rtsp_server component. Source: Home Assistant community, Tasmota guide.

What is the RTSP URL for an ESP32-CAM?

It depends on the firmware: rtsp://IP:554/mjpeg/1 for esp32cam-rtsp, rtsp://IP:8554/mjpeg/1 for Micro-RTSP and Tasmota, rtsp://IP:554/ for ESPHome. Replace IP with the camera IP from your router or serial monitor. Source: esp32cam-rtsp, Micro-RTSP, Tasmota, and ESPHome docs.

Can I add an ESP32-CAM RTSP stream to Home Assistant?

Not through Generic Camera: its pipeline plays only H.264 and HEVC, and ESP32-CAM RTSP serves MJPEG. Feed the stream to Frigate or go2rtc instead, or use the ESPHome native camera entity. Source: ESPHome RTSP docs.

Why does VLC say it cannot open my ESP32-CAM stream?

The usual causes are a wrong IP address, the wrong port (554 vs 8554), the wrong path (/mjpeg/1 vs the ESPHome root path), AP isolation, or a firewall blocking the RTSP port. Check the stream in VLC first, then copy that working URL into any other app. Source: Micro-RTSP and circuit.rocks docs.

What frame rate will I get from an ESP32-CAM over RTSP?

There is no single tested number. ESPHome measured about 5 fps over WiFi and 10 over Ethernet at 640 by 480 on an ESP32-S3 with an OV5640, and the Micro-RTSP example runs about 10 fps at 800 by 600. Start at 640 by 480. Source: ESPHome and Micro-RTSP docs.

Is RTSP better than MJPEG for an ESP32-CAM?

RTSP is better when a recorder, NVR, or detection tool needs the feed, because those tools speak RTSP and generally cannot consume an MJPEG HTTP stream. MJPEG over HTTP is better for a quick live view in a browser. Both carry the same MJPEG video, so RTSP does not improve the picture, it makes the feed usable by more software. Source: ESPHome docs, esp32cam-rtsp page.

Can I view an RTSP stream in a web browser?

No, not directly. Browsers do not play RTSP. Use VLC or an NVR app for RTSP, the HTTP MJPEG stream at http://IP/stream for a browser view, or Frigate or go2rtc between the camera and the browser. Source: circuit.rocks docs, esp32cam-rtsp page.

How do I watch the MJPEG stream in a browser?

Flash the stock CameraWebServer example, open the IP address the serial monitor prints, and press Start Stream. The live stream itself is at http://<IP>:81/stream, and a single still is at http://<IP>/capture. The example starts at QVGA; raise the resolution from the menu once the stream is stable.

How do I save a single photo from the camera?

Open http://<IP>/capture in a browser and save the JPEG it returns, or use http://<IP>/snapshot on esp32cam-rtsp firmware. To save on the board itself, use the SD snapshot sketch in this guide: press the button on GPIO 13 and the photo lands on the card as /photoNNN.jpg. The card must be FAT32, 32 GB or less.

How do I record the RTSP stream to a file?

Run ffmpeg on your computer: ffmpeg -rtsp_transport tcp -i “rtsp://<IP>:554/mjpeg/1” -c copy capture.mp4. Use port 8554 for Micro-RTSP or Tasmota. Add -f segment -segment_time 900 to split long recordings into 15-minute files. Frigate records continuously if you already run it.

Why is the stream slow at high resolution?

Every MJPEG frame is a full JPEG image, so a UXGA frame of 100 to 250 KB at a few frames per second needs several Mbit per second for one viewer. Drop to 640 by 480, raise the JPEG quality number for smaller frames, disconnect other viewers, and move the board closer to the router.

Sources

Last updated: 2026-11-22