Python Forum
Receiving large data stream using Pyserial - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Receiving large data stream using Pyserial (/thread-2346.html)



Receiving large data stream using Pyserial - trampas - Mar-08-2017

I am having a problem where I am streaming binary data from a micro to PC and I want to graph the data. 

The data is binary data coming in around 100 kBits/sec.  So I setup a thread in python to receive the data and I save the last 2 seconds of data to an array. The issue I have ran into is that when I plot the data the receiving thread halts and appears to cause the Pyserial receive buffer to over flow.  That is the threads are not running concurrently. 

I figure I am not the first person to use Python and stream large data real time into python, does anyone have an example of how to do such a thing?

Thanks
Trampas


RE: Receiving large data stream using Pyserial - Analyser - Mar-09-2017

You may need to refer to Python's threading topic: https://docs.python.org/2/library/threading.html#semaphore-example

Avoid the data to be accessed by the receiving thread and plot thread concurrently.