nrf24l01+ Pipes & EEPROM


I've been working on a new home automation project using nrf24l01 radios. As you guys know the nodes need a pipe to talk using nrf24l01 radios, so in the base station I had to put a list of the node's pipes as mentioned in the library example:

const uint64_t talking_pipes[5] = { 0xF0F0F0F0D2LL, 0xF0F0F0F0C3LL, 0xF0F0F0F0B4LL, 0xF0F0F0F0A5LL, 0xF0F0F0F096LL };

What I am trying to do is to save these pipes in EEPROM instead of having them fixed in the code, I need this to be able to add and remove them easily and let the node send its pipe to the BS and save it.

What I need is to have a list of these pipes saved, 1 by 1 and to be able to extract the pipes by index.

Anyone been into this before? I searched all over the web searching for an answer but didn't find any. Is this possible? How many pipes can atmega328 EEPROM handle ?

Will appreciate your help & your input in this.


The pipe addresses are stored in 64 bit variables (8 bytes) and you have 1kB (1024 bytes) of EEPROM so a simple division will tell you how many addresses you could store. 1024 / 8 = 128.

You actually only use 6 bytes in the pipe address so you could actually do some manipulation on save and read to cut storage requirement by 25%.

Of course, you could use the RF24Network layer that takes care of all the pipes. All you need do then is assign a node number and store that, plus the destination node, in EEPROM. You could use a simple unsigned int (uint16_t) for each node address then. If you know you won't exceed a value of 255 for node address then you could use uint8_t but a 16 bit would be safer and prevent you scratching your head if you inadvertently assigned an out of range address value at a later date (3xx, 4xx or 5xx).

Take a look at avr gcc eeprom docs You could use the void eeprom_write_block ( const void * __src,void * __dst,size_t __n ) to do the job

Thank you for your input,

I checked the RF24Network, but from what I see I have to stick to specific node id sequence.


Base station to be 00 Base station children nodes 01, 02, 03, 04, 05 ( only 5 can be children as far as I understand ) Children of children 011, 021, 031, 041, 051

In my case I am looking to have like 100 children under the BS 001, 002, 003, ... 100 and can be extended later.

I don't think this is possible with RF24Network, please correct me if | am wrong.

So I found the best way is to stick to the RF24 library and just give the BS fixed pipe, and each node will have its unique pipe. Once the node is up it will send its pipe to the BS and the BS will save the node pipe to its EEPROM to be used later in communication.

This way I can have 128+ nodes ready to be connected.

What I am stuck into is the way to convert the node pipes and save them to EEPROM and then retrieve them back to be used in communication.

It would be great if anyone can help me with code snippet for converting, adding & retrieving pipes using arduino.

Thanks again.

I got now a great idea, still I am not sure if it can work.

Currently the BS receive commands using ethernet which then translate it to internal commands.

Question is, Can I send the node unique pipe to the BS through web, and then the BS use this pipe and make its connection using it?

if(strstr((char *)Ethernet::buffer + pos, "GET /?nodePipe=") != 0) {
       uint64_t nodePipe = (the node pipe);
       bool ok = radio.write( &message, sizeof(unsigned long) );

Do you think this could work ? Sure thats a dummy example just to tell you my idea. This way I wont need to add any of the pipes in code or in EEPROM! that would be perfect for me.

any help ?


I am a bit confused with what you are trying to achieve. The nrf24l01 will only listen for 5 remote addresses at any time which is the reason that rf24network implements the tree structure of 5 over 5 etc. How were you hoping to talk to 128 remote stations?