XBee + Python: DIO control of remote module: problem sending AT command packet

I am trying to control the DIO on my remote XBee module using Python language. I have successfully done this relatively simply with JAVA… here is my python code:

from digi.xbee.devices import *
from digi.xbee.io import *
import time

device = XBeeDevice(“COM6”, 9600)

device.open()
xnet = device.get_network()
print(“test0”)
remote_00 = xnet.discover_device(“ROUTER_00”)
print(“test0.5”)
remote_xbee = RemoteXBeeDevice(device, XBee64BitAddress.from_hex_string(“0013A20041ADACB4”))
print(“test1”)

remote_xbee.set_io_configuration(IOLine.DIO0_AD0, IOMode.DIGITAL_OUT_HIGH)
time.sleep(2)
remote_xbee.set_io_configuration(IOLine.DIO0_AD0, IOMode.DIGITAL_OUT_LOW)
time.sleep(1)
print(“test2”)

print(“test3”)
device.close()

when I run this I get an error between test1 and test2… “error: There was a problem sending the AT command packet.”

any insight?

thanks! :slight_smile:

1 Like

Did you put Radio 1 in API mode?

1 Like

I have confirmed successful operation of my S2C XBee network. So, those are all configured / programmed correctly. When I try to do the same basic communication with my XBee 3 network I get an ATcommandException upon my first send to a remote module. So, I am guessing the problem has to be with my XBee3 network configurations (XCTU)… even though I have checked them all multiple times… I will go back through the steps start to finish again. There must be a simple answer lol.

What firmware versions do you have on your XBee S2C and XBee 3 modules?

You should try remotely disabling it and switching back to JAVA. That’s what I would do.

all modules were updated to most recent firmware versions… that was my intention at least. I must’ve missed something simple in the configuration setup.

Okay, just an update. Again, I have successful network communication with my XBee S2Cs ZigBee…

I had an issue with my XBee 3 series ZigBee network communication: was getting ATcommandException right off the bat.

Now, I have fixed that error. It appears I did indeed just simply overlook API settings. Problem solved there.

Now I am having trouble discovering the module for a simple IO actuation example between coord and router… I must be missing some basic configuration step. I have configured them as much as the example I am following (said example code works immediately for S2C network once plugged in but fails to establish a connection with the Series 3 remote module.) My series 3 modules are all updated to 100A firmware. Any thoughts on what new configuration setting in XB3 vs XBS2C configuration tool that I am neglecting in my setup? Let me know if I should provide the code, and/or XCTU configuration setup. Thanks!

Most likely API mode or baud rate.

Hm, ok. I have api mode on for each device. And my baud rate is set at 9600. Immediately upon plugging in my XBee S2Cs the program runs great. My XBee 3s on the other hand… wish I could upload this snipPic into this comment to show.
The XBee S2C’s connect and run the program immediately… the XBee3s fail at discovering the remote device via NI. In other words my remote_00 = xnet.discover_device(“ROUTER_00”) returns a None type for the XBee 3s

Hey, just a final update for now lol… I just clipped on the antennas that came with the start-up kit… did the trick… it works now. What a silly mistake… I thought they had on-board chip antennas as well as these attachable ones… anyways just an FYI: the issue was forgetting about the antennas!

I wish, unfortunately I need the XBee3s for th eproject though… they are the only versions that support Micropython and I2C which I will likely need for additional I/O extension.

Are the two nodes associated? Is one set as a network creator and the other a joiner? Do they have the same PAN ID, OP and OD values?

yup. all good now. I didnt have the antenna’s connected. important stuff!