Here, I am interfacing Xbee(Rx) with raspberry pi 3 (Model B) and on another end Xbee(Tx) with Arduino UNO. On the Tx side I have a mechanical tool which is sending two types of data. But I am not able to understand this data properly.

I am using this code on receiving end.

import time
import serial

ser = serial.Serial(
        port ='/dev/ttyUSB0',
        baudrate = 9600,

while True:

    x = ser.readline()
    print (x)

I am receiving this data :-

b'\x01\x1e(\x0b\x04\x02\x01\x1e(\x0b\x04\x02\x01\x1e(\x0b\x04\x02' b'\x01\x1e(\x0b\x04\x02\x01\x1e(\x0b\x04\x02\x01\x1e(\x0b\x03\x02'

But I can't read this data properly.

1.Can any one suggest to me how to make this data readable? 2.How can I save both data on different variables ? Thank You

  • What are you sending - would be worth posting the Arduino set up code. Data you have is mainly binary rather than character data (denoted by the b at the start) Python can handle binary data like this as byte stings strings e.g. stackoverflow.com/questions/6224052/… and geeksforgeeks.org/working-with-binary-data-in-python – user130616 Mar 19 at 13:41
  • Sorry just to add without knowing what the chip is sending I GUESS x01\x1e( is start of data and \x0b\x04 or \x0b\x03 is the data and \x02 is the end of data but its a total guess – user130616 Mar 19 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.