Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eegScope update problem #5

Open
chrille94 opened this issue Jan 20, 2022 · 1 comment
Open

eegScope update problem #5

chrille94 opened this issue Jan 20, 2022 · 1 comment

Comments

@chrille94
Copy link

I'm having problems with eegScope.py. Running it with a test signal from a function generator, the correct frequency and waveform is shown. The scroll rate of the raw signal is however only half the speed of the expected. i.e. when 2 seconds have elapsed, the graph has only scrolled 1 second (going by the markings on the graph). This results in the data on the screen being delayed compared to the current signal, with this delay accumulating over time. The FFT plot follows the raw data, i.e. it's also delayed.

I've tried changing 'Fs' in the and other parameters in the Python program, but it either doesn't help or breaks the code. I've also tried with different sample rates on the microcontroller. I've verified that the microcontroller sends data at the correct rate and that the packets are up-to-date.

Thinking it could be a problem with precessing time, I also tried removing the FFT plot and all the FFT calculations, but the result was the same.

@chrille94
Copy link
Author

After tinkering a bit more and pulling out a few hairs, I finally found the issue. It's the PySerial module that simply couldn't keep up. Timed how long it took to receive 5000 samples at a 500 Sa/s rate, and it came out to approx 15 seconds, while it should have been 10. I guess the data was put in some buffer "under the hood", which is how I was able to see tens of seconds old data.

Worked around the issue by lowering the sample rate all the way to 250 Sa/s, which should still be sufficient, given the low frequencies of the EEG signals.

It's a bit strange though, given you were able to run it at 1000 Sa/s.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant