NRF24L01+ Multiceiver Network





Introduction: NRF24L01+ Multiceiver Network

If you're here, you probably know basically what a NRF24L01+ device is. If you have a bunch of them, and get them hooked up properly, you can theoretically create a wireless network of Arduinos (or other MC devices). Sounds easy, right? Well, I hope it will be much easier with the help of this Instructable.

If you've been trying to figure this device out, you can pretty well assume that any Sketches prior to 2014 won't work -- that is, they won't verify/ compile due to changes in the Arduino IDE. There's also a paucity of examples that actually demonstrate a network of more than two devices!

Having said that, here are some internet resources that I found exceptionally helpful in my own quest to build a NRF24L01+ multiceiver network:
(Giving all due credit)
This wiki is affiliated with and has terrific general info on the NRF24L01+. This is the place to go to learn how to make all the proper hardware connections.
You can get your hardware here, of course! The wiki (first link) makes clear that the NRF24L01+ needs good 3.3 V power -- more than what most off the shelf arduinos are designed to provide. The YourDuino RoboRed has a robust power supply that can handle these requirements. With a good voltage regulator and some capacitors, however, you can probably make most MCs work for you (also well described in the wiki).
Spec sheet for the NRF24L01+
You'll need to install the RF24 Library from this site. The examples with the library which are copyright 2014 by TMRh20 are good.
This forcetronic site has code for a three device network. My code draws very heavily from this example.

Step 1: Hardware, Software and Connections

For this network you'll need:

1. 3 - 7 MC devices (e.g. Arduino, Leonardo, etc.)

2. same number of NRF24L01+ RF devices

3. jumper wires for the connections

4. sufficient USB ports or other power source for above

5. the RF24 library from the fourth link on the prior page installed in the Arduino IDE

6. 0.1 uf capacitors recommended

The connections are laid out in detail in the first link on the prior page. Basically, the pins in the lower right corners of the diagrams above must be connected to the corresponding Arduino pins. VCC must be 3.3V and CE and CSN from the NRF24L01+ connect to pins 7 and 8, respectively, on the Arduino. The IRQ pin is unnecessary in this application. Soldering a 0.1 uf capacitor between the VCC and ground pins of the NRF24L01+ is a good idea.

Step 2: The Meat - May Be Tough and Dry

This diagram is the key to understanding how this network works. I've tried to capture the essence of it in the following paragraphs. The next paragraph is by far the most important, as well as being the easiest to follow :) The following step of the Instructable includes code that will also help clarify how this network works.

The defining multiceiver capability is having up to 6 channels (pipes) of radio communication open in a receiving (RX, or "read") mode simultaneously. This takes the form of a hub receiver (PRX - primary receiver) and up to six transmitter nodes ( PTX1 - PTX6 primary transmitters). To simplify the above diagram, six reading (Data) pipes are opened in the primary receiver hub (PRX). Each PTX node links to one of these pipes to use both in transmitting and receiving (TX toward the hub being the primary direction of data flow, but the PTX nodes are RX capable as well). Note that the hub can also "stop listening" and act as a TX, transmitting (or writing) to the PTX nodes -- but this can only be done one pipe/ node at a time.

The addresses/ pipes must have a distinct pattern of bytes: only the fifth byte is entirely unique among all the pipes and is known as the least significant byte (LSB) . Pipe 0 is assigned all five bytes independently. Pipe 1 is also assigned all five bytes independently, but then the first four bytes ( the MSB) of pipe 1 also become the first four bytes of pipes 2 - 5 (if they exist).

Given the design of the hardware and lower level software (libraries), the TX -> RX sequence follows a simple pattern within a sketch. Data payloads can be of static or dynamic length (bytes) and may also be attached to ACK (acknowledge) packets that are routinely returned from receiver back to transmitter to confirm successful transmission (ACK packets, incidentally, are more efficient than repeatedly switching between transmission and reception for two way communication). User management of network traffic largely boils down to restricting transmissions to levels that don't overwhelm RX capabilities (my very simplistic understanding). Error trapping to account for dropped or corrupt data packets, buffer overruns, etc. may also be needed to ensure data integrity.

Step 3: The Code

This example is a frivolous game in which the PRX generates a random number and the nodes try to guess the number. Its real purpose is to demonstrate the network in action.

The files in this step contain code for the PRX primary receiver (hub) and for the PTX primary transmitters (nodes)

The #define WHICH_NODE statement needs to be altered for each node. Otherwise, the node code is the same.

When running, I suggest powering the PRX first and starting the serial monitor for it. Otherwise you might miss the action!

ENJOY! And please do comment on any way in which this Instructable might be improved.

2 People Made This Project!


  • Woodworking Contest

    Woodworking Contest
  • Casting Contest

    Casting Contest
  • Planter Challenge

    Planter Challenge

We have a be nice policy.
Please be positive and constructive.




