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

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)