Go Down

Topic: Node numbering in an RF24 Network (Read 187 times) previous topic - next topic

LastSamurai

Oct 15, 2014, 03:15 pm Last Edit: Oct 15, 2014, 03:20 pm by LastSamurai Reason: 1
Hey guys this is the followup to this thread: http://forum.arduino.cc/index.php?topic=269919.15 It had nothing to do with the original title so I started this post.

I am using maniacbugs RF24 and RF24 Network libraries to build a network of arduino like nodes. I designed the nodes by myself using the Atmega328P and a RF24L01+ Radio. I have to nodes with the numbers 1 and 3 which are sending data to 0 master node. This working just fine.
Now I want to start a "real" network using the tree topology maniacbug described in his library. I can't get this to work thouhg and I am somewhat confused with the node numbers here. Every sketch has a:
Code: [Select]
...const uint16_t this_node = 022;        // Address of our node
const uint16_t other_node = 0;       // Address of the other node
....
network.begin(/*channel*/ channel, /*node address*/ this_node);
...
RF24NetworkHeader header(/*to node*/ other_node);
....

part. The other_node whould be always 0 at the moment in my opinion because I only want to send messages to this one node. The other 2 nodes should be configered as child and child of child though. Master - node 1 - node2. So that node 2 can only send messages to the master via node 1.
The documentation says these are octal numbers, so imo I should be able to use these:
master: 0 (or 00)
node 1: 01
node 2 011

But these aren't working for me. Messages from node2 never reach the master. Is there an easy way to debug this?

Any help or additional documentation would be great.

TMRh20

You seem to have the numbering correct, so I would assume the problem would be elsewhere.

If you include printf.h and use printf_begin as in the RF24 examples, you can call radio.printDetails() after network.begin() to ensure the radio devices are reporting the correct settings, etc.

Beyond that, there are some debug options that can be commented out in the RF24Network_config.h file, that will allow you to monitor the individual nodes to see where the payload is being dropped, and again this requires printf.

If that doesnt help, you might want to post a complete code example for each of the nodes, since it looks like you are doing everything correctly so far. 

LastSamurai

Waho, are you THE TMRh20 who wrote the fork of maniacbugs library? If so: great job! I am currently using your libraries!


You seem to have the numbering correct, so I would assume the problem would be elsewhere.

Thanks that already helps alot. I am now looking for hardware errors.


If you include printf.h and use printf_begin as in the RF24 examples, you can call radio.printDetails() after network.begin() to ensure the radio devices are reporting the correct settings, etc.

I just did that and suddenly I am getting strange readings. One of the sender seems to be only a nRF24L01 (no +) and I get a lot of
Code: [Select]
*** WARNING *** Invalid address 0177777 warnings there. This might be the error because I used that one as a base station. By the way is there any good windows tool to monitor several serial connections at once? Arduino IDE only works with one.


Beyond that, there are some debug options that can be commented out in the RF24Network_config.h file, that will allow you to monitor the individual nodes to see where the payload is being dropped, and again this requires printf.

So do I understand this right: by default it prints out everything (debug related) when I start printf? Or do I first have to comment something out?

Thanks for this help already. I am working now on trying to find the error in the hardware (if there really is one).

TMRh20

Haha, yeah thats me, thanks.

If the one sender is showing as non + and you are getting invalid address errors, that usually indicates either a hardware (wiring etc.) issue or misconfiguration of pins etc.

If you launch multiple instances of the Arduino IDE in windows, you can have multiple serial monitors running with separate boards/ports selected. Just double-click the icon/shortcut to start another instance.

Printf.h only enables the usage of printf which includes invalid address warnings by default. To enable full debugging, you have to change the line #undef SERIAL_DEBUG to #define (SERIAL_DEBUG) in the RF24Network_config.h file . I would assume however, from the printDetails() output, that it is a wiring or config issue, so probably not necessary, but hard to diagnose without seeing the code or output. 


mactsk

Try looking at the sensor net sketch, it works with nodes 000 001 and 011 but you must set the node 001 in test mode, so it does not sleep, otherwise 99% of the messages from 011 gets lost.
I noticed that in the sketch it says "// Only the leaves sleep.  Nodes 01-05 are presumed to be relay nodes." but it is not like that, only the node 000 is not sleeping! (why it refers to 01-05 and not 001-005?)
Also when you run the sketch EVERY NODE says to be a leaf, also 000 :-(

LastSamurai

I got it to work (at least sometimes) if I use node 01 (should be the same as 001, right?!) purely as a relay. loop only consists of network.update() here. This drains a battery very fast though. Is there any way to use a relay node and safe power, or do the relay nodes have to have a cable + power nearby (will sometimes be hard to get in my case).
The leaf nodes use radio.powerDown() (and powerUp) in my case + a sleeping library for the atmega. This enables them to run on a CR2032 battery for months which is really nice.

TMRh20


If using interrupts, you can sleep the Arduino while leaving the radio actively listening. If so, the radio interrupt will wake the Arduino when it triggers, and the radio will draw about 15ma while in RX mode. The Arduino power draw depends on the board, since custom boards or an ATTiny can draw considerably less power while sleeping compared to a full Uno board.

Go Up