Uniden UBC-125XLT USB serial port support 128 000 bps speed. 230 400 bps setting can be also used, it seems maybe a bit faster than 115 200 bps.

port-sett1.jpg

bsscr.jpg

import serial
import pandas as pd
import matplotlib.pyplot as plt
import csv
from datetime import datetime

ser = serial.Serial('COM11', '128000', timeout = 0.5)
print(ser.name)
serialCmd = b'PWR\r'
readSize = 19
loop = True
freq = ""
win = 0
data = []
log_data = []
cols = ['Frequency', 'RSSI', 'Timestamp']

plt.xlabel("Frequency")
plt.ylabel("RSSI")

try:
    while (loop == True):
        ser.write(serialCmd)
        result = ser.read(readSize)
        res = str(result)
        if (len(res) > 15):
            i = res.find(",")
            j = res.find(",", i + 1)
            if ((i != -1) and (j != -1)):
                freq = res[j + 1:j + 9]
                win = int(res[i + 1:i + (j - i)])
                log_data.append([freq, win, datetime.now().strftime("%Y%m%d%H%M%S")])
                i = -1
                b = False
                for x in data:
                    i = i + 1
                    if (x[0] == freq):
                        data[i][1] = win
                        b = True
                        break
                if (b == False):
                    data.append([freq, win])
                df = pd.DataFrame(data, columns = ['Frequency', 'RSSI'])
                df = df.sort_values("Frequency")
                plt.clf()
                plt.xticks(rotation = 90)
                plt.bar('Frequency', 'RSSI', data = df)
                plt.pause(0.03)
except KeyboardInterrupt:
    loop = False
    plt.close()
ser.close()
with open("c:\\temp\\unidenscope.csv", 'w', newline = '') as csvfile:
    csvwriter = csv.writer(csvfile)
    csvwriter.writerow(cols)
    csvwriter.writerows(log_data)