Reading Xbee-data with Python not possible

Hello,

I have chosen the following setup to read sensor data by Arduino and an XBee-connection:

  • TMP36-sensor is connected to an Arduino Uno
  • Sparkfun XBee-shield with an XBee S2C is mounted on the Arduino (Router, API-mode). The Arduino is connected to COM3.
  • COM4 is connected with a Sparkfun XBee-Explorer (USB-connection). Another XBee S2C is connected on the explorer. This XBee is the coordinator (API-mode).
    I have written the code for reading data from Xbee-Explorer at COM4:

#! /usr/bin/python

Import and init an XBee device

from xbee import XBee, ZigBee
import serial
ser = serial.Serial(‘COM4’, 9600)
xbee = XBee(ser)
while True:
try:
enter response = xbee.wait_read_frame()
print response
except KeyboardInterrupt:
break
ser.close()

At the moment it is not possible to get any data received by the Xbee with the Python code, although it is possible to read the data by XCTU.
In Detail: If I send sensor data (sensor reading and sending to Xbee is done by Arduino Software) from the router to the coordinator, I’m able to read the data frames by XCTU and the results make sense. If I use the Python-code above, I did not get any data frames, although the RSSI-diodes of router and coordinator are blinking independently from the software (XCTU or Python) I use. For me it is not clear what is going wrong and I would be happy to get some help to solve the problem. Thank you very much for your support.
Regards Daniel

Daniel,

While it is good that you are reaching out for help in this manner, the site you should be reaching out to is your Arduino processors site. The reason for that is that this is not an issue for the XBee but the Code on the processor reading the data. You have verified that by the fact that you can view the data in XCTU from the same module. So either there is a hardware connection/level shifting issue between the XBee and the processor receiving the data or an issue with your code.