It is not clear to me if the other pins (SCK,MO,MI) should be connected

1 reply

The mostly red and black diagram lists the 8 pins of the NRF24l01 and the corresponding pins on the Arduino to which they must be connected. Only the IRQ pin is safe to ignore.

i have modified your code a little for my purpose. now i have a doubt. if all the transmitters are simultaneously sending data how it will be received by the receiver?/ whether there will be some order or so.??

thanks. it will be grateful if u reply.

1 reply

The chances of the transmitters all sending within 30 us intervals is low, and the transmitter hardware does try to resend packets for which an ACK hasn't been received (as long as you haven't disabled this feature). It is possible, however, to overload the receiver -- packets get dropped. Make sure the transmitters have delays that allow the receiver to receive all packets.

I apologize for not replying sooner.

Are you using multiple usb ports on the same pc for your rx and ptx? If so, I think that could be causing your difficulties. A test would be to use separate computers/ power sources. There should be a way to work around it, but I'm afraid I don't have an easy solution. In general, the rx should be able to continuously receive data without resetting the ptx -- as you said.

Sir, my code is stuck like this

The number they are trying to guess is: 2

when i press the reset button of all ptx ,prx starts to receive data.why is it how can i get the data without resetting arduino

2 replies

My best guess, if I understand the question, is the ptx will stop transmitting once it has guessed correctly ("done = true;"). As written, the only way to resume guessing is to reset the ptx Arduino.

actually i want to design a system containing 6 tx and 1 receiver connected to net .Each tx is connected to different sensor that continuously read data and transmit this data to cloud through central rx.if i am running your code ,whether the rx will continously receive data without resetting the arduino of ptx.?ii think my previous qtn is not clear to you .In your code i need to reset arduino of ptx or i need to open its com port to get data in rx port.why is it?

Hi, thanks for the instructable.

The primary receiver PRX is
able to listen *simultaneously* to all PTXs because the Arduino clock
is higher than 6*2.4 = 14.4Mhz, right???

1 reply

The delay in the code for the transmitters is critical. I'm not sure of the exact figures for the time it takes the PRX to receive (and acknowledge) a message, but you have to "throttle back" the transmitters with that delay so as to not overwhelm the PRX. If it takes 30 ms for one message for the PRX, it would take 180 ms for 6 PTXs. The delay factor should be substantially longer than this so the PTXs aren't "talking over one another" and the PRX is able to receive all, or nearly all, transmissions.

Once again, thanks for the answer. Yes, that is exactly i want to do. but nevertheless i have made a code and it doesnt work. This code is simple and its based in yours. Is there any way you can see the code? Because i dont know any person that can help me and i need that it works. If you cant, there isnt any problem.

Well, im from Buenos Aires, its not so far away.

Thanks, again.

I hope I understand what you're asking.
The example code basically works like this:
PRX: Listens, Gets msg and replies, Back to Listening
PTX: Sends msg, waits for reply, Delays prior to sending next msg

What you want to do:
PRX: Sends msg to PTX0, waits for reply, sends to next PTX ... loop
PTX: Listens, Gets msg and replies, Back to Listening
If that's correct, the your PTX code will be almost the same as the example PRX code -- and you'll have to write new code to make the master act more like a transmitter, sending to each node in turn.
I lived in Acassuso outside of Buenos Aires

Hi, very good! Im from Argentina, and i hope you can understund my English. I have a question about the diagram. I have made a similar code, but it doesnt work. Is the pipe to transmit from the master to the node0 the same that the pipe to transmit from the node0 to the master?

2 replies

Thank you! Yes, the pipe represents a channel for data flow that can go either way. The key is that one node must be listening while the other writes -- and then the roles are reversed. Looking at the code examples should help to clarify this. Hope this helps.
P.S. I lived in Argentina in '71-'72. Though I was young, I have fond memories. Best wishes for 2017.

Thanks for the answer. It helps. But i dont know how can i do my project. I need that all the nodes listen at the same time, and when master send data to one of them, this one can answer to the master. But, if only one node can listen, how can i do? can you help me?

Thanks for the answer, again, and where did you lived here?

Best wishes for 2017

Hi, tried it using one master: UNO Arduino and NRF24L01L and for slave: UNO Arduino and NRF24L01L. but I get the following results on the serial monitor please help:

’q$ÿ^î× \èN’Xu¶Ð&—O_ÔJ5dµ›ê.åã5d$|›Q×�L®Ä

1 reply

Managed to sort it out. change Serial.begin(115200); to Serial.begin(9600);

Hi, I'm using UNO Adruino and NRF24L01L as a Master. UNO Adruino and NRF24L01L as a Slave but I get the following on the serial monitor, please help:

’q$ÿ^î× \èN’Xu¶Ð&—O_ÔJ5dµ›ê.åã5d$|›Q×�L®Ä

1 reply

Please try using baud rate 115200 on the serial monitor.