Electronic – Active resistor for gain Control for reference pin in instrumentation op amp

amplifierinstrumentationreference

I'm using an instrumentation amplifier (AD8421 from analog device) to amplify very small signals in magnitude from 20uV to 500uV max. the problem I have with this is that the signals might have some offset voltage (depends on noises) of up to 100mV. Now because I need high gain to get the signals, these offset voltage can easily saturate my output.
My circuit

In order to resolve this issue, I used an Op amp in reference pin to adjust the reference according to signal. The pic above shows my circuit. This works fine, but I need to change the value of R9 (in U3 LT1028) from around 100k to 1M. How can I do this according to my input signal? I thought of using a FET to change this but I can't figure out how to do this.

Some basic explanations: VG1 is my input signal, U1 Op amp is a HPF which is not really my question here, and U3 is my reference op amp amplifier. Also, R1 to R4 (on the left side of U1) are supposed to suppress these offsets for me but for some reason they don't do it. Also, the device is used for signal acquisition from rats, so the offset really depends on grounding of the animal body and that is something that may not happen always.

Best Answer

I'd use an integrator between the output of the In-amp and its reference pin. This is the tried and tested way to remove rogue dc offsets from the output and it works automatically because of negative feedback.

However, if the dc input level is so high it swamps the In-amp input stage then ac couple the sensor signal to the input.