understanding the NRF24L01 Module Addressing of the mesh network & message send.

Hello I'm trying to understand how the Nrf24l01 module addressing and message sending. Sense my programing skills are limited But I'm trying to understand how the nrf24 modules are addressing from what I'm understanding and i might be wrong but in the mesh networking there is a main node which all the other nodes relay through. at least this from what I'm viewing in the sketch of the ping test it's set this node and other node address i understand what This node address means the transmitting or receiving of the information but other node address i do not understand what is that for? Sense i lack the programing skills i do not know. The other thing is if i have 6 nodes how is it setup in the programing to link them together to make the mesh network? i honestly don't see how i might be wrong but this is from what I'm seeing. If mange to be linked together how in Serial monitor can i send a Single message of the 32 bytes to another node without the whole network seeing it?

The last thing I'm trying to understand is that is the nodes are apart from each other in the network and say that the 6th node needs to relays data to the first node from my understanding as it is setup in the mesh network the other nodes can act as some kind of relay so it can pass data from node 6 back to the first node am i correct on this or slightly off? I'm trying to understand this the best i can i need help to understand this for my project can someone please help me to understand this? thank you.

Second part of all this is. if 6 nodes is the max limit of the mesh network then how come i have seen more then 6 nodes connected on the network saying in Maniacbug RF24Network for Wireless Sensor Networking he has 16 nodes and 1 base station is that setup differently from a 6 node setup? i have seen other webpages not to long ago where one guy haves 30 nodes linked together talking to each other I lost the website page on that one but once again what is difference between the 6 node setup and 16 or 30 nodes setup talking to each other?

might help

Hello that did help me some to understand it but parts of it I'm trying to understand is how to program it to work together how to address it and how to send a message from node 1 to node 5 or from node 5 to node 3 I don't know how to put in the in to connect 6 nodes all together? To connect them together. I need help to code this. But thank you for the link it explains some.

the hello world tx and rx examples seem pretty clear, find them via the examples link at the top of the page linked to. try modding those to work with a 'payload' that represents your data.

hint
struct payload_t { // Structure of our payload
char Mymessagestring[33];
unsigned long counter;
};

Filk I'm sorry let me rephrase the problem I'm having. i figure out how to send the message but what i do not know is how to link them up all together to be as the network? that part i don't understand. i can figure out how to send the message shouldn't be a problem but if on the network i do not know how to direct the message to a single node instead of the whole group that is on the node.

the addressing determins a nodes position in the hierarchy (tree), so all you need do is address the recieving node in the message and it will be handled by the network.

How routing is handled

When sending a message using RF24Network::write(), you fill in the header with the logical node address. The network layer figures out the right path to find that node, and sends it through the system until it gets to the right place. This works even if the two nodes are far separated, as it will send the message down to the base node, and then back out to the final destination.

All of this work is handled by the RF24Network::update() method, so be sure to call it regularly or your network will miss packets.

the key information on addressing the nodes is

Octal Addressing and Topology

Each node must be assigned an 15-bit address by the administrator. This address exactly describes the position of the node within the tree. The address is an octal number. Each digit in the address represents a position in the tree further from the base.

Node 00 is the base node.
Nodes 01-05 are nodes whose parent is the base.
Node 021 is the second child of node 01.
Node 0321 is the third child of node 021, an so on.
The largest node address is 05555, so 3,125 nodes are allowed on a single channel. An example topology is shown below, with 5 nodes in direct communication with the master node, and multiple leaf nodes spread out at a distance, using intermediate nodes to reach other nodes.
00 00 Master Node (00)
01 04 1st level children of master (00)
011 021 014 2nd level children of master. Children of 1st level.
111 121 221 114 3rd level children of master. Children of 2nd level.
1221 1114 2114 3114 4th level children of master. Children of 3rd level.

i try to understand this some i can understand but I'm still not understanding how to really setup the mesh network. I honestly need help in coding this how to connect all the nodes together and how to set a message from one node to another?? I'm so lost.

