Optimized RF24Network Layer v2.0.2
2024 - Optimized RF24 Network Layer for NRF24L01 & NRF52x radios
|
This class implements an OSI Network Layer using nRF24L01(+) radios driven by the newly optimized RF24 library fork or using nRF52x radios with the newly created nrf_to_nrf library.
Original: Create an alternative to ZigBee radios for Arduino communication.
New: Enhance the current functionality for maximum efficiency, reliability, and speed
Xbees are excellent little radios, backed up by a mature and robust standard protocol stack. They are also expensive.
For many Arduino uses, they seem like overkill. So I am working to improve the current standard for nRF24L01 radios. The best RF24 modules are available for less than $6 from many sources. With the RF24Network layer, I hope to cover many common communication scenarios.
Please see TMRh20's blog post for a comparison against the ZigBee protocols
Introducing RF24Network & RF24Mesh v2.0 with some significant API changes, adding the use of C++ Templates in order to support a range of ESB enabled radios, most recently NRF52x radios.
Important Notes:
Please see the recent changes listed in the github releases page
helloworld_*
examples.This network layer takes advantage of the fundamental capability of the nRF24L01(+) radio to listen actively to up to 6 other radios at once (8 with NRF52x). The network is arranged in a Tree Topology, where one node is the base, and all other nodes are children either of that node, or of another. Unlike a true mesh network, multiple nodes are not connected together, so there is only one path to any given node.
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.
When sending a message using ESBNetwork::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 ESBNetwork::update() method, so be sure to call it regularly or your network will miss packets.
When a node starts up, it only has to contact its parent to establish communication. No direct connection to the Base node is needed. This is useful in situations where relay nodes are being used to bridge the distance to the base, so leaf nodes are out of range of the base.
By default all nodes are always listening, so messages will quickly reach their destination.
You may choose to sleep any nodes on the network if using interrupts. This is useful in a case where the nodes are operating on batteries and need to sleep. This greatly decreases the power requirements for a sensor network. The leaf nodes can sleep most of the time, and wake every few minutes to send in a reading. Routing nodes can be triggered to wake up whenever a payload is received See ESBNetwork::sleepNode() in the class documentation, and RF24Network_config.h to enable sleep mode.