Basics · 10 min read

ESP32 WiFi Range with an External Antenna: u.FL, TX Power, RSSI

ESP32 WiFi range guide: PCB antenna orientation, u.FL external antenna, 0 Ω resistor bridge, setTxPower, metal enclosures, RSSI vs distance, ESP-NOW and LoRa.

The ESP32 Wi-Fi range problem usually starts the same way: a circuit that works fine on the desk starts dropping its connection once it moves to the garden, the garage or the floor below. Most of the time the ESP32 isn't to blame; it's where and how its antenna sits. The meandering copper track at the end of the board is a small PCB antenna, and it's easily blinded by your hand, a metal box, a battery or a cable running alongside it. With the right placement, an external antenna where needed and a simple RSSI measurement, you can often double or triple the range, all while staying within the legal transmit power limit.

In this article you'll see which dB figures decide the range, how to place the PCB antenna and how to build your own distance table with code that measures RSSI. Then you'll learn about modules with a u.FL connector such as the WROOM-32U, the 0 Ω resistor bridge on boards like the ESP32-CAM, what the setTxPower function really does and how much a metal box hurts. In the last part we compare when you should switch to ESP-NOW or LoRa where Wi-Fi isn't enough. If the connection never comes up at all, go through the checks in the ESP32 won't connect to Wi-Fi article first.

ESP32 development board
The meandering copper track at the end of the module is the PCB antenna; keep it away from metal and cables

What determines the ESP32's Wi-Fi range?

You can think of range as a spreadsheet: add the antenna gains to the transmit power, subtract every loss along the way, and if what's left is stronger than the receiver's sensitivity, the link works. This is called the link budget, and everything is measured in dB. In free space at 2.4 GHz the signal loses about 40 dB in the first metre and another 6 dB every time the distance doubles. So every 6 dB you add to the budget roughly doubles the range, and every 6 dB you lose halves it. An important detail: the link goes both ways. Even if the ESP32 hears the router, the connection drops if the router can't hear the ESP32; that's why antenna gain helps both sending and receiving, while raising transmit power only strengthens one direction.

Budget itemTypical valueNote
ESP32 transmit powerUp to about 19.5 dBm (802.11b)Already at maximum by default
Receiver sensitivityAbout −98 dBm at 1 Mbit/s, about −73 dBm for fast 802.11nLower rates decode weaker signals
External dipole antenna+2 to +5 dBiA few dB better than the PCB antenna when oriented well
u.FL cable and connector−0.5 to −1 dBUse a short, good-quality cable
Drywall / wooden door−3 to −4 dB
Brick wall−6 to −10 dB
Reinforced concrete wall or floor slab−10 to −25 dBOne of the biggest losses
Human body, full water tank−3 to −10 dBWater absorbs 2.4 GHz well
Metal enclosure−20 to −40 dBIn practice it kills the link

PCB antenna orientation and placement

On the ESP32-WROOM-32 module, the antenna is the meandering track beyond the metal shield, and it's designed to have no copper underneath. Espressif's hardware design guide recommends that the antenna area overhangs the edge of the board, or that the carrier board has no copper or traces under it. Most dev boards follow this rule; problems usually start when you install the board. A battery, LCD, relay or metal screw placed right next to the antenna absorbs the signal and distorts its pattern. The antenna's radiation pattern isn't equal in every direction, so even rotating the board 90 degrees in the same spot can change RSSI by 5–10 dB. Instead of guessing the best orientation, try it with the RSSI meter code below: hold the board upright and flat, wait 10 seconds in each position and pick the one with the best average.

  • Leave at least 15 mm of clearance around the antenna area; move batteries, displays, relays and metal screws to the other end of the module.
  • When you put the board in a box, point the antenna end at the box wall or outwards, not into a bundle of cables in the middle.
  • Height helps a lot: in most homes a board mounted 1–1.5 m up gets 5–10 dB more signal than a sensor on the floor.
  • Even a breadboard's metal strips and the table legs below change the reading; do the range test where the board will finally live.

Measuring RSSI and an RSSI vs distance table

