0

I've been struggling the past week to make sense of the RS232 serial data that I received from my physiological monitor. I'm following the owner's manual instruction for baud rate, parity, stop bits, and so on. The monitor sends the CSV data in ASCII format. It recommends using HyperTerminal, but I would like to do it through python. I've connected to the RS232 and received data back, but It looks like bytes, and I'm unsure how to convert this to human-readable characters. Any pointers would be greatly appreciated. Thank you

import serial
ser = serial.Serial(
    port='/dev/rfcomm0',
    baudrate=19200,
    timeout=20,
    parity=serial.PARITY_NONE,
    stopbits=serial.STOPBITS_ONE,
    bytesize=serial.EIGHTBITS
)

response = ser.read(10000)
print(response)
b'&\x13(M&\x13(MMM\x13(M(M\x13(M&\x13(M&\x13(MMM\x13(M(M\x13(M&\x13(M&\x13(MMM\x13(M(M\x13(M&\x13('

enter image description here

Robert Marciniak
  • 163
  • 1
  • 2
  • 14
  • Such an article will be helpful. [Encode/decode data from RS232 serial port](https://stackoverflow.com/q/60823172/9014308) – kunif May 12 '22 at 17:44
  • Thank you for your reply. There is no decoding information available in the owner's manual. I just don't understand why Hyperterminal can read a CSV file but it's such a struggle to get human-readable data without a specific data transparency document such as the one you suggested. – Robert Marciniak May 12 '22 at 17:52
  • You're reading from `/dev/rfcomm0`? So the underlying OS is Linux? Yet you keep on mentioning Hyperterminal? If you're really on Linux, then perform a sanity check on your setup using **minicom**, a terminal emulation program. If you can't see "*human-readable characters*", then you have other problems. IOW there is no need to "*convert*" or "*transform*" ASCII code to make it "*readable*". – sawdust May 12 '22 at 19:17
  • Is a baud rate correct? – Helen Downs May 13 '22 at 03:37
  • Thank you for your replies. I'm going to try the minicom since my program is running on a Raspberry Pi. @Helen: The baud rate is from the owner manual and I confirmed it on the monitor itself. – Robert Marciniak May 13 '22 at 15:17

0 Answers0