RF24Network Base Node

Hello All,

I am new to Arduino and trying to set up an RF24 Network using Manicbug's example at:

I have the hardware working and can communicate between nodes using some of his examples, but cannot see how to set up a Base Node at address '0' to collate all the sensor data from the other nodes. Manicbug's post refers to a Base Node but doesn't specify how to do it, the library doesn't include this function and the 'sensornode' Sketch can't be configured to do it .

I have seen this question asked several times elsewhere but it has never been answered.

Thank you in anticipation,

Richard

Hi!

I've same problem.
I can't find any "solution".

Did you solve it somehow during this time?

Addresses are configured as per below:

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

Whichever device is configured as 00 is the master node.
Nodes 01-0555 are child nodes.
Addresses must be specified in Octal format.

See the image on the linked page showing the addresses in an example setup:

TMRh20 thank you for a reply.
I use your fork of rf24 library.

I admit that I don’t have much knowledge.
I don’t understand what are trying to tell me.

If you would be so kind to tell me
what I’m doing wrong.

I’m sure that this is written somewhere, but I cant find or understand.

I use sesornet example.

If I set one node to 1 (01N) and second to (011N) I get this from serial:

Node 1:

RF24Network/examples/sensornet/

PLATFORM: Getting Started board

VERSION: Unknown

ADDRESS: 1

ROLE: Leaf

TEMP: 0000

16: APP Sending type-k to 00…

Failed.
123: APP Start system config mode

1908: APP Received #5 type k from 011

1910: APP Sending new config #0: 0 to 011

node 11:

2139: APP Sending type-k 62.38C 4.99V 0lost to 00…

2250: APP Send failed


4139: APP Sending type-k 62.38C 4.99V 1lost to 00…

4249: APP Send failed

VERSION: Unknown

ADDRESS: 1

ROLE: Leaf

TEMP: 0000

16: APP Sending type-k to 00…

Failed.
123: APP Start system config mode

1908: APP Received #5 type k from 011

1910: APP Sending new config #0: 0 to 011

2139: APP Sending type-k 62.38C 4.99V 0lost to 00…

2250: APP Send failed

4139: APP Sending type-k 62.38C 4.99V 1lost to 00…

4249: APP Send failed

I think this is ok.

But I don’t know how to set master node 0

When I try to set 0 (00N) I get message:

This sketch cannot run on node 00

Do I need to use another sketch?

I’m lost.
The same as the message to 00 node which does not exist in my network, because I don’t know how to set it. :~

bobibob:
Do I need to use another sketch?

Yeah, the example is only for the sensor/child nodes.

I can't find any example sketch, how to set Base node (node 000)

I just find people who says that Node 0 can be set and other
who were in the same situation :~

I would really like to see an example working.

Would anyone be so kind
and give a little more straightforward hint.

Ok,

Hope this thread is not dead yet…

