Reading and displaying rs232 data stream on Raspberry Pi?

Hi all,

I’m trying to read an rs232 serial data stream from a legacy piece of hardware, a timer, and display the number full screen on my Raspberry Pi3. I have no documentation for the timer hardware. I fond your great tutorial on making the Raspberry Pi display a clock.

https://learn.sparkfun.com/tutorials/ho … tartup/all

I modified the code with serial.Serial to open the ttyUSB0 port, I used ser.read(8) to read the data stream, and Str.decode(‘ascii’,‘strict’) to decode it. I put the string in dtime.set. I get no errors when I run the code - but- the execution is not consistent. some times it places the number centered top, sometimes right side, sometimes left side, and some times it wraps the number into two lines. Also, I’m not able to change the font size. I’d like to fill the screen. If I run the unmodified code it plays as advertised. I would like to consistently center the number. What am I missing? Thanks for your help!

Hello Hofacker.

Are you sure there’s not ‘extra’ data coming in that causes things to shift around on you? Like maybe some spaces or other control characters. You might try looking at the incoming data to make sure your code is able to deal with any non printable characters that might be getting transmitted.