RSSI (Received Signal Strength Indicator) is the strength in dBm of the signal the ESP32 receives from the router, and it's always a negative number; the closer to zero, the better. A single RSSI reading jumps by a few dB, so the code below prints the average of 10 samples plus the lowest and highest value, and gives the result a rough rating. Turning modem sleep off during the measurement keeps the readings stable. The code also shows the connected channel, the router's BSSID and the current transmit power; getTxPower() returns units of 0.25 dBm, so the value is multiplied by 0.25.

C++ (Arduino IDE)
1// ESP32 Wi-Fi RSSI ölçer: menzil ve anten denemeleri için ortalama sinyal gücü
2// ESP32 Wi-Fi RSSI meter: averaged signal strength for range and antenna tests
3#include <WiFi.h>
4
5const char* WIFI_SSID = "WIFI_ADI";          // Wi-Fi adın / your Wi-Fi name
6const char* WIFI_PASS = "WIFI_SIFRESI";      // Wi-Fi şifren / your Wi-Fi password
7const wifi_power_t TX_POWER = WIFI_POWER_19_5dBm;   // varsayılan en yüksek; yasal sınır için düşür / default max, lower it for the legal limit
8const int SAMPLES = 10;                      // ortalama için örnek sayısı / samples per average
9
10const char* quality(int rssi) {
11  if (rssi > -50) return "Mukemmel / Excellent";
12  if (rssi > -67) return "Iyi / Good";
13  if (rssi > -75) return "Orta / Fair";
14  if (rssi > -85) return "Zayif / Weak";
15  return "Kullanilamaz / Unusable";
16}
17
18void setup() {
19  Serial.begin(115200);
20  WiFi.mode(WIFI_STA);
21  WiFi.begin(WIFI_SSID, WIFI_PASS);
22  WiFi.setTxPower(TX_POWER);                 // WiFi.begin'den sonra çağır / call after WiFi.begin
23  WiFi.setSleep(false);                      // ölçerken modem uykusu kapalı / modem sleep off while measuring
24  while (WiFi.status() != WL_CONNECTED) {
25    delay(250);
26    Serial.print(".");
27  }
28  Serial.printf("\nKanal / Channel: %d  BSSID: %s\n", WiFi.channel(), WiFi.BSSIDstr().c_str());
29  Serial.printf("TX gucu / TX power: %.2f dBm\n", WiFi.getTxPower() * 0.25);   // birim 0,25 dBm / unit is 0.25 dBm
30}
31
32void loop() {
33  if (WiFi.status() != WL_CONNECTED) {
34    Serial.println("Baglanti koptu / Disconnected");
35    WiFi.reconnect();
36    delay(2000);
37    return;
38  }
39  long sum = 0;
40  int minRssi = 0, maxRssi = -127;
41  for (int i = 0; i < SAMPLES; i++) {
42    int r = WiFi.RSSI();
43    sum += r;
44    if (r < minRssi) minRssi = r;
45    if (r > maxRssi) maxRssi = r;
46    delay(100);
47  }
48  int avg = sum / SAMPLES;
49  Serial.printf("RSSI ort/avg %d dBm (min %d, max %d)  %s\n", avg, minRssi, maxRssi, quality(avg));
50}
51
Location (relative to the router)PCB antenna, typical RSSIu.FL + 3 dBi antenna, typical RSSIStatus
Same room, 1 m−30 to −40 dBm−28 to −38 dBmExcellent
Same room, 5 m−45 to −55 dBm−42 to −52 dBmExcellent / good
1 drywall, 10 m−60 to −68 dBm−55 to −63 dBmGood
2 brick walls, 15 m−70 to −78 dBm−64 to −72 dBmFair, enough for IoT
One floor down, reinforced concrete−78 to −88 dBm−72 to −82 dBmWeak, drop-outs possible
Open field, line of sight, 50 m−72 to −80 dBm−65 to −73 dBmFair
Open field, line of sight, 150 m−85 to −92 dBm−78 to −86 dBmBorderline