Each node has a unique address, and you set that up according to the info above, so the root node is 'O0'
O for octal (base 8 where 8=O10).

they are in a tree structure, and each node can have upto 5 children (nodes hanging directly off the same parent)

/*
 Copyright (C) 2012 James Coliz, Jr. <maniacbug@ymail.com>
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 version 2 as published by the Free Software Foundation.
 
 Update 2014 - TMRh20
 */
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>
RF24 radio(9,10);                // nRF24L01(+) radio attached using Getting Started board 
RF24Network network(radio);      // Network uses that radio
const uint16_t this_node = 0;    // Address of our node
const uint16_t other_node = 1;   // Address of the other node
struct payload_t {                 // Structure of our payload
  unsigned long ms;
  unsigned long counter;
};
void setup(void)
{
  Serial.begin(57600);
  Serial.println("RF24Network/examples/helloworld_rx/");
 
  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 90, /*node address*/ this_node);
}
void loop(void){
  
  network.update();                  // Check the network regularly
  
  while ( network.available() ) {     // Is there anything ready for us?
    
    RF24NetworkHeader header;        // If so, grab it and print it out
    payload_t payload;
    network.read(header,&payload,sizeof(payload));
    Serial.print("Received packet #");
    Serial.print(payload.counter);
    Serial.print(" at ");
    Serial.println(payload.ms);
  }
}

RF24 radio(9,10); // nRF24L01(+) radio attached using Getting Started board

Declares an instance of a network node attached to pins 9,10

RF24Network network(radio); // Network uses that radio

Declares a network which includes the node

void setup(void)
{
  Serial.begin(57600);
  Serial.println("RF24Network/examples/helloworld_rx/");
 
  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 90, /*node address*/ this_node);
}

setup begins the network on channel 90 and includes the node 'this_node' which was declared and assigned by,

const uint16_t this_node = 0;    // Address of our node

so each node is attached to an arduino and as they start up and run each one shouts out here i am number X on channel 90... :wink:

the actual checking and processing of the trafic is done by executing the RF24Network::update() command
on the board attached to each node, so if u have a message to send to node Y send it using RF24Network::write() and trust to the network gods ;).. Or dig deeper..

beyond which i cant help much as i am not using these in my project and i still have my own homework to do. Im not using such well documented libs with some of my selected h/w :wink:

if you still dont get it either use the examples to knock up a 3 none network with lots of embedded serial writes so you can track what and how the code flows.

Or try asking specific questions..

remeber when using a library with little or no documentation you can always look in the .h file for all the public declarations and probably a good explaination as to whats what.

Each node has a unique address, and you set that up according to the info above, so the root node is O0
O for octal (base 8 where 8=O10).

they are in a tree structure, and each node can have upto 5 children (nodes hanging directly off the same parent)

/*
 Copyright (C) 2012 James Coliz, Jr. <maniacbug@ymail.com>
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 version 2 as published by the Free Software Foundation.
 
 Update 2014 - TMRh20
 */
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>
RF24 radio(9,10);                // nRF24L01(+) radio attached using Getting Started board 
RF24Network network(radio);      // Network uses that radio
const uint16_t this_node = 0;    // Address of our node
const uint16_t other_node = 1;   // Address of the other node
struct payload_t {                 // Structure of our payload
  unsigned long ms;
  unsigned long counter;
};
void setup(void)
{
  Serial.begin(57600);
  Serial.println("RF24Network/examples/helloworld_rx/");
 
  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 90, /*node address*/ this_node);
}
void loop(void){
  
  network.update();                  // Check the network regularly
  
  while ( network.available() ) {     // Is there anything ready for us?
    
    RF24NetworkHeader header;        // If so, grab it and print it out
    payload_t payload;
    network.read(header,&payload,sizeof(payload));
    Serial.print("Received packet #");
    Serial.print(payload.counter);
    Serial.print(" at ");
    Serial.println(payload.ms);
  }
}

RF24 radio(9,10); // nRF24L01(+) radio attached using Getting Started board

