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 amplifier
Differential Mode Gain Ad = 100.4 mV / 1.04 mV = 96.5385 V/V
Common Mode Gain Ac = -489.32µ/0.9927 mV = 0.48932mV/0.9927mV = -0.4929 V/V
Common Mode Rejection Ratio (CMRR) = 20log10(Ad/|Ac|) = 45.8385 dB
This was interesting as in the datasheet for the IC it can reach 110 and I know ideally you want to be at least above 100dB
I 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.3V
Calculate gain to amplify to the midpoint of 1.3V
Gain = 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Ω) / Rg
To find Rg with gain 14,444.4 V/V
Rg = (1+50kΩ)/14444.4 = 0.00353kΩ = 3.53Ω
Differential Mode Gain Ad = Vout diff / Vin diff = 1.21V / 0.000089 V = 13463.1V/V
Common Mode Gain Ac = 0.001366mV/94.8µV = 1.361 µV/94.8µV = 0.014409 V/V
Common Mode Rejection Ratio (CMRR) = 20log10(Ad/|Ac|) = 119.41dB
I 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.