These are typical ranges; the router's power, channel congestion and the building's structure shift the result by a few dB, so compare with your own measurements. The rule of thumb: a signal better than −67 dBm is comfortable for a web server or camera stream, −67 to −75 dBm is enough for IoT devices that send sensor data, below −80 dBm drop-outs begin, and around −90 dBm no connection can be made. The external antenna column shows a gain of roughly 5–7 dB over the PCB antenna, which means about twice the range in the open.

External antenna: u.FL connector and the WROOM-32U

If the PCB antenna isn't enough or the device will live in a metal box, an external antenna is the cleanest solution. The ESP32-WROOM-32U (newer version: WROOM-32UE) is the WROOM-32 without the PCB antenna, with a small u.FL (IPEX, MHF1) connector instead; software and pins are exactly the same. On dev boards carrying this module you plug in a u.FL-to-RP-SMA pigtail, fix the RP-SMA end in a hole in the box wall and screw on a 2–5 dBi rod antenna. u.FL connectors are rated for only about 30 mating cycles; don't plug and unplug the cable often, and lift it off by the connector instead of pulling the cable. When choosing an antenna, get one made for 2.4 GHz; 433 or 868 MHz LoRa antennas are useless here.

Module / boardAntennaNote
ESP32-WROOM-32 / 32EPCB antennaMost common; mind the placement
ESP32-WROOM-32U / 32UEu.FL connectorExternal antenna required, no PCB antenna
ESP32-CAMPCB antenna + u.FL, selected with a 0 Ω resistorPCB antenna by default; the bridge switches to external
ESP32-S3-DevKitC-1Uu.FL connectorExternal-antenna version of the S3
ESP32-C3 Super MiniSmall ceramic chip antennaWeak on some boards; a lower setTxPower can fix the connection

The 0 Ω resistor bridge: selecting the antenna

Some boards, such as the ESP32-CAM, have both a PCB antenna and a u.FL connector. A tiny 0 Ω SMD resistor on the antenna line decides which one is used. In one position the signal goes to the PCB antenna, in the other to the u.FL connector. To switch to the external antenna you desolder the resistor, turn it 90 degrees and solder it to the other pad; if the resistor gets lost, bridging the two pads with a small blob of solder also works. The parts are very small, so use a fine-tipped iron and a magnifier. Don't confuse this with permanent hacks such as scraping the WROOM-32's own PCB antenna and soldering on a cable; that ruins the impedance match and isn't recommended. For more on using the ESP32-CAM, see the ESP32-CAM article.

Once you've moved the resistor to the u.FL position, never run the board without an antenna attached; a transmitter output with no load can be damaged. Don't bridge both positions at once, the two antennas interfere with each other. After fitting an external antenna, set setTxPower again according to the legal power rule below.

setTxPower: setting the transmit power

Many people look for WiFi.setTxPower() to increase range, but the ESP32 already transmits at its highest power, about 19.5 dBm, by default. This function doesn't raise power, it only lowers it; there's no software way past the 802.11b hardware limit. There are three good reasons to lower it: staying within the legal EIRP limit with a high-gain antenna, reducing current peaks during transmission on a weak USB or battery supply to prevent brownout resets, and not wasting energy on devices very close to the router. On some ESP32-C3 Super Mini boards the antenna match is poor, and dropping the power to 8.5 dBm can oddly fix the connection. Call the function after WiFi.begin(); the values are constants defined in 0.25 dBm units.

setTxPower constantPowerApprox. mWMax antenna gain for 20 dBm EIRP
WIFI_POWER_19_5dBm19.5 dBm89 mW0.5 dBi
WIFI_POWER_17dBm17 dBm50 mW3 dBi
WIFI_POWER_15dBm15 dBm32 mW5 dBi
WIFI_POWER_13dBm13 dBm20 mW7 dBi
WIFI_POWER_11dBm11 dBm13 mW9 dBi
WIFI_POWER_8_5dBm8.5 dBm7 mW11.5 dBi
WIFI_POWER_5dBm5 dBm3 mW15 dBi
Don't exceed the legal limit. In the European Union and Turkey, the maximum allowed power in the 2.4 GHz Wi-Fi band is 100 mW, or 20 dBm EIRP; other countries may have different rules, so follow your local regulations. EIRP = transmit power (dBm) − cable loss (dB) + antenna gain (dBi). Off-the-shelf modules are tested against this limit with their own antennas; problems start when you change the antenna. With a 5 dBi antenna, 19.5 dBm becomes about 24.5 dBm EIRP and exceeds the limit, so lower the power to 15 dBm as in the table. A module's CE or FCC compliance only holds with the antenna types approved by the manufacturer; if you'll sell or permanently install a device with a changed antenna, stick to the antenna list in the module documentation. Don't add an external power amplifier; the legitimate way to more range is a better antenna and placement, not more power.

