Name:

Password:

or

A Surprising Signal Filtering Result

by Octapoo

Thursday, February 27, 2020 at 22:56:00 UTC

Return to the Summary in Ecstatic Lyrics Blog

I've been working a little each day on making a new EEG machine. I don't expect to learn anything new about my sleep, I'm mostly just want to do something.

One goal is to apply something I learned while writing SDR software: When you reduce the bandwidth of a signal by filtering out frequencies you don't want, you improve the signal-to-noise ratio.


The SDR device I have captures radio at a 2 MHz sampling rate, but with only an 8 bit ADC, which might not sound bad until you consider that you have to set the gain of the amplifier such that the strongest signal in that 2 MHz spectrum doesn't clip the ADC. ...and not just the strongest signal now, but the strongest signal that might be received. In practice this means that a lot of what you want to listen to is being recorded in 1 or 2 bits, and the rest is just headroom.

However, it still works because every time you cut the bandwidth in half, you improve the signal-to-noise ratio by 3 dB, which is half a bit. Of that 2 MHz bandwidth recorded by the SDR, you want to listen to maybe 5 kHz of it, which is just 1/400th of the total bandwidth. So filtering out the unwanted bandwidth adds 4.32 bits of signal. That brings you up to 5 to 7 bits which is fine for radio audio.

So I wanted to apply this to my EEG. I've never found better ADCs than the 12-bit ADCs I used last time I built one ten year ago, but by using this method it should be possible to get better than 12 bits of precision, which would be helpful because I could then do less amplifying in hardware and more in software where I can apply better filtering than I can build with circuits.

So I went with a sampling rate of 12,000 samples/second, which in software I can cut down to 120 with a 40 Hz cut-off. Since 12,000 / 40 = 300, and log2(300) = 8.2288, that means I get another 4.1144 bits of signal. So I effectively have a 16-bit ADC now.

A note from the future: Shouldn't that be 6,000 / 40 = 150? IDK, whatever.

Anyway, I just got this working and saw something that was so surprising that I had to post a picture:

The top solid black bar is the unfiltered signal, which is wall-to-wall saturated with 60 Hz interference, such that most of the input samples are either the maximum or minimum value, but after filtering, you see on the second line that it looks basically like it's supposed to. I would not have thought that was possible.

Comments


If you were logged in, there would be a comment submission form here.
Creating an account is easy. You literally just type in a name and a password.
I don't want your email address, so there won't be any links in any emails to click.

Return to the Summary in Ecstatic Lyrics Blog