EEG Design help? - Page 1
Forum section: electronics / projects

author: dotcom.com
author_rank: Contributor
timestamp: August 29, 2023, 02:42:22 am
content: Currently working on an EEG design for an ESP32 microcontroller. This was part of my capstone project, and I am just working on this for fun and to learn more as this was my partners subsystem. I modifying my partners design which was originally on Multisim.So the first image is the full EEG transient.Next a notch filter AC sweep which is used twice for the 60 Hz noise.I went back testing each component finding the differential gain and common mode of the instrumentation amplifierDifferential Mode Gain Ad = 100.4 mV / 1.04 mV = 96.5385 V/VCommon Mode Gain Ac = -489.32µ/0.9927 mV = 0.48932mV/0.9927mV = -0.4929 V/VCommon Mode Rejection Ratio (CMRR) = 20log10(Ad/|Ac|) = 45.8385 dBThis was interesting as in the datasheet for the IC it can reach 110 and I know ideally you want to be at least above 100dBI am also planning on implementing a voltage regular for the negative 3.3V onto the instrumentation amplifier as the ESP32 can not take negative voltages but I am trying to perfect the amplifier first before so.I also ran AC Sweeps on my bandpass filter, which I am trying to get the 3-12 and 12-30Hz frequency for alpha and beta waves.Any advice on anything I'm doing wrong? Still trying to figure everything out and learn.EDIT:I have accounted for DC Offset for the CMRR and now here are my modified calculations:To amplify an input signal of 0.1mV to the range of the ESP32 3.3V, I pick a range of 0.1V to 2.5V to allow for some signal peaks.Determine the desired output midpoint based on your output range:Midpoint Output = (0.1V + 2.5V) / 2 = 1.3VCalculate gain to amplify to the midpoint of 1.3VGain = Midpoint Output / Input = 1.3V/(0.0001 - 0.00001)V = 14,444.4 V/V(Adaptive gain control? - for consistent amplified signal?)The gain of the INA118 is set by connecting a single external resistor, RG, connected between pins 1 and 8.G = (1 + 50 kΩ) / RgTo find Rg with gain 14,444.4 V/VRg = (1+50kΩ)/14444.4 = 0.00353kΩ = 3.53ΩDifferential Mode Gain Ad = Vout diff / Vin diff = 1.21V / 0.000089 V = 13463.1V/VCommon Mode Gain Ac = 0.001366mV/94.8µV = 1.361 µV/94.8µV = 0.014409 V/VCommon Mode Rejection Ratio (CMRR) = 20log10(Ad/|Ac|) = 119.41dBI am now working on working on modifying the instrumentation amplifier for a positive power supply, so I have switching the IC to a single supply and adding a voltage regulator.

author: moffy
author_rank: Super Contributor
timestamp: August 29, 2023, 02:59:11 am
content: The instrument CM picture is that of one of the notch filters. To simulate CM on the instrument amp, join pins 1 & 2 together and connect them both to the same signal source, then measure the output versus input. It will be frequency dependent as all CMRRs are.

author: dotcom.com
author_rank: Contributor
timestamp: August 29, 2023, 03:38:31 am
content: Quote from: moffy on August 29, 2023, 02:59:11 amIts not? Pins 1 and 2 have the same valued voltage source. However should it be a single voltage source that goes into both the inverting and noninverting or two separate sources of same voltage and frequency.

author: moffy
author_rank: Super Contributor
timestamp: August 29, 2023, 06:25:01 am
content: Quote from: dotcom.com on August 29, 2023, 03:38:31 amBecause that is the definition of Common Mode, the same voltage on both inputs as opposed to Differential Mode, the difference between the voltage on both inputs.P.S. Please look at:https://www.ti.com/lit/ds/symlink/ina118.pdf?ts=1693290331912&ref_url=https%253A%252F%252Fwww.google.com.au%252Fand section 8.2 'The Functional Block Diagram' there is a voltage generator shown Vcm which is connected to both inputs.

author: Marco
author_rank: Super Contributor
timestamp: August 29, 2023, 06:57:56 am
content: Why are you measuring the DC offset of the output?

author: dotcom.com
author_rank: Contributor
timestamp: September 13, 2023, 08:46:37 pm
content: Quote from: moffy on August 29, 2023, 06:25:01 amI see, but I did make the switch and found the output to still be the same.

author: dotcom.com
author_rank: Contributor
timestamp: September 13, 2023, 08:56:15 pm
content: Quote from: Marco on August 29, 2023, 06:57:56 amAt which part? The final EEG? For that I'm not trying to look for the DC offset, and I think whatever is happening there, it's occurring due to my instrumentation amplifier. I'm trying to measure the actual output of the EEG.

author: Marco
author_rank: Super Contributor
timestamp: September 14, 2023, 10:31:47 am
content: AFAICS you used the DC level of the output for your CMRR calculation, not the AC amplitude.

author: dotcom.com
author_rank: Contributor
timestamp: September 15, 2023, 04:33:25 am
content: Quote from: Marco on September 14, 2023, 10:31:47 amOhh I see, so you mean that when I calculated for the common mode gain I didn't account for the DC offset. I did not see or even think about that. Thanks so much. I've also made a lot of changes to the design and will be updating everything soon. I am currently still improving this amplifier and to account for the ESP32 MCU, which is restricted to a positive 3.3V so I am switching to a single supply IC; the INA 122 and also adding a voltage regulator.

author: jonpaul
author_rank: Super Contributor
timestamp: September 15, 2023, 05:43:12 am
content: WHAT IS EEG?

author: dotcom.com
author_rank: Contributor
timestamp: September 23, 2023, 12:54:35 am
content: Quote from: jonpaul on September 15, 2023, 05:43:12 amEEG stands for electroencephalogram, which is a medical test used to measure the electrical activity of the brain, via electrodes applied to your scalp.