Python Forum

Full Version: Real Time signal processing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a Raspberry-pi4 and ADC which communicates through SPI and sends samples from sensor to Pi. The signal needs to be processed "real time" but the sample rate is bigger than processing rate. I was told to take a batch approach: sending data samples from ADC to a sort of buffer and the process a block of samples at once. I've thought about implementing buffer with python queue and using threading. In this way, the main thread should continuously fill the buffer, while the second thread should process a block of samples receveid when the buffer is full.
But how can I send the whole buffer's content to the processing code when It becomes full? The processing code should work on array. Is it right implementing threading? How can I control the right sampling frequency?
I want to acquire a slow signal (breath signal) at 100 Hz.
you might want to take a look through: https://pypi.org/search/?q=signal+%2B+processing
Since I haven't used any of these packages, I can't point to a specific example.
However, with a small amount of effort looking through these you might save yourself a lot of time.
Ok, but anyone who has implemented the scheme I suggested? Threading + buffer?