Codey OnlineArduino & ESP32 component library › NRF24L01
NRF24L01
Communication

NRF24L01

The NRF24L01 is a 2.4 GHz wireless transceiver module for short-range data communication between microcontrollers. It connects over SPI and typically uses CE, CSN, SCK, MOSI, MISO, IRQ, GND, and a 3.3 V supply.

Width: 31.1 mm

Pinout — NRF24L01

Pin Signal Description
GND ground Ground reference for the nRF24L01 module and SPI interface.
CE enable Chip enable control for RX/TX mode operation, driven by the MCU.
CSN chip-select Active-low SPI chip select for addressing the nRF24L01.
SCK SCK SPI clock input from the microcontroller.
VCC power 3.3V power input for the nRF24L01 radio module; do not connect to 5V.
MISO MISO SPI data output from the nRF24L01 to the microcontroller.
MOSI MOSI SPI data input to the nRF24L01 from the microcontroller.
IRQ interrupt Active-low interrupt output for receive, transmit, or error events.

Example wiring diagram — NRF24L01

From To Wire
board:3.3V x1:VCC darkorange
board:GND x1:GND black
board:D9 x1:CE green
board:D10 x1:CSN blue
board:D13 x1:SCK yellow
board:D12 x1:MISO purple
board:D11 x1:MOSI cyan

Example Arduino code — NRF24L01

This example was written and compile-checked for the arduino-uno. Codey Online adapts it to any other supported board for you.

#include <SPI.h>
#include <RF24.h>

// NRF24L01 wiring on Arduino Uno:
// CE  -> D9
// CSN -> D10
// SCK -> D13
// MISO-> D12
// MOSI-> D11
// VCC -> 3.3V
// GND -> GND

RF24 radio(9, 10); // CE, CSN
const byte address[6] = "1Node";

void setup() {
  Serial.begin(115200);
  while (!Serial) {
    ;
  }

  Serial.println(F("NRF24L01 basic transmit example"));

  if (!radio.begin()) {
    Serial.println(F("Radio hardware not responding! Check wiring and 3.3V power."));
    while (1) {
      delay(1000);
    }
  }

  radio.setPALevel(RF24_PA_LOW);
  radio.setDataRate(RF24_1MBPS);
  radio.setChannel(76);
  radio.openWritingPipe(address);
  radio.stopListening();

  Serial.println(F("Radio initialized and ready to send messages."));
}

void loop() {
  const char message[] = "Hello NRF24L01";
  bool ok = radio.write(&message, sizeof(message));

  Serial.print(F("Sending: "));
  Serial.print(message);
  Serial.print(F(" -> "));
  Serial.println(ok ? F("success") : F("failed"));

  delay(1000);
}

Related components

CC1101 RF Module

CC1101 RF Module

HC-05 Bluetooth

HC-05 Bluetooth

Logic Level Shifter 4-channel

Logic Level Shifter 4-channel

Logic Level Shifter 8-channel

Logic Level Shifter 8-channel

Build your Arduino or ESP32 project with AI

Describe what you want to build. Codey Online writes the code, draws the wiring diagram, compiles it and flashes your board straight from the browser.

Start for free