Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.

nRF24L01 with Arduino Mega 2560 — a base station for five nodes

Wire an nRF24L01+ to an Arduino Mega 2560 on SPI pins 50–53 and listen to up to five sensor nodes at once on separate pipes with the RF24 library.

Arduino C++Verified — core avr 1.8.8, RF24 1.6.2, 3 Nov 2026Compile-only

Community draft — report a mistake

The Mega makes a good “base station” for a wireless sensor network: it has the pins for an LCD, an SD card and an Ethernet or GSM link alongside the radio. The nRF24L01+ wires to the Mega’s SPI pins 50–52, with CE on 48 and CSN on 53.

The sketch opens five reading pipes, one per node, and prints which node sent each value. Pair it with Nano or Pro Mini nodes that send a reading every few seconds.

Wiring

Arduino Mega 2560Only the pins used are shown · 5 V logicnRF24L01+ 2.4 GHz transceiver3.3VGNDD48D50D51D52D53GNDVCCCECSNSCKMOSIMISOIRQ (not connected)
Also needed: 10 µF capacitor at the radio.
Every connection
Arduino Mega 2560nRF24L01+ 2.4 GHz transceiverWireNotes
GNDGNDblack
3.3VVCCredBasic module only, with 10 µF across VCC/GND at the radio. PA+LNA modules need their own 3.3 V regulator.
D48CEorange
D53CSNpurple
D52SCKyellow
D51MOSIgreen
D50MISOblue

1.9–3.6 V — use 3.3 V part, 5 V board. VCC must be 3.3 V: 5 V destroys it. The signal inputs are 5 V tolerant, so an Uno can drive SCK, MOSI, CSN and CE directly; MISO is a 3.3 V output that every board reads fine.

Board quirks

  • SPI on the Mega: 50 MISO, 51 MOSI, 52 SCK. CSN on 53 also keeps the SS pin an output, which SPI master mode needs.
  • The Mega’s 3.3V pin is a real regulator (about 50 mA) — enough for a basic nRF24L01+ with a capacitor, unlike a CH340 Nano’s 3V3.
  • One radio listens on up to six pipes. Pipes 2–5 may only differ from pipe 1 in the first byte of the address — “NODE1” … “NODE5” follows that rule.
  • Each node runs the transmitter side of the Nano nRF24 guide with its own address and the same channel, data rate and payload size.

Code

nrf24l01-mega.inoArduino C++Open in PlaygroundOpen in Playground
// nRF24L01+ on an Arduino Mega 2560 as a base station that listens to up to 5 sensor nodes.
// CE → D48, CSN → D53, SCK → D52, MOSI → D51, MISO → D50, VCC → 3.3V (10 µF at the radio), GND.
// Each node sends a 4-byte value on its own address: "NODE1" ... "NODE5".
#include <SPI.h>
#include <RF24.h>

RF24 radio(48, 53);  // CE, CSN
const uint8_t ADDR[5][6] = {"NODE1", "NODE2", "NODE3", "NODE4", "NODE5"};

void setup() {
  Serial.begin(115200);
  if (!radio.begin() || !radio.isChipConnected()) {
    Serial.println(F("nRF24 not responding - check 3.3V and pins 48/50-53"));
    for (;;) {}
  }
  radio.setPALevel(RF24_PA_LOW);
  radio.setDataRate(RF24_250KBPS);
  radio.setChannel(108);
  radio.setPayloadSize(sizeof(long));
  for (uint8_t i = 0; i < 5; i++) radio.openReadingPipe(i + 1, ADDR[i]);  // pipes 1-5
  radio.startListening();
  Serial.println(F("Base station listening on pipes 1-5"));
}

void loop() {
  uint8_t pipe;
  if (radio.available(&pipe)) {
    long value;
    radio.read(&value, sizeof(value));
    Serial.print(F("Node "));
    Serial.print(pipe);
    Serial.print(F(": "));
    Serial.println(value);
  }
}

Library: RF24 (TMRh20) — compiled with RF24 1.6.2.

Expected serial output

Serial Monitor · 115200Output
Base station listening on pipes 1-5
Node 1: 2741
Node 3: 1198

Common errors

nRF24 not responding

SPI on 11–13 (Uno habit) or VCC on 5V. Full fix.

Only node 1 is heard

Other nodes’ addresses differ in more than the first byte, or their payload size doesn’t match.

↑↓ to move · Enter to open