Arduino radio link

The nRF24L01+ is a 2.4Ghz transceiver that uses the SPI serial protocol to connect to a microcontroller. The connection can be made using 5 wires, with 2 more for power (3V).

The chip allows 2-way communication at up to 2mbps, in 32-byte packets.Similar chips using the same protocols are used in wireless keyboards and mice – 1 chip in the USB receiver, and 1 in the mouse and keyboard.

The easiest way to get started is with a pre-built module. These have a 2×4 pin 0.1-inch header, so they can’t be plugged directly into a breadboard, but standard jumper wires will work. If you’re connecting the module to a breadboard, use wires with a pin on one end and a socket on the other, if connecting directly to a device like a Nano (with its own .1 inch header, use wires with sockets on each end.)

It’s best to order the modules in pairs, to avoid compatibility issues, especially when getting started. Once you have a known good system you can always swap parts out. The microcontroller should be the same type at each end – I suggest two Nanos. My first attempt used a Nano and a Raspberry pi and it didn’t work. It was difficult to work out where the problem was because there were two different programs. Ideally you use the same program and same hardware at each end.

Wiring example:

nrf24 module pins - 1 in the top left corner,8 in the bottom right corner

nrf24 module pins (from above)

The pins on the module are numbered 1 to 8, some modules will have a square solder pad or other indicator on pin 1. Otherwise, pin 1 is the pin closest to the corner of the module. If you turn the board so that pin 1 is at the top left, pin 2 is to right right, pin 3 is below.

nrf24 module wire connections

nrf24 module wire connections

I used colour-coded wires. The wires are coloured according to the resistor colour code. This makes it easier to identify the wires when you are plugging them into the breadboard – the colour corresponds to the pin number on the module.

The simplest way to connect the module to the nano is as follows (see below for a neater way)

nrf module connection (with nano board connected to ground)

If you rearrange things slightly you can get all the wires on the same side of the breadboard. This is much neater. To do this, you have to move the Nano down by one row of holes, and add a jumper wire to D13. There is room under the Nano for the wire.

2nd connection

Wires re-arranged to all connect to the same side of the breadboard

2nd connection 3

jumper wire to bring D13 to the other side

You also need to connect the power rails on the breadboard to the 3.3v output on the Nano.

2nd connection 4

Breadboard connections for Nano and nrf24 radio module

Breadboard connections for Nano and nrf24 radio module


Once you have wired up the components as shown on the breadboard (x2 boards), it’s time to switch to programming.

You could look at the chip datasheet and try to figure out what commands to send it over the serial bus, but it is a lot easier to use a library. The tmrh20 RF24 library is the current best one.Download the Arduino library from there and include it in the Arduino IDE by clicking the Sketch menu, then Include Library, then Add .ZIP Library. Then browse to the download location.

Menu to add library in Arduino

Menu to add library in Arduino

The examples for RF24 are in File -> Examples ->RF24. The example named GettingStarted is a ping-pong test between two devices. Open the example. With the wiring I described above, you have to change the line

RF24 radio(7,8);


RF24 radio(9,10);

Then the sketch is ready to be programmed for one of the boards.

For the second board, change

bool radioNumber = 0;


bool radioNumber = 1;


bool role = 0;


bool role = 1;

Now activate the serial monitor on the second board (Tools->Serial Monitor), you should see:

Now sending
Failed, response timed out.

If it’s stuck at Now sending, the microcontroller is not communicating with the nrf24 module correctly, and some troubleshooting is necessary.

Now apply power to the first board – either through USB or connect the GND and 5V between the Nano boards. You should then see on the serial monitor:

3 - Success with GettingStarted


I have modified the GettingStarted example sketch  included in the RF24 Library. It calls radio.printDetails(); at startup, and sends the results over the serial port. This allows you to see if the radio is connected correctly on each side. This sketch also writes HIGH to D2 briefly when receiving a ping/receiving the acknowledgement of a ping. D3 goes HIGH when the ping sender does not receive a response.

Download sketch for troubleshooting

Output of Print Details - good connection to radio module

Output of Print Details – good connection to radio module

Output of Print Details - bad connection to radio module - note all 0s

Output of Print Details – bad connection to radio module – note all 0s

Part2 – adding a button and LED

Useful Links


Author: Paul

Share This Post On

Leave a comment