Declares an instance of a network node attached to pins 9,10

RF24Network network(radio); // Network uses that radio

Declares a network which includes the node

void setup(void)
{
  Serial.begin(57600);
  Serial.println("RF24Network/examples/helloworld_rx/");
 
  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 90, /*node address*/ this_node);
}

setup begins the network on channel 90 and includes the node 'this_node' which was declared and assigned by,

const uint16_t this_node = 0;    // Address of our node

so each node is attached to an arduino and as they start up and run each one shouts out here i am number X on channel 90... :wink:

the actual checking and processing of the trafic is done by executing the RF24Network::update() command
on the board attached to each node, so if u have a message to send to node Y send it using RF24Network::write() and trust to the network gods ;).. Or dig deeper..

beyond which i cant help much as i am not using these in my project and i still have my own homework to do. Im not using such well documented libs with some of my selected h/w :wink:

if you still dont get it either use the examples to knock up a 3 none network with lots of embedded serial writes so you can track what and how the code flows.

Or try asking specific questions..

remeber when using a library with little or no documentation you can always look in the .h file for all the public declarations and probably a good explaination as to whats what.

** edit, perhaps you dont get how the network knows how to direct the traffic 'undr the hood', thats down to the trees structure of the nodes and the known addressing format :wink: 1 parent/5 children and octal addressing protocol..

Each node has a unique address, and you set that up according to the info above, so the root node is Octal0
O for octal (base 8 where 8=O10).

they are in a tree structure, and each node can have upto 5 children (nodes hanging directly off the same parent)

/*
 Copyright (C) 2012 James Coliz, Jr. <maniacbug@ymail.com>
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 version 2 as published by the Free Software Foundation.
 
 Update 2014 - TMRh20
 */
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>
RF24 radio(9,10);                // nRF24L01(+) radio attached using Getting Started board 
RF24Network network(radio);      // Network uses that radio
const uint16_t this_node = 0;    // Address of our node
const uint16_t other_node = 1;   // Address of the other node
struct payload_t {                 // Structure of our payload
  unsigned long ms;
  unsigned long counter;
};
void setup(void)
{
  Serial.begin(57600);
  Serial.println("RF24Network/examples/helloworld_rx/");
 
  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 90, /*node address*/ this_node);
}
void loop(void){
  
  network.update();                  // Check the network regularly
  
  while ( network.available() ) {     // Is there anything ready for us?
    
    RF24NetworkHeader header;        // If so, grab it and print it out
    payload_t payload;
    network.read(header,&payload,sizeof(payload));
    Serial.print("Received packet #");
    Serial.print(payload.counter);
    Serial.print(" at ");
    Serial.println(payload.ms);
  }
}

RF24 radio(9,10); // nRF24L01(+) radio attached using Getting Started board

Declares an instance of a network node attached to pins 9,10

RF24Network network(radio); // Network uses that radio

Declares a network which includes the node

void setup(void)
{
  Serial.begin(57600);
  Serial.println("RF24Network/examples/helloworld_rx/");
 
  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 90, /*node address*/ this_node);
}

setup begins the network on channel 90 and includes the node 'this_node' which was declared and assigned by,

const uint16_t this_node = 0;    // Address of our node

so each node is attached to an arduino and as they start up and run each one shouts out here i am number X on channel 90... :wink:

the actual checking and processing of the trafic is done by executing the RF24Network::update() command
on the board attached to each node, so if u have a message to send to node Y send it using RF24Network::write() and trust to the network gods ;).. Or dig deeper..

beyond which i cant help much as i am not using these in my project and i still have my own homework to do. Im not using such well documented libs with some of my selected h/w :wink:

if you still dont get it either use the examples to knock up a 3 none network with lots of embedded serial writes so you can track what and how the code flows.

Or try asking specific questions..

remeber when using a library with little or no documentation you can always look in the .h file for all the public declarations and probably a good explaination as to whats what.

