How to Choose an Antenna for ESP32 and LoRa Projects

A practical guide to choosing antennas for ESP32 and LoRa student builds: PCB, chip, whip and external antennas compared, gain and radiation pattern explained in plain terms, 2.4 GHz vs 868/915 MHz, impedance matching and VSWR, ground planes, connectors, placement mistakes, and a repeatable RSSI walk test to prove which antenna works best.

Written by Projectech15 min readPublished
For Electronics, E&TC and IoT students building ESP32 Wi-Fi/Bluetooth or LoRa sensor nodes who need reliable wireless range in academic and hobby projects. Topics: ESP32, LoRa, Antennas, RF, IoT
Blueprint-style technical illustration of ESP32 and LoRa antennas: a whip antenna, a PCB trace antenna, a chip antenna and radio waves radiating from a small circuit board, drawn in dark blue line art on white graph paper.
Illustration generated for this guide.
In this guide

How to Choose an Antenna for ESP32 and LoRa Projects

Your ESP32 connects fine on the bench and drops out the moment you put it in an enclosure. Your LoRa node reaches 200 metres in one direction and barely 30 in another. In both cases the radio is usually fine — the antenna is the problem. Most student projects treat the antenna as an afterthought, a small part soldered on at the end. In reality it is half the radio system, and a poor choice can cost you more range than a better chip ever gains back.

This guide explains the antenna types you will actually meet in student builds — PCB trace, chip, whip and external — what gain and radiation pattern mean in plain terms, how the 2.4 GHz and 868/915 MHz bands differ, and the practical rules for impedance matching, ground planes, connectors and placement. You will finish with a simple range test you can run yourself, so you can prove which antenna works best on your board instead of guessing.

Quick Answer

Pick by range and enclosure, not size. For short-range ESP32 Wi-Fi or Bluetooth in a plastic case, the built-in PCB antenna is usually enough. For a LoRa link across a campus, use an external whip tuned to your exact band (868 or 915 MHz), mounted vertically, clear of metal and batteries. Match impedance to 50 ohms and test range with an RSSI walk test.

Why the antenna matters more than the radio

A radio module's datasheet quotes its transmit power and receiver sensitivity, and those numbers look impressive. But the antenna decides how much of that power actually leaves the board as a radio wave, and how much of an incoming wave is converted back into a signal the receiver can use. A badly matched or badly placed antenna can throw away 10 dB or more — that is roughly a factor of ten in power — which is like turning a 100 mW transmitter into a 10 mW one.

Three things decide whether your link works in practice: the antenna's efficiency (how much power it radiates instead of heating up), its radiation pattern (which directions it radiates in), and its impedance match to the radio (how much power reflects back instead of radiating). The rest of this guide works through each of those, then turns them into buying and placement decisions.

The four antenna types you will actually use

1. PCB trace antenna

A copper trace on the circuit board itself, shaped into a meander or inverted-F pattern. This is what most ESP32 development boards ship with. It costs nothing extra, adds no height, and works well for Wi-Fi and Bluetooth across a room or a small flat.

Its limits are real: it is tuned for one band (2.4 GHz), it needs a specific ground-plane shape and a keep-out zone with no copper and no components under it, and its efficiency is typically lower than a whip. It is also the most sensitive to its surroundings — put a battery or a metal plate next to it and its tuning shifts. Use it when range is short and the board layout follows the manufacturer's reference design.

2. Chip antenna

A tiny ceramic block, a few millimetres across, soldered onto the board like any other component. Chip antennas are common in compact products — wearables, small sensor nodes, anything where a PCB trace would take too much board space.

They behave much like PCB antennas: decent for short range, strongly affected by the ground plane and nearby objects, and they need a matching network (usually two or three small capacitors and an inductor) tuned on your actual board. A chip antenna copied from a reference design without re-tuning often performs worse than the PCB antenna it replaced. Choose one when board space is tight and you can follow the manufacturer's layout guide exactly.

3. Whip antenna