This is the same problem I’m looking at right now. I cannot find a decent example of the Master node anywhere on the net/formum/github. :’( It’s quite a struggle.

The only ‘workaround’ at this moment is to use the helloworld_rx example. I tried it with only one node (id = 01) and made it ‘work’. The ‘Master’ is receiving some data. Only change is to set the channel to 92 instead of 90… see below:


network.begin(/channel/ 92, /node address/ this_node);

Next challenge for me is to get the message in some readable format. Not sure how that works, but with some help we must be able to get that working too.

I Use(d) both the maniacbug original and TMRh20-fork

Ronald

MASTER00.ino (1.33 KB)

No, I haven’t found a solution to this yet, which seems strange considering how many times the question has been asked. Without this piece of the jigsaw the ‘example’ isn’t really an example.

There is obviously a solution out there, it just needs to be posted as we all want to use the libraries but need a base to start from!

Richard

I don't understand what the confusion is?

To create a master node, set the address to 00.

example:

uint16_t this_node = 00;

network.begin(90, this_node);

From there it's just a matter of reading in data, or sending data to the other nodes, etc.

Documentation is available at http://tmrh20.github.io/RF24Network

Hi, I had the same problem with sensornet and solved it by making a new sketch with node 00 and configured to the setup needed.

However, I've been having trouble in the delay times in Relay mode. I am using wdt_prescalar_e wdt_prescalar = wdt_32ms in the Leaf code and it works perfectly, but when I change to Relay mode, it has a delay of over 8 seconds to send the data.

Does anybody know how to fix this? Or is it just a stupid question?

Anyway, thanks for the help!

TMRh20:
I don't understand what the confusion is?

To create a master node, set the address to 00.

example:

uint16_t this_node = 00;

network.begin(90, this_node);




From there it's just a matter of reading in data, or sending data to the other nodes, etc.

Documentation is available at http://tmrh20.github.io/RF24Network

The Documentation is great and I have been trying to do the same thing which all people here are trying to achieve. I am using a Raspberry Pi as my base node. Have tried everything that I can think of. To start with I have One PI and two arduino which I am trying to connect. Pi will be base arduino 1 as child and arduino 2 as grand child.

I have hit a dead end in figuring out how to send ping to grandchild from PI through the child.

Any pointer or sample code, anything in this regard will be of great help. Have been trying this from last four days and now frustration is creeping in :slight_smile:

The documentation here: RF24Network_Dev is currently more up-to-date and goes with the DEV version (see http://tmrh20.github.io )

Master (base) node setup:

uint16_t this_node = 00;
network.begin(90, this_node);

Child Setup:

uint16_t this_node = 01;
network.begin(90, this_node);

Grand-Child Setup:

uint16_t this_node = 011;
network.begin(90, this_node);

Send from Master (00) to Grand-child (011)

uint32_t mill = millis();
RF24NetworkHeader header(011,'T'); //Send a message of type 'T' to node 011
network.write(header,&mill,sizeof(mill));

Send from Grand-child (011) to Master (00)

uint32_t mill = millis();
RF24NetworkHeader header(00,'T'); //Send a message of type 'T' to node 00
network.write(header,&mill,sizeof(mill));

Hi, I tried as you suggested but I am not able to run the helloworld example to send message to grandchild from my raspberry pi as the base.
The base and grandchild are kept far away and I have the child to bridge the gap. I tried changing the code but it was of no use.

It works only when grandchild is in the range of base transmitter. Am I missing something here, your suggestions were not able to give me what I intended to achieve. A little bit more help in this one will be greatly appreciated.

To make it clear for someone to understand I am pasting the code which I am trying to run on each nodes

#include <RF24/RF24.h>
#include <RF24Network/RF24Network.h>
#include <iostream>
#include <ctime>
#include <stdio.h>
#include <time.h>


using namespace std;
RF24 radio(RPI_V2_GPIO_P1_18, RPI_V2_GPIO_P1_24, BCM2835_SPI_SPEED_8MHZ);

RF24Network network(radio);


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

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

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;
};

int main(int argc, char** argv) 
{
	// Refer to RF24.h or nRF24L01 DS for settings

	radio.begin();
	
	delay(5);
	network.begin(/*channel*/ 90, /*node address*/ this_node);
	radio.printDetails();
	
	while(1)
	{

		  network.update();
  		  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));
			
			printf("Received payload # %lu at %lu \n",payload.counter,payload.ms);
  }		  
		 //sleep(2);
		 delay(2000);
		 //fclose(pFile);
	}

	return 0;
}

The above code is running in raspberry pi which I am using as base

#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 = 01;    // Address of our node
//const uint16_t other_node = 01;   // 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;
    bool test = network.read(header,&payload,sizeof(payload));
    if (test)
     {
       Serial.print("Received packet #");
        Serial.print(payload.counter);
      Serial.print(" at ");
      Serial.println(payload.ms);
     }
     else {
       Serial.print("forwarded");
     }
  }
}

This is in first arduino which is the child in my case

 #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 = 011;    // Address of our node
//const uint16_t other_node = 00;   // 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/grandchild");
 
  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);
  }
}

This is in second arduino, the granchild.

If I am sending message to the child, I am getting “OK” in the console in raspberry pi, but If I send it to grandchild I get “sending failed” though I am getting the data in the serial monitor.
[EDIT: Basically sending ack from grandchild to base]

[EDIT: I was able to get this working so range is not an issue anymore] On top of this, the child grandchild setup only works when child and grandchild are both in the range of Base that is raspberry pi.

I am not able to figure out the reasons, any help will be of great help please someone help me out on this

Well, your code looks good, except that the RPi isn’t sending anything. I assume you are aware and modify it as needed, using Octal addresses.

In any case, the same code works fine for me, so I would suggest enabling some debug options to see what is going on.

On the RPi:

  1. Edit RF24Network_config.h
  2. Un-comment #define SERIAL_DEBUG and #define SERIAL_DEBUG_MINIMAL
  3. Rebuild – sudo make install -B

On Arduino:

  1. Edit RF24Network_config.h
  2. Un-comment #define SERIAL_DEBUG_ROUTING

In the Arduino Sketch:

  1. Add #include <printf.h>
  2. Under Serial.begin() , add printf_begin();
  3. Recompile/Re-upload

Debug Output:

On RPi:                                                                          Description:

