0

I am working on a project to display sensor data on Python GUI. Sensor data is coming at a rate of 2kHz on serial port using Arduino. I was using pyserial (using readline()) to read the sensor data on my laptop. After hours of debugging I found that python was able to read around 400 samples/sec i.e. reading frequency is around 400Hz.

Is there any way to read the serial data at higher rate with the help of python?

Thanks in Advance.

Marcel Kämper
  • 304
  • 5
  • 16
  • 1
    Have you configured a correct baudrate? https://pythonhosted.org/pyserial/shortintro.html#opening-serial-ports – jcf Feb 05 '20 at 14:23

1 Answers1

0

Assuming the sensor is designed to transmit 2kHz data and is doing so properly, my guess is that the time your Python code is taking to read a data sample, process the data, update a plot, etc is the limiting factor. Are you reading and processing samples one at a time? Is there a smart way to read all of the available in a big chunk reducing the number of individual read/process steps?

Are you plotting the data in "real time"? If so, plot updates are slow.

Tim
  • 1