# How to set up an experiement to measure SNR for an EEG amplifier?

I have built an EEG amplifier with gain of 2000 and bandwith at 1~40Hz.

I use an Instrument Amplifier for pre-Amp and a non-inverting opamp as post-amp and finally bandlimit at 40Hz using a 4th-order LPF.

I would like to measure the SNR for my EEG amplifier but I do not know the proper set up and therefore I come out with the following experiment steps and please verify for me am I doing the right thing.

How I record the measurement: I connect the analog output to the SADC pin of ARM MCU. The ADC sampling rate is 7000 samples per second

My input: A differential Sine wave from function generator @ 10Hz

My output: An amplified Sine wave @ 10Hz @ gain = 2000

1. Measure the Vrms for noise

1.1 Let input of INA to open and then power on the amplifier.

1.2 Measure the output and record the ADC data

1.3 I record the output for ~5 seconds which give me ~50,000 data

1.4 I select a portion of 10,000 continuous data sample, which is 1-10001 data samples

1.5 Calculate the Vrsm using similar equation provided here

1.5.1 Calculate the power of 2 for each of the 10, 000 data
1.5.2 Calculate the average result of the total data (which is divided by 10000)
1.5.3 Vrms = Square root the result of average of 10, 000 data


2. Measure the Vrms for signal

2.1 Let the input connect to a differential Sine wave generator

Repeat 1.2, 1.3, 1.4. 1.5 to calculate the Vrms of signal.

3. Calculate the SNR (db)

SNR(db) = 20 log (Vrms, signal / Vrms, noise);

My question: Am I doing the right thing for the SNR measurement?

Edit: Update question

Now I am confused. The MCU is powered at 5V from an eval board whereas my system is a 3.3V powered. The MCU SADC is taking the voltage measurement at pin SADC with reference to 0V (GND).

However, my system AGND is at 1.65V.

Therefore, how should I connect the output of my system to the eval board?

I try the following scenarios:

1. Connect the SADC pin to my EEG amplifier output and connect the MCU GND to my EEG AVGND

It will measure the noise like this, which is a sharp peaks:

2. Connect the SADC pin to my EEG amplifier output and connect the MCU GND to my EEG 0V ground

It will measure the noise like this, which is looks like a power noise:

Which is the correct one? or both wrong?

• Is G=2000 enough to perform a good reading? I remember, we had to do G=1M to amplify EEG signals that are on order of microvolts to several volts to fit into the ADC resolution range. – Nazar Jul 9 '14 at 14:49
• Does the circuit work?? You don't mention how you're removing DC before amplification. You need enough headroom to allow for about 150mV of electrode junction potentials – Scott Seidman Jul 9 '14 at 15:00
• @Naz G=2000 is not enough for practical. But in my experiment, I am simulating a 200uV Vpp Sine input and give me a 400mV Vpp Sine output. In practical, I increase the gain to 8000 and it gives me a ~600mV peak for eye blink. I got use RLD. @Scott seidman Yes. It is working. I am still considering the DC restoration feedback. Is it real useful? What does it mean by leave enough headroom for 150mV electrode junction potentials? – jhyap Jul 10 '14 at 8:37
• I mean that the DC signal on any given electrode can differ from that on any other by a number on the order of tens of millivolts just because of electrode chemistry and how it attaches to the skin. If you multiply that difference by 2,000, you're saturated? What is the gain of your headstage, and where do you remove the DC bias? – Scott Seidman Jul 10 '14 at 12:05
• Anything in front of the INA will hurt your CMRR, if you're not very careful. I suggest a modest gain INA, followed by high-pass filtering, followed by bigger gain stages. – Scott Seidman Jul 10 '14 at 16:00

Yes, that's a reasonable approach, except that you'll also want to calculate the mean (DC bias) of your 10000 samples, and subtract that from the individual samples before you square them for the RMS calculation. This is equivalent to using a high-pass filter to block DC.

• Really? Ok, I will do that before square it. Thank you! – jhyap Jul 9 '14 at 14:14
• Won't the output in response to a floating input be absolutely huge?? – Scott Seidman Jul 9 '14 at 15:21
• Yes, 6 decimals – jhyap Jul 10 '14 at 2:17
• @Dave Tweed Should both measurement also minus the DC bias or just for the noise? – jhyap Jul 11 '14 at 14:32

