communication between multiple nrf24l01 modules.

Hi, I'm new to arduino wirless communication and know only a little bit about nrf24l01 modules. actually in my project, there will be one receiver and six nodes. when we program all the receiver nodes must have same code (all should contain same pipe address). once we switch on in the first run the receiver node shoul assign ids for each node and send unique and new ids (address) to each node, so that this new addresses will be used as the pipe address of each node. how can i do it. any response will be appreciated. sorry if i didn't explain my question clearly.

Have a look at this Simple nRF24L01+ Tutorial. I have included an example that communicates with 2 slaves and that can easily be extended.

I think to allocate IDs the way you want you will need to activate each slave one at a time so that there is no confusion about which one the master is talking to. The master could have a pre-programmed list of IDs that it allocates in turn to each new slave. if you reserve one ID for the virgin slaves then if the master gets a message from a slave with that ID it will know that it is a virgin and that it should supply the next available ID and then test that the new ID works.

You should have some fall-back plan so that if a slave is given a new ID that does not work the slave will revert to the virgin ID.

I am assuming in all of this that the master initiates all communications as that avoids the problem of data collisions. But that may not be appropriate if the slaves need to be asleep for most of the time to minimize battery power.

If the slaves need to initiate communication you probably don't need separate nRF24 IDs at all. You could just include an identifier byte as part of the message and let the response from the master be heard by all the slaves. Only the slave with the correct identifier will take notice of reply. Again, a virgin slave could have a special identifier that marked it as a virgin so that the master could send a unique identifier for future use. When a slave receives its unique identifier byte it can save it to EEPROM memory. Again, you system should be designed to test that the new identifier works.

...R

Thank you very much Robin. the article you wrote helped me to understand the fundamental concepts. I'm trying the same way as you suggested above, master contains six addresses initially communication is started using one default address then master should write the id on sensor. the problem, I face is two way communication between master and slave in multiceiver mode. sensor nodes are able to send the data to the master but master can't write anything (eg. id no or address) on slave node.

most precisely my question is, is it possible to do two way communication between master and sensor (master and slave should act as both transmitter and receiver)?

sangar:
most precisely my question is, is it possible to do two way communication between master and sensor (master and slave should act as both transmitter and receiver)?

YES. The nRF24 is a transceiver. My 2nd and 3rd examples are for 2-way communication.

In your Original Post you posed a very specific (and somewhat unusual) requirement.

I suggested some options in Reply #1 and you have not responded to them so I don't want to offer more comments that may just confuse things further.

...R

Thanks for your time and valuable comments robbin. In my case I'm using multiceiver mode(One master and six slaves communicating using 6 pipes).(slave initiates the communication in my case for that) You suggested me to use same IDs for each slave and use a header to identify from which sensor the data is coming, however my slave nodes will wake and sleep (sleep time 30 mins).[/i]".However multiceiver mode is the solution to avoid data collision problems.

There was a mistake in my last question corrected question is as follows."most precisely my question is, is it possible to do two way communication between master and sensor (master and slave should act as both transmitter and receiver in multiceiver mode?".

thanks again for your valuable response.

What do you mean by "multiceiver mode". I am aware that the TMRh20 libraries include a Network mode and a Mesh mode but I don't recall "multiceiver".

I don't understand why you are using 6 pipes if you want all the slaves to be identical. Remember that an nRF24 has only one wireless. The idea of pipes can be a bit confusing. Think of them as 6 shelves onto which the mail for different residents in an apartment block can be placed. All the letters come through the same mail slot (the radio receiver listening on Channel N) and when they fall on the floor someone picks them up, looks at the name of the recipient (the address the message was sent to) and puts them on the correct shelf (the pipe that has been assigned the same address as the message) or shreds them if they are for a recipient who lives in another block (i.e. if they are for an address that is not assigned to any of the pipes on this nRF24)

It would be easier to help if you explain what your project is all about. At the moment this is an XY problem

...R

I did not know you were referring to the NRF24L01+ datasheet.

I am still completely confused because you have not explained what your project is all about. I suspect there is no need to use that multiceiver mode.

You said you want the code in each slave to be the same, and if so, how could each one have a different address for communicating with the master.

...R

I thing the OP wants to end up in a multiceiver configuration, with addresses managed by the master.

The node addresses of 5 of the six nodes communicating in this fashion have to share the top 4 bytes,
so for simplicity I would use addresses that differ only in the lowest byte.

BTW. If the master has to distribute addresses via a well know address, that leaves only 5 pipes for configured nodes.

To get over the 5 nodes limitation I would use a polling scheme, with a list of active nodes in RAM,
not in the pipeaddress registers.

Whandall:
I thing the OP wants to end up in a multiceiver configuration, with addresses managed by the master.

I agree that that is what he seems to think he needs. But I remain to be convinced that it is either necessary or desirable. My guess is that he thinks each pipe has a separate receiver.

...R

[OT]

I use the multiceiver feature to differentiate slots for announces, data broadcast, config, ...
all of these common pipes without acknowledge, so every node can listen if it chooses to.

Of course I have a personal address with acknowledgement for each node.

All my nodes use the same 4 byte prefix, so basically one can ignore the upper part.
I did not even run out of ASCII characters for my node addresses.

I store the personal node id (byte) in EEPROM to generate generic sketches.

I include a small header (type, to, from, msgid) in each packet, so (all) nodes can discover each other.

[/OT]

Whandall:
I use the multiceiver feature to differentiate slots for announces, data broadcast, config, ...

That makes perfect sense.

But I suspect the OP's current knowledge is well behind yours and my inclination is to get him to stay with a very simple system until he / we know that something more complex is required.

...R