198000: NET Sending id 99 from 00 to 011 type 83                    - Sending initiated
198001: FRG frame size 16
198002: FRG frame 00 00 09 00 63 00 53 00 70 05 03 00 62 00 00 00
198003: MAC Sending to 011 via 01 on pipe 5                                    - Sending to 011 via 01
198003: NET Pipe 5 on node 01 has address cccccc3ce3                     - Sending to 01 for routing
198005: MAC Sent on cccc3ce3 ok                                                  - Radio-ack OK
198007: MAC Received on 1 id 99 from 00 to 00 type 193                    - Network-ack OK


On Arduino (child) :
5543 MAC: Route OK to 011 ACK sent to 00
7553 MAC: Route OK to 011 ACK sent to 00
9548 MAC: Route OK to 011 ACK sent to 00

Please post your results if not having any luck. You can also enable more debug options for more info.

Thanks a ton for the prompt reply. Following is the output for me after enabling debug option.

Raspberry Pi I am getting these lines as output

Sending ..
2001: NET Sending id 1 from 00 to 011 type 0
2001: FRG frame size 16
2002: FRG frame 00 00 09 00 01 00 00 00 D0 07 00 00 00 00 00 00 
2003: MAC Sending to 011 via 01 on pipe 5
2003: NET Pipe 5 on node 01 has address cccccc3ce3
2005: MAC Sent on cccc3ce3 ok
2232: MAC Network ACK fail from 011 via 01 on pipe 5
failed.

And there is no change in the arduino serial output

RF24Network/examples/helloworld_rx/
Received packet #0 at 2000
Received packet #1 at 4000
Received packet #2 at 6000
Received packet #3 at 8000
Received packet #4 at 10000
Received packet #5 at 12000
Received packet #6 at 14000
Received packet #7 at 16000
Received packet #8 at 18000
Received packet #9 at 20000
Received packet #10 at 22000

There might be some small thing that I am missing but I don't have a clue what is that :frowning:
The code is all that I am using, which I have posted earlier.

[EDIT:]
NOTE: I am trying to send to the grandchild from base.

And there is no change in the arduino serial output

The output would be on the relay/routing node.

There might be some small thing that I am missing but I don't have a clue what is that

The debug output pretty much tells you:
2232: MAC Network ACK fail from 011 via 01 on pipe 5

01 is failing sending an ACK to 00. There is no way for me to know why that is, but either no signal strength or some sort of hardware/config/user issue I would guess. Basic troubleshooting steps would indicate that you want to troubleshoot the relay/routing node.

TMRh20:
01 is failing sending an ACK to 00. There is no way for me to know why that is, but either no signal strength or some sort of hardware/config/user issue I would guess. Basic troubleshooting steps would indicate that you want to troubleshoot the relay/routing node.

Thanks for all the help. The issue turned out to be the NRF module itself. I ordered it from local shop and they turned out to be the cheap chinese clones, which was the main cause for not receiving the acknowledgement.

Tested out till 4th level and now the new NRF(original/good ones) are working fine as expected.

For Anyone who is trying to use NFR2401L please be aware of those cheap chinese clones. The price will be tempting but its not worth the effort trying to figure out what went wrong

I've used many of the radios from China (7 different one total: Sign in - Google Accounts). I have had none fail except one that I caused to smoke myself. I have had to add decoupling capacitors to every one of them. For for ones without SMA antennas, I have found a default of 0,1uF and 10uF right at the pins, and a 470uF beside the module. For the SMA antenna modules, I have found a default of 0.1uF and 10uF right at the pins as before, and a 4700uF beside the module. The symptom before decoupling, is that the module powers up and you can talk to it via serial monitor, but it is never able to communicate with another module. After decoupling things work well. I have a mesh network with these radios using the Radiohead NRF24 library. I have one node I call the "logger", it is a MEGA2560 and has an NRF20L01 and WiFi shield. It does a round-robin query on all my nodes with sensors and dumps to MySQL database on my server. I just added 2 more for a couple of aquariums I have with waterproof DS18B20s, I have another one in the window using solar and lipo with TMP007 and TLS2591 breakouts from Adafruit. Yet another like the solar but with a MoteinoMega. Here is how it started : Sign in - Google Accounts and last night I got a Sparkfun Beefcake relay module functional, and added a radio, will debug code tonight (Sign in - Google Accounts)

Is anyone using RF24Mesh library? I have a quick question regarding the #define nodeID variable. Documentation says you can set that to 1-255 and I assume then there is no need to use 00,01,011 format?

Does that sound about right? My issue is that 00 <-> 01 communicates perfectly but 01 <-> 011 does not seem to be talking. Physically 011 is about 1-2 meters away from 01 but 12m from 00, taking a few steps closer it starts to communicate with 00.

Before enabling debug as suggested here, I just wanted to check for the format of the variable nodeID.

Thanks (sorry for the hijack)