The classic straight rod, usually a quarter-wavelength long, that screws onto an SMA connector. A 2.4 GHz whip is about 3 cm long; an 868 MHz whip is about 8–9 cm. Whips are the default choice for LoRa nodes and for any ESP32 project that needs real range, because they are efficient, omnidirectional in the horizontal plane, and easy to swap.

A whip needs a ground plane to work against — a metal surface or a ground pour of roughly a quarter wavelength in radius. On a small sensor node that ground plane is often the board itself, which is why whip performance varies so much between builds. Mount it vertically for the best horizontal coverage, and keep it away from the battery and the enclosure walls.

4. External and directional antennas

When a whip is not enough, external antennas come in two families. Omnidirectional external antennas (a longer whip, a fibreglass-encased dipole, a magnetic-mount antenna on a metal roof) give more gain in the horizontal plane and are used for gateways and base stations. Directional antennas (a Yagi or a small patch) concentrate their energy in one direction and are used for point-to-point links — for example, a LoRa link between two fixed buildings.

Directional antennas are a trap for beginners: they give impressive range in one direction and almost nothing behind them, so a node that moves, or a gateway that serves nodes in every direction, will perform worse with one. Use directional antennas only for fixed point-to-point links where you can aim them.

Antenna type Typical use Range character Needs
PCB trace ESP32 Wi-Fi/BLE, short range Short, omnidirectional Correct ground plane + keep-out
Chip Compact nodes, wearables Short, omnidirectional Exact layout + matching network
Whip LoRa nodes, ESP32 with range Medium, omnidirectional Ground plane, vertical mounting
External/directional Gateways, fixed links Long, one direction Aiming, mounting, low-loss cable

Gain and radiation pattern, in plain terms

Gain, quoted in dBi, describes how much an antenna concentrates its radiated power in its best direction compared with a theoretical antenna that radiates equally in all directions. A 2 dBi whip and a 5 dBi whip fed the same power do not radiate more total energy — the 5 dBi one squeezes the same energy into a flatter, wider disc, so it reaches further sideways and less above and below.

That trade-off is the whole point of the radiation pattern. A low-gain antenna (2 dBi) radiates roughly like a doughnut: good coverage in all horizontal directions and reasonable coverage above and below. A high-gain antenna (8–9 dBi) radiates like a flat pancake: long horizontal reach, but a node directly above or below the gateway may sit in a dead zone. For student projects, a 2–3 dBi antenna is the safe default — it forgives sloppy positioning. Reserve high-gain antennas for fixed gateways where every node is roughly at the same height.

Two practical consequences follow. First, antenna gain is not free range — doubling the gain in dBi terms does not double the range, and it narrows the angles that work. Second, the orientation of the antenna matters as much as its gain: a whip lying flat radiates mostly upward and downward, which is why a node with a horizontal antenna often cannot hear a gateway with a vertical one.

2.4 GHz vs 868/915 MHz: different bands, different antennas

ESP32 Wi-Fi and Bluetooth live at 2.4 GHz. LoRa in India and Europe uses 868 MHz, and in the Americas 915 MHz. The frequency sets the antenna's physical size, because a resonant antenna is a fixed fraction of the wavelength: a quarter-wave whip at 2.4 GHz is about 3 cm, while at 868 MHz it is about 8.6 cm. You cannot use a 2.4 GHz antenna on an 868 MHz LoRa module and expect it to work — the mismatch is so large that most of the power reflects back into the radio.

The bands also behave differently. The 2.4 GHz band is crowded (Wi-Fi, Bluetooth, microwave ovens) and its signals are absorbed more easily by walls and foliage, but its short wavelength makes compact antennas easy. The 868/915 MHz bands are quieter and penetrate obstacles better, which is why LoRa reaches kilometres where Wi-Fi reaches tens of metres — but the antennas are physically larger and the data rate is far lower. Choose the band by the job (LoRa for long range and tiny messages, Wi-Fi for short range and large data), then buy an antenna tuned to that exact band, and check the label: an antenna sold as "868/915 MHz" is a compromise covering both, while one sold as "868 MHz" is tuned for that band alone.