The effect of metal boxes, location and surroundings

A metal box acts like a Faraday cage and weakens the signal by 20–40 dB; an ESP32 with a PCB antenna inside one often can't connect at all. If you have to use a distribution board, an aluminium case or a metal water meter box, the only solution is to bring the antenna outside: use a WROOM-32U and fit an RP-SMA bulkhead connector in the box wall. Plastic and wooden boxes barely affect the signal, but watch out for metal parts inside and for screwing the box onto a metal surface. Another common problem is Wi-Fi itself: the ESP32 only uses the 2.4 GHz band, and that band is crowded. Sharing a channel with neighbouring networks causes drop-outs even when RSSI looks fine. The scanner code below lists nearby networks, their channels and signal strengths; setting your router to whichever of channels 1, 6 or 11 is emptiest gives a visible improvement in most homes.

C++ (Arduino IDE)
1// ESP32 Wi-Fi tarayıcı: çevredeki ağlar, kanalları ve sinyal güçleri
2// ESP32 Wi-Fi scanner: nearby networks, their channels and signal strengths
3#include <WiFi.h>
4
5void setup() {
6  Serial.begin(115200);
7  WiFi.mode(WIFI_STA);
8  WiFi.disconnect();          // tarama için bağlı olma / don't stay connected while scanning
9  delay(100);
10}
11
12void loop() {
13  int n = WiFi.scanNetworks();
14  int perChannel[14] = {0};   // kanal başına ağ sayısı / networks per channel
15  Serial.printf("\n%d ag bulundu / networks found\n", n);
16  for (int i = 0; i < n; i++) {
17    int ch = WiFi.channel(i);
18    Serial.printf("%2d  %-24s  kanal/ch %2d  %4d dBm\n", i + 1, WiFi.SSID(i).c_str(), ch, WiFi.RSSI(i));
19    if (ch >= 1 && ch <= 13) perChannel[ch]++;
20  }
21  Serial.print("Kanal dolulugu / Channel load: ");
22  for (int ch = 1; ch <= 13; ch++) Serial.printf("%d:%d ", ch, perChannel[ch]);
23  Serial.println();
24  WiFi.scanDelete();          // belleği boşalt / free the memory
25  delay(10000);               // 10 s'de bir tara / scan every 10 s
26}
27

When should you switch to ESP-NOW or LoRa?

If it still isn't enough after improving the antenna and placement, the problem is now Wi-Fi itself. If the distant device only sends small sensor readings, ESP-NOW is a good intermediate step: it uses the same radio but sends short packets straight to another ESP32 without joining the router, and because there's no connection setup it lasts much longer on a battery. With Espressif's Long Range (LR) mode, ESP-NOW can reach roughly a few hundred metres up to a kilometre in the open; in return the data rate drops to a few hundred kilobits per second. If the distance grows to kilometres, there are many concrete walls in between or the device must run for years on a battery, LoRa is the right choice: the sub-GHz 433 or 868 MHz bands get through walls better, but the data rate is very low and these bands have duty cycle limits. For a general comparison, see also the wireless communication modules article.