** edit, perhaps you dont get how the network knows how to direct the traffic 'undr the hood', thats down to the trees structure of the nodes and the known addressing format :wink: 1 parent/5 children and octal addressing protocol..

Mods please delete #8 and #9, my error i edited to correct typo's (fat fingers diddy keyboard) and in error recreated ended up posting 3 times?? my bad..

Hello filk that does explain a lot thank you so much. you said to where i can understand a lot of thing and it help me thank you. so from what I'm understanding there has to be a base station that is node 00 and can have 5 nodes connected to it as you call them child nodes they link together as a network or mesh network to the main node the parent node of 00 and that is how the network is started and from there each of the child nodes 01, 02, 03, 04, and 05 each one of them can have 5 more nodes linked to them so basically there is really no limit to how many nodes can be linked into the network that is on that channel of 90 or whatever channel it's on. i looked up the channels it says up to 125 channels that the nrf24 network can handle but i also seen there can only be up to 3 thousand or 3100 something like that in nodes that can be linked per channel.

My other question is on the master node of 00 where it says This node is 00 and other node is that part of Other node address Important where does that link to? or does it matter that is the last part i don't understand? the other thing is in addressing where it says This node is the address for each nodes okay that i understand and where it says other nodes that should be 00 to go to the master node or the node that is leaching or linked to? i get the general idea of how its linked together now and how most of it's addressed but that part of each child node after the 5 nodes does them 5 nodes make them parent nodes now sense they have nodes linked to them as child nodes?

the last part is how can i send a simple message so say I'm at mater 00 node and just want to send to say node 10 linked into the network if there is one say I'm not here right now message me later and it on node 10 that it comes from master node and shows the message? that is the only other thing I'm confused on. i found this online

void push_button()
{
if the pushbutton is pressed
char input[32] = "your predefined msg"; //use only "input" as the name of ur variable because thats what tx node transmits
go_to_tx_mode = true;
else i.e if pushbutton is not pressed
do nothing;
}

note sure if this is it or not but this is send as if you are using a buttons. and input of 32 means i guess bytes that means 32 characters long? but now sure how to set it up as if using the serial monitor. well once again thank you for the help and information it did help me a lot and i learn a lot because you explain it to me as i can understand it better so thank you.

If I'm wrong about anything let me know I'm still trying to learn all this and it might take me a little time to understand it I'm slow at learning new stuff.

This is why I stick to hardware i love building things and letting them run software a bit of a headache LOL.

to be honest all i am doing is referring back to the page i originally linked to to try and answer your questions,
All the information is there, i suggest you work though it googling anything you dont fully understand

note sure if this is it or not but this is send as if you are using a buttons. and input of 32 means i guess bytes that means 32 characters long? but now sure how to set it up as if using the serial monitor. well once again thank you for the help and information it did help me a lot and i learn a lot because you explain it to me as i can understand it better so thank you.

char input[32]="some characters";

is declaring an array of 32 characters and initialising it with "some characters" in the positions 0 to 14 inclusive. the name 'input' could be anything
char anything[128]; would declare a character array of 128 characters without initialising it

but if that is confusing you have a lil more basic programming homework to do i suggest you start by doing the blink and other example sketches in the ide and moving on once you have fully understood each one.

with that i think you may be able to follow the page i linked to above and implement your h/w..

Hello this is what i came up with only thing is i think it will send to the whole network but not sure how to direct it to a sing node or how to receive a message coming back. still looking through all this information :slight_smile:

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

// nRF24L01(+) radio attached using Getting Started board 
RF24 radio(9,10);

// Network uses that radio
RF24Network network(radio);

// Address of our node
const uint16_t this_node = 1;

// Address of the other node
const uint16_t other_node = 0;



void setup(void)
{
  Serial.begin(57600);

  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 90, /*node address*/ this_node);
}

void loop(void)
{
  char input[32]="Hello Joseph";
 Serial.print("Sending...");
 
}