Impedance matching and VSWR basics

A radio expects to see a 50-ohm load at its antenna port. An antenna that presents 50 ohms at its operating frequency transfers power cleanly; one that presents something else reflects part of the power back toward the radio. The ratio of reflected to forward power is captured by VSWR (voltage standing wave ratio): 1:1 is perfect, 1.5:1 is good, 2:1 is acceptable for a student build, and anything above 3:1 means a large share of your power is bouncing back and heating the output stage instead of radiating.

You do not need a network analyser to get this right. The practical rules are:

  • Buy antennas specified for 50 ohms and for your exact band.
  • Keep the trace between the radio and the antenna connector short, and route it as a 50-ohm controlled-impedance trace (your board's reference design or a trace-width calculator gives the width for your board stack-up).
  • If the module has a matching network (a pi-network of capacitors and an inductor near the antenna port), do not change its values without measuring — the defaults are tuned for the reference antenna.
  • A U.FL connector with a short pigtail to an external antenna is fine; a long thin coax cable is not. Coax loss at 2.4 GHz is significant — a metre of thin RG-178 can lose several dB — so keep the cable as short as possible and use thicker cable (RG-58 or LMR-100) for any run longer than about 30 cm.

If your link underperforms and you have ruled out placement, a cheap SWR meter or a borrowed vector network analyser will tell you in minutes whether the antenna is actually resonant at your frequency. Many college RF labs have one — it is worth asking.

Ground plane and keep-out rules

A monopole antenna (whip, PCB trace, chip) does not work alone: it works against a ground plane, a flat sheet of copper that acts as the other half of the antenna. Without an adequate ground plane, the antenna's resonant frequency shifts, its impedance changes, and its efficiency drops.

The rules that matter on a student board:

  • Give a PCB antenna the keep-out zone the datasheet asks for — typically no copper, no components and no traces under or beside the antenna area, on all layers.
  • Keep the ground plane under a chip or PCB antenna continuous; a slot or a cut in the ground plane under the antenna changes its tuning.
  • For a whip on a small board, the board's ground pour is the ground plane. A larger pour generally helps, up to about a quarter wavelength in radius.
  • Never put a battery, a metal shield or a display directly behind or beside the antenna. Metal within a few centimetres detunes the antenna and blocks radiation in that direction.

If you are designing your own PCB, copy the antenna section of the manufacturer's reference design exactly — ground-plane size, keep-out dimensions and matching-network values. Antenna layout is one of the few places where copying is not a shortcut, it is the correct engineering method.

Connectors and coax: small parts, real losses

Most student builds meet three connectors. SMA is the large screw connector on LoRa modules and gateways; RP-SMA is the same size with the pin and socket swapped, and the two do not mate correctly — check which one your module uses before ordering an antenna. U.FL (also sold as I-PEX) is the tiny snap connector on ESP32 modules with an external antenna option; it is rated for only a few mating cycles, so connect it once and leave it alone.

Coax cable between the module and the antenna loses signal, and the loss grows with frequency and length. At 868 MHz a short pigtail loses very little; at 2.4 GHz the same pigtail loses noticeably more. The rule is simple: mount the antenna as close to the radio as the design allows, use the shortest cable that reaches, and never coil excess coax into a loop near the antenna — the coil becomes part of the antenna system and detunes it.

Placement mistakes that kill range

Most antenna problems in student projects are placement problems, not antenna problems. The common ones:

  • Inside a metal enclosure. A metal box is a Faraday cage — almost no signal gets out. Use a plastic enclosure, or mount the antenna outside the metal box on a short cable.
  • Next to the battery. A lithium cell is a large metal object that detunes the antenna and blocks radiation. Keep at least a few centimetres between the antenna and the battery, and never sandwich the antenna between the battery and the board.
  • Flat on the board, or pointing at the gateway. A whip radiates least along its own axis. If the antenna points directly at the gateway, the gateway sits in the antenna's weakest direction. Mount whips vertically when the other end is at a similar height.
  • Buried under a display or a heatsink. Anything conductive above the antenna absorbs or reflects the signal. Keep the antenna area clear on all sides.
  • Two antennas too close together. An ESP32 with Wi-Fi and a LoRa module on the same board needs separation between the two antennas — a few centimetres at minimum — or each will detune the other and the receivers will desensitise each other.

A simple range test: the RSSI walk test

Do not trust a single "it worked from my room" result. Run a repeatable test before you finalise the enclosure:

  1. Put the transmitter in a fixed spot, with the antenna in its final position and the enclosure closed.
  2. Program the receiver to print the RSSI (received signal strength) of each packet it hears, and log it with a timestamp. A short Python script on a laptop connected to the receiver is enough.
  3. Walk away from the transmitter in a straight line, pausing every 10–20 metres to record the RSSI for a minute. Note walls, trees and buildings between the two ends.
  4. Repeat the walk with each antenna you are comparing, on the same path, at the same time of day.
  5. Compare the distance at which packets start dropping (not just where RSSI falls — a link that delivers 50% of packets is not a working link).

A typical student bench example: on a clear line across a college ground, a 2 dBi whip on an 868 MHz LoRa node might hold a clean link for several hundred metres, while the same node with a mismatched 2.4 GHz antenna on the same module may struggle past a few tens of metres. Your numbers will differ with terrain and interference — the point of the test is that the comparison is made on your hardware, on your site, with the same method.

# Log RSSI from a serial-connected receiver for a walk test
import serial

ser = serial.Serial('/dev/ttyUSB0', 115200, timeout=1)
with open('rssi_walk.csv', 'w') as f:
    f.write('time,rssi\n')
    while True:
        line = ser.readline().decode(errors='ignore').strip()
        if line.startswith('RSSI'):
            print(line)
            f.write(line.replace('RSSI ', '') + '\n')

Record the test conditions alongside the numbers — antenna type, height above ground, enclosure open or closed, and obstacles. Without those notes the results are not repeatable, and you will not be able to explain a regression when you change the enclosure a week later.

FAQ

Can I use the ESP32's built-in PCB antenna for a LoRa project?
No. The built-in antenna is tuned for 2.4 GHz Wi-Fi and Bluetooth. A LoRa module at 868 or 915 MHz needs its own antenna tuned to that band, usually connected through a U.FL or SMA connector.

Will a bigger antenna always give more range?
No. A physically larger antenna is usually tuned for a lower frequency, not for more gain. At the same frequency, a higher-gain antenna gives more range in its best direction but less coverage above and below. For a node that moves, a modest 2–3 dBi antenna usually beats a high-gain one.

Does the antenna need to match the module brand?
No, it needs to match the frequency band, the impedance (50 ohms) and the connector type. Any antenna meeting those three is compatible.

Can I test an antenna without expensive equipment?
Yes — the RSSI walk test in this guide is the practical method. It tells you which antenna performs best on your board in your environment, which is the answer that matters. A network analyser adds precision, but it is not required to choose between two antennas.

Why does my link work on the bench but fail in the enclosure?
The enclosure changes the antenna's environment: plastic shifts tuning slightly, metal blocks the signal almost entirely, and a battery pressed against the antenna detunes it. Always run the range test with the enclosure closed, in its final configuration.

Is a 915 MHz antenna usable in India?
India's LoRa band is 865–867 MHz, so use an 868 MHz antenna. A 915 MHz antenna is mistuned at 868 MHz and will perform poorly. Buy the antenna for the band you are legally allowed to use.

Limitations

This guide covers the antenna decisions in typical student builds — it is not a substitute for RF design. It does not cover phased arrays, MIMO antenna design, or antenna simulation in tools such as CST or HFSS. If your project needs a custom antenna on a custom PCB, simulate the design and measure it with a network analyser before committing to fabrication; rules of thumb will not be enough. Finally, remember that regulations limit transmit power and duty cycle in the licence-free bands — a high-gain antenna on a transmitter running at its legal power limit can exceed the legal radiated power, so check the rules for your band before adding gain.

More project guides

More in IoT & Embedded