Router nodes can be useful for extending the range of an XBee mesh network and allowing communication between nodes that are out of range of each other. They can be used to collect data from sensors placed in remote locations and transmit it back to a central coordinator node. An example router node code is provided.
<aside>
💡 Tip: Click on the corresponding section header in the wiki to be automatically redirected to a desired section.
</aside>
Router Node Introduction
- A basic XBee mesh network setup requires at least one coordinator and one or more routers or end devices. The coordinator is responsible for forming the network and must be configured as such. Once the network has been created, other nodes can join it.
- Routers are not strictly necessary for a basic XBee mesh network setup, but they can be useful for extending the range of the network and allowing communication between nodes that are out of range of each other.
- If left fully to default settings, an XBee module is configured to be a router node.
- Can use a router XBee node to collect data from sensors placed in remote locations and then transmit that data back to a central coordinator node. This can be useful in applications such as environmental monitoring, where you need to collect data from multiple sensors placed in different locations.
- Example router node code:
import xbee
import time
COORDINATOR_ADDRESS = "0013A20040XXXXXX" # Replace with the 64-bit address of our coordinator node
def read_sensor_data():
# Replace this with the code that reads the data from our connected sensors
return {"temperature": 25, "humidity": 50}
device = xbee.XBee()
while True:
data = read_sensor_data()
device.send_data(COORDINATOR_ADDRESS, str(data))
time.sleep(1)