Hello Forum,
first of all i would like to apologize for my little knowledge. I'm trying hard to learn and hope you won't be insulted if my question is stupid.
I'm currently building a wireless Network using two XBee3 ZigBee Rf Modules from Digi International. These Modules have their own MC's attached and run Micropython on them.
I'm able to send data between the XBee's so all the ZigBee paramters (Adressing, Security,..) are configured correctly.
The first XBee is powered by an external battery and gets input from a analog sensor. That data is being send (wireless) to the second XBee which is connected to my Windows PC with a USB Cable.
My Question: How can i send the received sensor Data on the PC-connected XBee through the USB Connection to my PC and write the data (ints between 0-1024) into a text file (for example).
I already read the entire documentation from Digi about this but couldn't find a solution. The explanations seem to stop, once the data arrives on the second XBee. I hope this is possible with Micropython.
Thank you all so much for helping :roll:
Send Data from XBee3 Module to PC via USB Cable
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: Send Data from XBee3 Module to PC via USB Cable
I have done this via USB myself.
On the PC I opened a serail port on the USB like this https://pyserial.readthedocs.io/en/late ... intro.html
Then on the Micro-python MCU I attached a URAT to serial converter like this 1 https://www.aliexpress.com/item/1PCS-CP ... 11235f9062 then on the MCU I opened a UART port like this http://docs.micropython.org/en/v1.9.3/p ... .UART.html then I and send and receive between the PC and the MCU.
It is possible to use the USB on the MCU but is much more complex and problematic be the repl is already using the USB and that's why I use the UART with the UART to USB converter
On the PC I opened a serail port on the USB like this https://pyserial.readthedocs.io/en/late ... intro.html
Then on the Micro-python MCU I attached a URAT to serial converter like this 1 https://www.aliexpress.com/item/1PCS-CP ... 11235f9062 then on the MCU I opened a UART port like this http://docs.micropython.org/en/v1.9.3/p ... .UART.html then I and send and receive between the PC and the MCU.
It is possible to use the USB on the MCU but is much more complex and problematic be the repl is already using the USB and that's why I use the UART with the UART to USB converter
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Send Data from XBee3 Module to PC via USB Cable
An FTDI cable is your friend if you don't want to tangle with AliExpress. It converts UART signals to USB. There are many suppliers, this one is from Sparkfun.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Send Data from XBee3 Module to PC via USB Cable
Thanks for the advice. This solved the problem for me:
# Python program on PC
from digi.xbee.devices import ZigBeeDevice
import sys
# Initiate a serial connection with the
# connected XBee3 on the specified port and baud-rate
xbee = ZigBeeDevice("COM1", 9600)
xbee.open()
# Read the XBee's received messages
while True:
# Read the first message from the Queue (First come first serve)
# Blocks until data is received
m = xbee.read_data(sys.maxsize)
# Handle the messages accordingly
# Python program on PC
from digi.xbee.devices import ZigBeeDevice
import sys
# Initiate a serial connection with the
# connected XBee3 on the specified port and baud-rate
xbee = ZigBeeDevice("COM1", 9600)
xbee.open()
# Read the XBee's received messages
while True:
# Read the first message from the Queue (First come first serve)
# Blocks until data is received
m = xbee.read_data(sys.maxsize)
# Handle the messages accordingly
Re: Send Data from XBee3 Module to PC via USB Cable
@Dyrestium
I want to do the same thing as you did but i have problems to abilitate the communication between by two Zigbee modules.
One is connected to my pc and the other one should communicate with the coordinator one.
And i want to see the communication through my pc using XCTU
Any help would be good
I want to do the same thing as you did but i have problems to abilitate the communication between by two Zigbee modules.
One is connected to my pc and the other one should communicate with the coordinator one.
And i want to see the communication through my pc using XCTU
Any help would be good
Re: Send Data from XBee3 Module to PC via USB Cable
Are either of the XBees running the MicroPython firmware?Ham wrote: ↑Thu Feb 20, 2020 12:24 pmI want to do the same thing as you did but i have problems to abilitate the communication between by two Zigbee modules.
One is connected to my pc and the other one should communicate with the coordinator one.
And i want to see the communication through my pc using XCTU
Are you able to connect to the XBee connected to the computer via XCTU?
(This might not be the right forum to ask about this -- perhaps try the Digi forum)