nrf24l01 module

Arduino networking – nrf24l01(P/+)


What do you want to do with several Arduino not being connected? – Right, nothing.

In order to do fancy stuff in a sensornet manner or regarding smart objects/the internet of things, we need to have them communicating. This may be done is various ways. Wired as per I2C is quite complicated as the range is probably very limited. Wired connections in general are not very convenient.

Fortunately, there are cheap wireless modules available. I have already used chips for 433MHz communication – but this requires you doing everything manually (more on this in another post). Now, I want to focus an the nrf24l01+ chip being available for about 1$ on Ebay. Key features are:

  • 2.4GHz ISM band (128 channels)
  • 250kpbs, 1mbps or 2mbis operation (the first option will increase the wireless range the most)
  • built-in 16bit CRC
  • up to 6 channel multiceiver: 6 different logical channels on which you may receive data simultaneously
  • automatic packet handling (ack, retransmit)
  • … lots more – see the datasheet for more information

Basic operation

The chip may be used out of the box and ready-to-use libraries enable even novice users to send data wirelessly between their Arduinos. There are several libraries available, however I have used this one.

After fiddling around for hours, a lot of frustration and having tried several libraries, I found out that the device is very sensitive to a wonky power source. Adding a 2.2uF cap fixed this issue – you may add an even bigger one between GND and VCC [note: the device only likes 3.3VDC – bigger voltages may harm it].

Here is a comparison of the voltage between running a device without and with cap [the pink input (#8) shows the voltage; Note that it is set to 500mV – i.e. the is nearly no difference…]:

withoutCapVoltage without the 2.2n Cap. withCapVoltage with the 2.2n Cap.

PIN connections

NRF24L01(+) PINs

NRF24L01(+) PINs


The general PIN layout is quite simple. Remember adding a cap to the voltage source.

Here is the PIN setup:

Type nrf24 PIN Arduino Mega 2560 Arduino UNO/Nano
VCC 2 3V3 3V3
CE 3 9 9
CSN 4 10 10
SCK 5 52 13
MOSI 6 50 11
MISO 7 51 12


The general setup with the RF24 library is simple. You want to start with the following:

The communication between the devices is based on so called pipes. You may use up to six (0..5) different pipes for receiving data simultaneously of which each pipe gets assigned a unique 40bit address. You Only may write on a single pipe – #0.

Receiving data

As mentioned, we will assign an address to a pipe for receiving data on this address. This may be done as follows:

Then, actual receiving may be done in the main loop as follows:

Sending data

As simple as the receiving is, as simple as that is sending data:

Possibilities & drawbacks

Using these devices is quite straight forward as soon as you have understood the logic behind the pipes and the reading/writing operations.

As the dives supports six logical channels, you already are able communicating in a full mesh manner with up to five other network participants. This already gives you the drawback – communication with more devices involves a lot better ideas.

Thinking about larger networks and the devices capabilities, you probably end up with ideas alike:

  • Do not use automatic packet handling, do everything manually and only use one single broadcasting channel (undesired)
  • Usesomekindofmultihop routing
    • A self assigning topology is not trivial, there has been done lots of reasearch about this topic, try google scholar. Imho unfeasible.
    • A predefined topology (like used here) may only be used in a fixed scenario where all nodes are failsafe – otherwise, your routing tree will be split.
    • Use a basic broadcast channel for unconfirmed beacon provisioning (also involves some medium access methods) and combine this with the possibility listening on other addresses. A simple approach may not use all logical channels, but we at least are able to use the built-in packet handling techniques and we do not have to care about lost packets, acks or packets out-of-order anymore. Yay! – I look forward to posting my results about this soon.
Using a broadcast and two separate channels for direct communication.

PREVIEW: Using a broadcast and two separate channels for direct communication.

Leave a Reply