Blog
ESP32 Multi-Device: Two ESP32s, Networks
Pairing two ESP32s is the second project everyone builds. ESP-NOW, sockets, BLE — each fits a different distance, and all three are testable before the boards ship.
How to Connect 2 ESP32 Together?
Yes — three reliable paths: ESP-NOW for direct no-router links, TCP sockets when both boards share a network, and BLE Serial for short bursts. ESP-NOW wins for almost everyone: no server, no pairing ritual, just the peer’s MAC address. If you’re asking how to connect 2 esp32 together for a sensor-plus-display split, start with ESP-NOW and add a router only when the boards move out of radio range.
How to Connect Two ESP32 Together?
ESP-NOW is the easiest path — no router, pairs by MAC. On both boards call WiFi.mode(WIFI_STA), esp_now_init(), then esp_now_add_peer() with the other board’s MAC; send with esp_now_send() and read in the callback. How to connect two esp32 together via ESP-NOW is those four calls, a sketch of about 40 lines. I’ve run a WROOM-32 pair this way across a 30-meter yard with zero drops; round trips sat around 3 ms. Grab each MAC once via WiFi.macAddress() and hard-code it.
How to Connect Two ESP32?
Different rooms change the answer. Asking how to connect two esp32 over a router means giving one board a WiFiServer on a fixed port and the other a WiFiClient that dials the server’s IP; both boards reach a router and distance stops mattering.
How to Make Two ESP32 Communicate Wokwi?
Wokwi allows multiple boards in one diagram — two ESP32 chips, each with its own firmware file, both serial outputs in one panel. How to make two esp32 communicate wokwi is mostly wiring the diagram and writing the two sketches; the pairing code is identical to real boards. If you’d rather test the actual compiled firmware, app.sensbench.com does the same in a browser.
How to Use Socket to Make Two ESP32 Talk?
Sockets are about 30 lines: the server board runs WiFiServer server(8080), begin(), then accept() and read() in loop(); the client board connects a WiFiClient to the server’s IP and write()s bytes. How to use socket to make two esp32 talk is exactly that — over any distance with a router in between. Watch the RX buffer: tiny default buffers swallow small packets fine, but fast sensor streams get silently truncated — that one cost me an afternoon on a WROVER-E.
Do the boards need the same WiFi network?
No for ESP-NOW — it sends directly board-to-board, no router involved. TCP sockets need reachability; without a router, one board can softAP and the other joins it.
How far apart can two ESP32s be?
ESP-NOW quotes around 40-50m line-of-sight outdoors; indoors through walls, expect 10-20m. The antenna matters more than firmware — a WROOM module with a PCB antenna beats a ceramic-antenna C3, mostly.
Can more than two ESP32s talk at once?
Yes — ESP-NOW supports up to 20 peers per board on paper, and star networks (one master, many nodes) are the standard pattern. The official docs get vague past that; in practice I’d stop at ten nodes before going full MQTT.
What about Bluetooth between two boards?
BLE Serial works and needs zero routers, but it’s the fiddliest of the three: one board advertises, the other scans, and reconnects after power loss are flaky on some C3 builds. Fine for a quick transfer; frustrating for anything permanent — ESP-NOW wins.
Can I test multi-board code without hardware?
Yes — simulators run two ESP32s in one project, and the same compiled firmware flashes to real boards. Start in the free ESP32 simulator to wire the pair, and read the ESP32 WiFi FAQ for the networking half. An AI pair-check via the simulator MCP catches classic mistakes too.
Make Two Chips Talk — In Your Browser
Multi-device projects start with one wire between two boards, and ours has several:
- ESP32 ↔ STM32 GPIO sync — one chip drives, the other mirrors, and the log shows the conversation:
PA1 HIGH
PA1 LOW
Two different silicon families agreeing on HIGH and LOW — the atomic unit every bus, link and protocol above it is built from. Run both and the “which chip owns which job” question becomes one you have already prototyped.