MethodTypical range (open air)Data rateRouter needed?When to choose it
Wi-Fi, PCB antenna100–200 m, 1–3 walls indoorsMbit/s levelYesWeb server, camera, cloud connection
Wi-Fi, external antenna (WROOM-32U)200–400 mMbit/s levelYesMetal box, garden, garage
ESP-NOWClose to Wi-Fi, around 200 m250 bytes per packetNoBattery sensors, remote controls
ESP-NOW + Long Range modeA few hundred metres up to about 1 km250–500 kbit/sNoFar end of the garden, field edge
LoRa (433 / 868 MHz)2–10 km rural, 1–2 km urban0.3–37 kbit/sNo (gateway optional)Kilometres of distance, years on a battery

Common mistakes and fixes

SymptomLikely causeFix
Works on the desk, drops once boxedMetal box, or battery and cables next to the antennaUse a plastic box, keep the antenna clear or bring it outside with a WROOM-32U
RSSI is fine but the link drops oftenCrowded channel or weak supplyFind a free channel with the scanner, add a 470 µF capacitor to the supply
Fitted an external antenna, signal is worseOn the ESP32-CAM the 0 Ω resistor is still in the PCB antenna positionMove the resistor to the u.FL position, never bridge both
setTxPower didn't increase the rangePower was already at maximumImprove the antenna, height and placement, not the power
ESP32-C3 Super Mini won't connectPoor antenna match, signal distorted at high powerTry WiFi.setTxPower(WIFI_POWER_8_5dBm) after WiFi.begin
Router far away, ESP32 hears it but can't connectThe router can't hear the ESP32 (one-way link)Move the router to a central spot, add a mesh node or repeater
Don't test range blind: keep the Serial Monitor open on a laptop or print the RSSI to a small OLED display, then walk around with the board. Wait 10 seconds at each spot and note the average, and you'll have a real RSSI map of your home in half an hour.

The ESP32's Wi-Fi range is usually decided not by the power setting but by the antenna's position, orientation and surroundings; good placement, an external antenna within the legal power limit where needed and a simple RSSI measurement solve most problems. To set up a Wi-Fi connection step by step, check the "ESP32 Wi-Fi STA Connection (with LCD)" project in the BlueGrays app, and to reach the device over the network the "ESP32 Async Web Server (IP shown on LCD)" and "ESP32 mDNS" projects; each walks you through the circuit diagram and code step by step.

Frequently asked questions

What is the Wi-Fi range of an ESP32?

An ESP32 with a PCB antenna usually works reliably indoors through 1–3 walls and 15–30 metres; in the open with line of sight it can reach 100–200 metres. A 3–5 dBi external antenna roughly doubles the open-air range. The result depends heavily on the router, the walls and channel congestion.

How do you connect an external antenna to an ESP32?

The easiest way is to get a board with the ESP32-WROOM-32U module, which has a u.FL connector, and attach a 2.4 GHz antenna with a u.FL-to-RP-SMA pigtail. On boards such as the ESP32-CAM, the 0 Ω resistor on the antenna line is moved from the PCB antenna position to the u.FL position. Soldering a cable onto the PCB antenna of a regular WROOM-32 module isn't recommended.

Does ESP32 setTxPower increase range?

No. The ESP32 already transmits at its highest power, about 19.5 dBm, by default, and setTxPower can only lower it. The function is used to stay within the legal limit with a high-gain antenna, to reduce current peaks or to work around antenna issues on some C3 boards.

What is a good RSSI value for an ESP32?

Values better than −50 dBm are excellent, and −50 to −67 dBm is good and enough for a web server or camera. −67 to −75 dBm is still usable for IoT devices that send sensor data. Below −80 dBm drop-outs begin, and around −90 dBm no connection can be made.

Is it legal to use an external antenna with an ESP32?

For personal experiments it's fine as long as the total radiated power (EIRP) stays within the legal limit; in the EU and Turkey that limit is 20 dBm at 2.4 GHz. As the antenna gain goes up, you must lower the transmit power by the same amount with setTxPower. Devices that will be sold or permanently installed must use the antenna types approved in the module's certification.

Wi-Fi, ESP-NOW or LoRa for long distance with an ESP32?

For web and cloud jobs that need the router, stay on Wi-Fi and improve the antenna. If you send small sensor readings up to a few hundred metres, ESP-NOW, especially in Long Range mode, works without a router. If you need kilometres of distance or years of battery life, use a LoRa module.

