RF24Network v1

Network Layer for RF24 Radios

This class implements an OSI Network Layer using nRF24L01(+) radios driven by the RF24 library.

Purpose/Goal

Create an alternative to ZigBee radios for Arduino communication.

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 build an alternative using nRF24L01 radios. Modules are available for less than $6 from many sources. With the RF24Network layer, I hope to cover many common communication scenarios.

Please see the Comparison to ZigBee page for a comparison against the ZigBee protocols

Features

The layer provides:

The layer does not (yet) provide:

How to learn more

Topology for Mesh Networks using nRF24L01(+)

This network layer takes advantage of the fundamental capability of the nRF24L01(+) radio to listen actively to up to 6 other radios at once. 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.

Octal Addressing

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.

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.

Starting up a node

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.

Directionality

By default all nodes are always listening, so messages will quickly reach their destination.

You may choose to sleep any nodes which do not have any active children on the network (i.e. leaf nodes). This is useful in a case where the leaf nodes are operating on batteries and need to sleep. This is useful for a sensor network. The leaf nodes can sleep most of the time, and wake every few minutes to send in a reading. However, messages cannot be sent to these sleeping nodes.

In the future, I plan to write a system where messages can still be passed upward from the base, and get delivered when a sleeping node is ready to receive them. The radio and underlying driver support 'ack payloads', which will be a handy mechanism for this.

 All Classes Files Functions Variables