When sending a message using RF24Network::write(), you fill in the header with the logical node address. The network layer figures out the right path to find that node, and sends it through the system until it gets to the right place. This works even if the two nodes are far separated, as it will send the message down to the base node, and then back out to the final destination.

All of this work is handled by the RF24Network::update() method, so be sure to call it regularly or your network will miss packets.

i cant see any update or write/read commands in your code, seems like you need a few things for a message, you need to know the destination address and you need a header and payload, and to derive the size of the payload.

so declare a header type assign it the destination node. define declare and assign values to your payload

and write passing the header, the address of the payload and the size of the payload.

a call to update within the loops both sending and receiving does all the work for you so in the receiving loop you define a header and a structure identical to the one sent, declare them, and read passing the header the address of the structure to recieve the payload/message, and the size of the payload.

sending

RF24Network network(radio);          // Network uses that radio
const uint16_t this_node = 1;        // Address of our node
const uint16_t other_node = 0;       // Address of the other node
const unsigned long interval = 2000; //ms  // How often to send 'hello world to the other unit
unsigned long last_sent;             // When did we last send?
unsigned long packets_sent;          // How many have we sent already
struct payload_t {                  // Structure of our payload
  unsigned long ms;
  unsigned long counter;
};
void setup(void)
{
  Serial.begin(57600);
  Serial.println("RF24Network/examples/helloworld_tx/");
 
  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 90, /*node address*/ this_node);
}
void loop() {
  
  network.update();                          // Check the network regularly
  
  unsigned long now = millis();              // If it's time to send a message, send it!
  if ( now - last_sent >= interval  )
  {
    last_sent = now;
    Serial.print("Sending...");
    payload_t payload = { millis(), packets_sent++ };
    RF24NetworkHeader header(/*to node*/ other_node);
    bool ok = network.write(header,&payload,sizeof(payload));
    if (ok)
      Serial.println("ok.");
    else
      Serial.println("failed.");
  }
}

receiving

/*
 Copyright (C) 2012 James Coliz, Jr. <maniacbug@ymail.com>
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 version 2 as published by the Free Software Foundation.
 
 Update 2014 - TMRh20
 */
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>
RF24 radio(9,10);                // nRF24L01(+) radio attached using Getting Started board 
RF24Network network(radio);      // Network uses that radio
const uint16_t this_node = 0;    // Address of our node
const uint16_t other_node = 1;   // Address of the other node
struct payload_t {                 // Structure of our payload
  unsigned long ms;
  unsigned long counter;
};
void setup(void)
{
  Serial.begin(57600);
  Serial.println("RF24Network/examples/helloworld_rx/");
 
  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 90, /*node address*/ this_node);
}
void loop(void){
  
  network.update();                  // Check the network regularly
  
  while ( network.available() ) {     // Is there anything ready for us?
    
    RF24NetworkHeader header;        // If so, grab it and print it out
    payload_t payload;
    network.read(header,&payload,sizeof(payload));
    Serial.print("Received packet #");
    Serial.print(payload.counter);
    Serial.print(" at ");
    Serial.println(payload.ms);
  }
}

Hello Filk you are right about the RF24Network::write(); i totally forgot about that to update the network. i have the send character part in there like before and the network update that is there now but in tx to transmit how can i redirect it to that one person in the loop it is RF24NetworkHeader header(/to node/ other_node); that means to send to the first node of 00 correct? so that part i need to figure out how to send it to another node address. this is wow a lot but I'm trying man.

http://tmrh20.github.io/RF24Network/structRF24NetworkHeader.html#aacf67806892c3bbcacfbff2554b64fd5

RF24NetworkHeader is defined in the library, header is the name of the instance declared.
when other_node ==0 then it will send to the master node, when set to another Valid address (10 is invaid) it will be directed to that node.

oh you know whats crazy i found this page before even bookmarked it. i was reading some stuff from sending message i didn't even think about it. but one thing i did found was this

RF24NetworkHeader header(recipient_address,'t');
network.write(header,&message,sizeof(message));

in the site from before it was in my notepad i saved the text.