esp32-nRF24-example
Flash to Device
Login required: You need to login or create an account to flash this project.
Source Files (3)
Download AllREADME
ESP32 nRF24L01+ Captive Portal Tester
Test an nRF24L01+ PA/LNA 2.4 GHz radio module over WiFi with a captive portal
This project turns an ESP32 Dev Board into a diagnostic tool for the nRF24L01+ ISM 2.4 GHz module with power amplifier (PA/LNA) and external antenna. When powered, the ESP32 creates an open WiFi Access Point and a captive portal. As soon as a device connects to the AP, a page appears showing whether the radio module is correctly wired and working.
β Features
- Open WiFi Access Point (no password)
- SSID:
ESP32-nRF24-Test
- SSID:
- Captive portal
- Any URL request (e.g.
google.com) is redirected to the test page - Works with Android / iOS / Windows / Linux
- Any URL request (e.g.
- Automatic module self-test performed at boot and on demand
radio.begin()β SPI initializationisChipConnected()β verifies the chip answers over SPI (catches wiring / power faults)isPVariant()β confirms it is a genuine nRF24L01**+** (250 kbps capable)- Channel register write / read-back
- Data-rate (250 kbps) register write / read-back
- Reports current data rate and PA power level
- Clear PASS / FAIL verdict with a troubleshooting hint box
- "Run test again" button to re-test after fixing wiring
- No external network or internet required
π¦ Hardware requirements
- ESP32 Dev Board (e.g. ESP32-DevKitC)
- nRF24L01+ PA/LNA module with external (SMA) antenna
- Recommended: a 10β100 Β΅F electrolytic capacitor across the module's VCCβGND (or an nRF24 adapter/breakout board with a voltage regulator)
β οΈ Power warning: the PA/LNA version draws short high-current spikes when the amplifier transmits. Powering it directly from the ESP32's 3.3 V pin without a capacitor is the #1 cause of
FAIL/ unstable results. The module is 3.3 V only β never connect VCC to 5 V.
π Wiring (nRF24L01+ β ESP32)
The ESP32 uses its hardware VSPI bus. The SPI pins are fixed; CE and CSN
are user-selectable (defaults below).
| nRF24L01+ pin | Function | ESP32 pin |
|---|---|---|
| 1 Β· GND | Ground | GND |
| 2 Β· VCC | Power 3.3 V only | 3V3 |
| 3 Β· CE | Chip Enable | GPIO 4 |
| 4 Β· CSN | SPI Chip Select | GPIO 5 |
| 5 Β· SCK | SPI Clock | GPIO 18 (VSPI SCK) |
| 6 Β· MOSI | Master Out | GPIO 23 (VSPI MOSI) |
| 7 Β· MISO | Master In | GPIO 19 (VSPI MISO) |
| 8 Β· IRQ | Interrupt | not connected |
nRF24L01+ (top view, pins facing you)
+-----------------+
8 | IRQ MISO | 7
6 | MOSI SCK | 5
4 | CSN CE | 3
2 | VCC GND | 1
+--------[ ant ]--+
Add the capacitor as close to the module's VCC/GND pins as possible:
3V3 βββ¬ββββββββ VCC (nRF24)
β
ββͺβ 10β100 Β΅F (+ leg to VCC)
β
GND βββ΄ββββββββ GND (nRF24)
You can change CE / CSN in the sketch:
#define CE_PIN 4 // Chip Enable
#define CSN_PIN 5 // SPI Chip Select
βΆοΈ Usage
- Power the ESP32. It runs a self-test immediately at boot.
- On your phone/laptop, connect to the open WiFi network
ESP32-nRF24-Test. - The captive portal page should pop up automatically. If not, open a browser and go to http://192.168.4.1
- Read the verdict:
- π© MODULE OK β ALL TESTS PASSED β the module and wiring are good.
- π₯ MODULE FAULT β follow the on-screen troubleshooting hints.
- Fix any issue, then press "Run test again" to re-check.
π§ͺ What the tests mean
| Test | What it proves |
|---|---|
SPI init (radio.begin) |
The SPI bus started. |
| Chip responds (SPI link) | The chip actually answers. Fails on bad wiring, dead MISO, no power. |
| nRF24L01+ variant | It is a real "+" chip (not a broken clone). |
| Channel write/read-back | Both the write and read SPI paths work. |
| Data-rate 250 kbps write/read | The + low-rate mode is accepted β a strong health indicator. |
π©Ί Troubleshooting
- "Chip responds" fails β check every SPI wire, common GND, and the 3.3 V supply.
- Random / intermittent FAIL β almost always power: add the 10β100 Β΅F capacitor or use a dedicated nRF24 adapter board.
- "Variant" fails but chip responds β likely a counterfeit or damaged module.
- Nothing on SPI β confirm SCK=18, MISO=19, MOSI=23, CE=4, CSN=5 and that the module is 3.3 V (not 5 V).