Home/Support/Support Forum/Inconsistent Xbee LED blinking while controlling remotely
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Inconsistent Xbee LED blinking while controlling remotely

0 votes
I am trying to blink an LED using a router AT XBee which is controlled by a coordinator API Xbee. The coordinator Xbee is connected to a Raspberry Pi which runs the following program. The LED blinks consistently for exactly 4 cycles but after that, it blinks inconsistently (gets stuck and doesnt light and then blinks super fast, again gets stuck). Sometimes, even after the program is stopped, the LED blinks after few seconds. What is causing the delay and inconsistency, I failed to figure out. I'd appreciate any pointers. Thanks. Baud Rate: 9600



from xbee import XBee, ZigBee
import serial
import time

ser = serial.Serial('/dev/ttyUSB0', 9600)
xbee = ZigBee(ser)

while True:
try:
xbee.send('remote_at',
frame_id='A',
dest_addr_long='\x00\x00\x00\x00\x00\x00\xFF\xFF',
dest_addr='\xFF\xFE',
options='\x02',
command='P2',
parameter='\x05')

time.sleep(1)

xbee.send('remote_at',
frame_id='A',
dest_addr_long='\x00\x00\x00\x00\x00\x00\xFF\xFF',
dest_addr='\xFF\xFE',
options='\x02',
command='P2',
parameter='\x04')

time.sleep(1)
except KeyboardInterrupt:
break

xbee.send('remote_at',
frame_id='A',
dest_addr_long='\x00\x00\x00\x00\x00\x00\xFF\xFF',
dest_addr='\xFF\xFE',
options='\x02',
command='P2',
parameter='\x04')

ser.close()
asked Mar 13, 2015 in Python by JustAJunior New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
Due to underlying network requirements broadcasts persist on the XBee for a short period and consume some of its finite resources.

Your issue is most likely caused by hitting the maximum supported concurrent broadcasts resulting in odd behavior as they fail or are delayed depending on resource availability.

To work around this you will have to unicast your LED toggling to each node instead of broadcasting. If you are only working with one node and can hardcode its address won't complicate the program. If you reverse the architecture with router on the Raspberry Pi hardcode 00:00:00:00:00:00:00:00 to address the coordinator.

Slightly more annoying with multiple nodes or if necessary to discover the address dynamically.

You might also look into controlling the LT register on your nodes. That blinks the Associate LED (not an arbitrary I/O) at a specified rate with the benefit of only needing to broadcast start/stop of your blink sequence and not each individual blink. Fewer broadcasts so you won't hit the limit.
answered Apr 12, 2015 by jlovinger Veteran of the Digi Community (421 points)
...