See all projects
LED Blink with ESP32
ES-1Beginner

LED Blink with ESP32

Teaches basic GPIO output usage with ESP32. We achieve a blinking effect by turning an LED on and off from a digital pin. ESP32 version of the classic blink project on Arduino UNO; the basic blink commands in the Arduino environment are the same, but the ESP32's pin layout and 3.3 V GPIO levels differ from those of the Arduino UNO.

4.7(38)
114
ESP32 Built-in LED Blink
ES-4Beginner

ESP32 Built-in LED Blink

Blinking the built-in blue LED on the ESP32 DevKit V1. No external components required! The first project you should try when you buy an ESP32. GPIO 2 is connected to the built-in LED.

4.8(29)
55
ESP32 Wi-Fi STA Connection (with LCD Screen)
ES-25Advanced

ESP32 Wi-Fi STA Connection (with LCD Screen)

In this project, we connect the ESP32 to the home Wi-Fi network in Station (STA) mode in a secure, fault-tolerant manner. We store the SSID and password in a separate secrets.h file to prevent leaking to Git, set up an auto-reconnect mechanism, and display the RSSI signal level and IP address on an I2C LCD screen. The internal LED works as a status indicator. It is a production-grade connection manager.

4.4(21)
41
ESP32 Asynchronous Web Server (with IP Display on LCD)
ES-27Advanced

ESP32 Asynchronous Web Server (with IP Display on LCD)

In this project, we’re turning the ESP32 into an asynchronous web server that you can control from your phone or computer on the same Wi-Fi network. Thanks to the ESPAsyncWebServer library, the server can process multiple requests simultaneously (unlike the classic WebServer.h, which blocks on a single request). You’ll be able to open the ESP32’s IP address in a browser and click the ON/OFF buttons (the /on and /off routes) to turn the LED connected to GPIO 5 on and off.

4.8(16)
27
ESP32 mDNS: Accessing the Device via bluegrays-esp.local (with LCD Screen)
ES-29Advanced
Premium

ESP32 mDNS: Accessing the Device via bluegrays-esp.local (with LCD Screen)

In this project we add an mDNS (Multicast DNS) service to the ESP32, so you reach it by a readable host name like bluegrays-esp.local instead of an IP address. Even if the IP assigned by DHCP changes, the device always answers to the same name. A small web server on the board lets you control the LED from your browser at http://bluegrays-esp.local/.

4.8(14)
23
ESP32 OTA Update — Wireless Firmware Installation (With LCD Screen)
ES-30Advanced
Premium

ESP32 OTA Update — Wireless Firmware Installation (With LCD Screen)

In this project you'll learn to upload new firmware to the ESP32 over Wi-Fi, without a USB cable. With the ArduinoOTA library the ESP32 becomes visible on the network and shows up automatically as bluegrays-ota under "Network port" in the Arduino IDE. The first upload goes over USB; after that every update is wireless, a key feature for devices out in the field.

4.6(14)
22
ESP32 HTTPClient + Weather API (with LCD Screen)
ES-31Advanced
Premium

ESP32 HTTPClient + Weather API (with LCD Screen)

In this project the ESP32 makes a REST API call over the internet to a weather API (wttr.in) using HTTPClient.h. The JSON response is parsed with ArduinoJson v7, and the city, temperature, humidity, weather and wind are shown on an I2C LCD. wttr.in needs no API key; just type the name of any city.

4.7(13)
20
ESP32 Deep Sleep — Battery Saving (OLED + RTC RAM Counter)
ES-33Advanced
Premium

ESP32 Deep Sleep — Battery Saving (OLED + RTC RAM Counter)

The ESP32's Deep Sleep mode shuts down the CPU and most peripherals, cutting current draw to about 10µA, which is vital for battery-powered IoT devices. This project uses three wake-up sources: a timer (15 s), an external pin (EXT0, the button on GPIO 33) and a touch pin (T0/GPIO 4). Counters marked with RTC_DATA_ATTR survive deep sleep.

4.3(10)
17