Back to Explorer

esp32-nRF24-example

Project Information

Author

Mikrobot.pl

Board

ESP32 Dev Module

SDK Version

3.3.6

Platform

ESP32

Created

Updated

Description

Test an nRF24L01 radio module via WiFi with a captive portal

Flash to Device

Login required: You need to login or create an account to flash this project.

Sorry, your browser doesn't support Web Serial.Web Serial requires HTTPS.

README

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
  • Captive portal
    • Any URL request (e.g. google.com) is redirected to the test page
    • Works with Android / iOS / Windows / Linux
  • Automatic module self-test performed at boot and on demand
    • radio.begin() – SPI initialization
    • isChipConnected() – 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

  1. Power the ESP32. It runs a self-test immediately at boot.
  2. On your phone/laptop, connect to the open WiFi network ESP32-nRF24-Test.
  3. The captive portal page should pop up automatically. If not, open a browser and go to http://192.168.4.1
  4. Read the verdict:
    • 🟩 MODULE OK β€” ALL TESTS PASSED β†’ the module and wiring are good.
    • πŸŸ₯ MODULE FAULT β†’ follow the on-screen troubleshooting hints.
  5. 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).