Arduino nRF24L01 Wireless Transmitter: Wiring, Code and Simulator
To build this Arduino nRF24L01 Wireless Transmitter project you need an Arduino Uno and a radio nRF24L01. The RF24 library sends a numbered message every second on channel 76 and says whether the receiver acknowledged it. Make the 7 connections in the wiring table, upload the Arduino C++ code, and open the receiver in a second tab and run both. Then drag the Distance slider past 60 m and watch the ACKs fail.
Open this circuit in the free Arduino Uno simulator
Parts list
| Qty | Part | What it does |
|---|---|---|
| 1 | Arduino Uno | the microcontroller board |
| 1 | Radio nRF24L01 | 2.4 GHz transceiver on SPI: VCC to 3.3 V (not 5 V), CE and CSN to any pins, SCK/MOSI/MISO to the board’s SPI pins; IRQ optional. Works with the RF24 library and MicroPython’s nrf24l01 driver. It talks to nRF24 radios in your other circuits: open the receiver in a second tab. Channel, data rate, address and payload size must match. |
Wiring
| # | From | To |
|---|---|---|
| 1 | Arduino Uno 3.3V | Radio nRF24L01 VCC |
| 2 | Arduino Uno GND | Radio nRF24L01 GND |
| 3 | Arduino Uno pin 9 | Radio nRF24L01 CE |
| 4 | Arduino Uno pin 10 | Radio nRF24L01 CSN |
| 5 | Arduino Uno pin 13 | Radio nRF24L01 SCK |
| 6 | Arduino Uno pin 11 | Radio nRF24L01 MOSI |
| 7 | Arduino Uno pin 12 | Radio nRF24L01 MISO |
Step by step
- Open the simulator. Open the BitForBytes Embedded Lab in your browser and start from the Arduino Uno. No install or account is needed.
- Add the parts. Add a radio nRF24L01 from the parts palette.
- Wire 1. Connect Arduino Uno 3.3V to Radio nRF24L01 VCC.
- Wire 2. Connect Arduino Uno GND to Radio nRF24L01 GND.
- Wire 3. Connect Arduino Uno pin 9 to Radio nRF24L01 CE.
- Wire 4. Connect Arduino Uno pin 10 to Radio nRF24L01 CSN.
- Wire 5. Connect Arduino Uno pin 13 to Radio nRF24L01 SCK.
- Wire 6. Connect Arduino Uno pin 11 to Radio nRF24L01 MOSI.
- Wire 7. Connect Arduino Uno pin 12 to Radio nRF24L01 MISO.
- Paste the Arduino C++ code. Paste the Arduino C++ code below into the code editor.
- Run it. Press Run. Open the receiver in a second tab and run both. Then drag the Distance slider past 60 m and watch the ACKs fail.
Arduino C++ code
// nRF24L01 transmitter: sends a numbered message every second.
// Open "nRF24L01 receiver" in a second tab to see it arrive.
// Wiring: VCC 3.3V, GND, CE 9, CSN 10, SCK 13, MOSI 11, MISO 12.
#include <SPI.h>
#include <RF24.h>
RF24 radio(9, 10); // CE, CSN
const byte address[6] = "00001"; // both radios must use the same address
unsigned long count = 0;
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
if (!radio.begin()) {
Serial.println("nRF24 is not answering: check VCC (3.3 V) and the SPI wires.");
while (true) {}
}
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_LOW);
radio.stopListening(); // this radio only sends
Serial.println("Transmitter ready on channel 76.");
}
void loop() {
char text[32] = "";
snprintf(text, sizeof(text), "Hello #%lu", count++);
bool ok = radio.write(&text, sizeof(text));
Serial.print(text);
Serial.println(ok ? " -> delivered (ACK)" : " -> no ACK: is the receiver running?");
digitalWrite(LED_BUILTIN, ok);
delay(1000);
}
What to try
Open the receiver in a second tab and run both. Then drag the Distance slider past 60 m and watch the ACKs fail.
Frequently asked questions
How do I wire the nRF24L01 Wireless Transmitter project on an Arduino Uno?
Make 7 connections: Arduino Uno 3.3V to Radio nRF24L01 VCC; Arduino Uno GND to Radio nRF24L01 GND; Arduino Uno pin 9 to Radio nRF24L01 CE; Arduino Uno pin 10 to Radio nRF24L01 CSN; Arduino Uno pin 13 to Radio nRF24L01 SCK; Arduino Uno pin 11 to Radio nRF24L01 MOSI; Arduino Uno pin 12 to Radio nRF24L01 MISO.
What parts do I need for this Arduino project?
An Arduino Uno and a radio nRF24L01.
Can I simulate this Arduino project online for free?
Yes. The BitForBytes Embedded Lab runs this exact circuit and Arduino C++ code in your browser for free, with no install and no hardware. The sketch is compiled with the real Arduino toolchain and runs on an emulated ATmega328P.
What does the code do?
The RF24 library sends a numbered message every second on channel 76 and says whether the receiver acknowledged it.
More Arduino Uno projects
- Arduino LED Blink: Wiring, Code and Simulator
- Arduino LDR Light Sensor: Wiring, Code and Simulator
- Arduino NTC Thermistor Thermometer: Wiring, Code and Simulator
- Arduino PWM to Analog RC Filter: Wiring, Code and Simulator
- Arduino Capacitance Meter: Wiring, Code and Simulator
- Arduino DC Motor PWM Speed Control with MOSFET: Wiring, Code and Simulator