Nrf24L01 One Rx multiple Tx's

Hi All,
I have 2 of these nRF24's transmitting data (float type) to a single receiver. I want to be able to map the data received to the particular sensor. This surely cannot be too hard?

The Transmitter code is as follows - they are the same - even using the same sensor.

#include <SPI.h>   
#include "RF24.h"  

// (Create an instance of a radio, specifying the CE and CS pins. )
RF24 myRadio(7, 8);
byte addresses[][6] = { "PipeTemp" }; // Create address for 1 pipe.
float tempC;
int reading;
int tempPin = 0;

void setup()   
	//For the LM35 Temperature sensor, use more of the ADC range

	// Use the serial Monitor (Symbol on far right). Set speed to 115200 (Bottom Right)
	myRadio.begin();  // Start up the physical nRF24L01 Radio
	myRadio.setDataRate(RF24_250KBPS); // Fast enough.. Better range
	myRadio.openWritingPipe(addresses[0]); // Use the first entry in array 'addresses' 

void loop()  
	reading = analogRead(tempPin);
	tempC = reading / 9.31;
	myRadio.write(&tempC, sizeof(tempC)); //  Transmit the data

	//Wireless Tx
	Serial.print(F("Data Transmitted = "));
	Serial.println(F(" No Acknowledge expected"));


I have a receiver that grabs the data from 2 sensors, but i can't tell which sensor it came from. There are 6 possible 'pipes', but i can't work out how to differentiate the data between the transmitters. Do i need to send the data in a different pipe? How then do i grab the data from each pipe? The received data is not time critical, it's ok to miss a few packets, but i need to be able to map the data received with the tx that sent it. Has anybody done this?

I'm using this library.



A simple solution is to include an ID number in each message that lets the receiver know which device sent the message.

Another option is to use two separate pipes on the receiver so that the two senders can send to separate addresses. This works fine if you don't have more than 6 senders. But if you have larger numbers of senders you will need the first solution.

Yet another option is to have the master poll the slaves in turn and use the ackPayload feature to return the data. That way the master knows which data comes from which slave. This mechanism is illustrated in my tutorial. However it is not suitable if the slaves spend most of their time asleep to save energy.

Simple nRF24L01+ Tutorial

I use the first of Robin2's sollutions. I am no C++ expert at all, but this is what I do:

On the transmitters and receiver:

const uint64_t pipe= {0x1AAAAAAAAALL};

I use the same "pipe" on both reveiver and transmitters.

Then, on all units:

struct dataStruct {
int sensor;
double temp;
double humidity;
double battery;
} data;

in the setup for transmitters, you give them a number each:


and 002 for the next one.

Then, in the loop on the receiver you can do

if( radio.available(&pipe)) 

          if (pipe==1){
      &data, sizeof(data) );

if (data.sensor==001) {

if (data.sensor==002) {


fantastic guys - now to see it i can get it to work!

Worked like a charm - thanks guys - i went with the provide extra info in the data packet transmitted - as a struct - and then switched according to the channel number returned.

happy days.