I have previously been dealing with Windows on which I use puTTY or TerraTerm to record serial traces coming in. However I wanted to create a similar thing on a raspberry pi where by a script will initiate a serial connection to a specific USB and port (equivalent of COM port on Windows) and auto-start recording, splitting files when after a certain time and storing away. I have downloaded puTTY which I know has a CLI on windows but I haven't found a similar thing on Terminal. I have also seen people have mentioned that it comes pre-installed on Terminal but haven't been able to figure out how that works either. I have built a few things in Python before so I know that there is a "serial" lib which can record serial traces and as Python is already pre-installed on the Raspberry Pi, is this the best way to do what I'm after? Any recommendation is welcome :)
Asked
Active
Viewed 92 times
1 Answers
0
I personally use the UART-GPIO-Port to receive serial data in my "raspberry pi zero w V1.1". The data transfer over a USB-Serial-driver should work the same, but you have to find the name of the serial device: For that you can use that python script: list serial ports python raspberry
When you have the name, install the serial software for python:
pip install pyserial
You can then start the following rudimentary python script to show all the raspberry is actually receiving over this serial port:
import serial
ser = serial.Serial('/dev/ttyS0', baudrate=19200) #Use YOUR serial device name here. The correct baudrate is also important.
try:
while 1:
print(ser.read())
except(KeyboardInterrupt, SystemExit): #Now you can interrupt this script with CTRL-C
ser.close()

TTorai
- 84
- 6