Hello everyone
I’m new to xbee modules, and I’m working on creating a mesh network where all the modules work as routers. My idea is that connecting to one of these modules through the serial port in Python can modify the other modules through Of AT commands. I have tried to do it but it is impossible for me.
Have any of you done something similar?
What Python library can be used?
Do you know of any .py code you can use?
Thanks for your time. Rodrigo.
Sure you can but all of the examples Digi has are designed to work with the Digi gateway products. They use the DDO_Set_param command.
Hello roal
Firstly you’d need to have is the main xbee on API mode.
Secondly take a look on this python lib https://github.com/nioinnovation/python-xbee
After those 2 steps, you’ll need to make a python code using the lib to send the AT commands to the other modules [doesn’t matter if it’s AT or API] like this:
xbee.remote_at(frame_id = b’\x01’, dest_addr_long = macoftheotherxbee, command = “ID”, parameter = “7771”)
frame_id != 0 asks for an ACK
dest_addr_long is the MAC address of the end point where you want to change the configs. It has to be in hex, maybe you’d need to transform a string using string.decode(‘hex’)
command is the AT you want to change
parameter is the new variable you want to write into the AT command.
Also, don’t forget to do an WR command after all, or after restarting the end module it’ll get back to previous set.
Hope it helps
Hi, do you know how to do it using the python digi-xbee lib? I have been stucked for days trying to get the RSSI from a message inside the message or using AT command DB. Thanks in advanced
Hi Lucas,
I’ve never used the digi-xbee lib, but reading some of that from here : http://xbplib.readthedocs.io/en/stable/user_doc/configuring_the_xbee_device.html
It’s seems to be similar to the lib I use… First you need to change the NO parameter to 4 (0x04 = Append RSSI (of the last hop for DigiMesh networks) to ND or FN responses or API node identification frames.)
Maybe using something like “local_xbee.set_parameter(“NO”, 4)”
and then using “local_xbee.execute_command(FN)” and getting the results. I don’t know if there’s a way to get the full packet in hexa, it’d help to find the rssi value.
Anyway, it’s basically the way I do on my project on the other lib… Worst case scenario, try to use the lib Ive mentioned on the previous answer
Hope it helps!
thanks!! in the Xctu tool I found the NO was set to 0 for every xbee, so it didn´t show RSSI, we will test what happens by setting it to 4. By the moment a team member solve it by code, after sending message to node, then using: utils.bytes_to_int(local_xbee.get_parameter(“DB”))
now I not stucked anymore
Hi, I just had luck using device.get_parameter(“DB”) after sending a message, so I can get the RSSI of node. try instead using set_parameter(“AT command”)