I think you have a pretty good test setup. When making your noise measurement in step 1, I would recommend connecting the two differential inputs of your amplifier using an impedance that matches the output impedance of your detector. Also, I agree that you should subtract the DC-offset before computing Vrms as the other user recommended.

You can also simultaneously test for distortion (SINAD) as follows. (note, your current test will give you signal+distortion to noise ratio instead):

1. Take data is in your step 2.
2. Compute the FFT of the the data taken.
3. Block off the smallest possible window around the peak created by your sine wave in the FFT.
4. Compute the signal power from within your block then compute the noise and distortion power as everything else in the FFT.

I would recommend using a tool like National Instruments' wavevision software, which will do this and more for you.

Regarding grounding, it looks like in #1 your signal is out of range of your ADC (it appears to rail out at 0). Given the two options, I would go with #2 but there may be an even better alternative. You might consider opening this up as a separate question so you can go into more detail about what voltage supplies you are using and get more focused feedback on that aspect.

• So we agree that to measure the noise in SNR for my amplifier, we should let the input open (not connecting anything). But what does it mean by "impedance that match with the output impedance of my detector"? And in your recommendation, you suggest me to measure the signal only. Then segregate the signal and noise through FFT. Then finally use the power spectrum result to calculate the SNR. Right? – jhyap Jul 15 '14 at 5:39
• No, I mean it should be connected by a resistor, or perhaps a complex load if you understand the output impedance of whatever is driving your amplifier well enough. For example, if your input is a 50-ohm antenna, then a 50-ohm resistor would be good to use to ground your input. If your input is a pre-amp with 1k-ohm output impedance, then use 1k-ohm. – kjgregory Jul 15 '14 at 14:55
• As for using the FFT, the purpose is to also characterize the distortion of your amplifier. In some applications, this may not be important to you, so you can decide whether or not you want to do this. The idea behind it is that if your amplifier is distorting your sine wave, then the FFT will show additional harmonics, typically at higher frequencies. These harmonics won't show up with a quiet input. – kjgregory Jul 15 '14 at 14:57
• The suggestion of input load is reasonable and clear now. Thank you very much! ^^ – jhyap Jul 16 '14 at 1:05

I would take a different approach

SNR is a simple measurement setup, you need to have the ff: 1.) noise source of known power(voltage) 2.) signal source (function gen in your case) 3.) A combiner( usually passive) 4.) A means of qualifying detection in your case an ADC

Setup: 1.) make sure Noise power and and function gen power can be set to the same level (power or voltage) (resolve impedance issues) 2.) Make sure function gen power can reach at least 12dB-20dB over noise power. 3.) make sure you can make 1-2dB step in voltage over the noise power. 4.) calibrate everything in dB and dBm in your case I will settle with 600ohms(balanced or unbalanced) in dBm and dB.

Test: 1. combine noise and function gen and load them ac coupled to EEG amp (dc voltage will not be an issue) 2. Set Noise power and signal power as equal(starting voltage need not to be very low) 3. Sample output (across fixed time will be ok across fixed n samples will be better) 4. step up signal power another 1-2dB (resolve the step you wanna use) 5. then undertake step 3 until you have stepped up to 20dB above starting point.

Determination of SNR threshold: 1. You can either do this subjectively by looking at the signal waveform where noise rejection is at best. or 2. calculate the least distorted sinewave from your samples or 3. use your intended detection device to subjectively 4. Or use complex methods by comparing input signal against output signal and calculate standard deviation. Good SNR is 3 sigma excellent SNR is around 6 sigma.

If I am not mistaken there are software tools used to calibrate audio amplifiers that uses your PC/laptop audio functions to measure SNR. It even has a noise gen, function gen and fft. I used one a long time ago (9 years ago) to calibrate a moving coil pre amplifier and it worked well but forgot the software package name (it was freeware) try these maybe they are workable:

http://www.satsignal.eu/software/audio.html

http://www.esseraudio.com/

• You mean inject signal and noise at the input at the same time? The result of INA is V+ - V-. So do you mean, I need to connect the V+ as signal source and V- as noise source? – jhyap Jul 21 '14 at 0:46