Project: EOGee – DC Coupling Part 2

A couple of posts ago I discussed the reason that the current circuit is AC coupled rather than DC coupled, and managed to get DC coupling briefly working. The advantage of this is that it enables us to measure the absolute voltage across the eyes, rather than just the changing voltage, which gives us more information. Now I am going to address how we can get to a fully DC coupled solution to work all the time.

Screenshot 2020-04-07 at 21.38.45

High level signal flow

Ultimately the reason it can be difficult to DC couple the signal is that if for some reason there is a slight voltage offset at the output of the AD8226 in stage 1, then this difference gets amplified 220x and quickly saturates our output after stage 2. The solution is to AC couple the signal by putting a capacitor between stages 1 and 2 so that the DC component is blocked and there can be no offset. The problem is we loose information as the DC component can tell us a lot about how the eyes are moving.

Where is this DC offset coming from? I found three main sources.

Separate Voltage Reference for Stages 1 and 2

Because we are working with a microcontroller, it makes sense for our voltage rails to be ground and 3.3V. This makes everything easy because we can feed the voltage straight into the ADC of the microcontroller and also we don’t have to spend the effort to generate a negative rail. This means we need to create a voltage reference half way between ground and 3.3V which is 1.65V – we call this Vmid. This voltage is created using a voltage divider and then buffered with an opamp to create a low impedance voltage source.

Screenshot 2020-04-07 at 21.45.09

Circuit to generate a 1.65V reference for Vmid

This is a pretty standard thing to do, however, the circuit that I based my original design on generated one Vmid rail for the AD8226 and one Vmid rail for the LMV324. While these are both technically at 1.65V, there is always some offset in any design due to the opamp. Particularly in this design, we are using an LMV324 to generate the midrail which does not have a very good input voltage offset spec, with a maximum value of 7mV. (I’m not actually totally sure why the original designer separated these references.)

I measured the difference between these two voltage references and there was a 652uV difference. This means that the output of Stage 1 would be offset 652uV higher than the midrail of Stage 2 and this difference would be amplified 220x resulting in a negative offset of 143mV at the output of stage 2 (stage two is an inverting configuration). One solution would be to have the two amplifiers use the same voltage reference. Another solution is to use an opamp with lower maximum offset voltage to generate the midrails.

Mistake in Stage 2 Circuit

As I said previously, the original Analog circuit was borrowed from a backyard brains design. The final stage (stage 3) is a variable gain between 1x and 10x.

Screenshot 2020-04-07 at 21.54.26

Stage 3 circuit with a mistake

The 10kΩ potentiometer allows a variable resistance from pin 3 to pin 2 however, pin 1 should be shorted to pin 2 or floating, but definitely not connected to ground. This is a mistake on my part – I did note that this was a weird design choice but did not think about it further. I should not have blindly copied (and copied wrong). Although I will add that whoever made the original schematic should have used a no-connect symbol on pin 1 rather than leaving it floating (I bet their DRC complained and they ignored it).

Anyway, if you do the circuit analysis it turns out that this introduces a voltage offset at the output of stage 3 equal to R3/R2*Vmid where R3 is the voltage between pin 3 and pin 2, and R1 is the voltage between pin 2 and pin 1. In my case I had it tuned such that we got a 250mV offset.

I used my scalpel to cut the ground trace to the pin 1 under the microscope.

IMG_5759

A simple fix

Silver Chloride Electrodes are a Voltage Source

It turns out that the human body is not made of metal. The current that flows in the body is mostly carried by ions rather than electrons. This means that in order for conduction current to flow (rather than displacement current) into your electrode, you need to have an interface to convert ion current into electron current. This is often achieved by using an Ag/AgCl electrode, as I am. This is a common electrode design where there is a silver metal electrode coated in silver chloride in contact with a chloride solution (electrolyte). This allows the following two half-reactions to occur at the boundary:

Screenshot 2020-04-07 at 22.06.58

This is also known as a reference electrode. I haven’t studied chemistry in many years, but put simply this means that there is a voltage generated across it. In this case we would expect a voltage of about 200mV. Because we are taking a differential measurement across the eyes, we are measuring across two of these electrodes in opposite polarities, so in theory they should cancel out.

Screenshot 2020-04-07 at 22.14.27

Our patient has two electrodes in opposite polarity

However the voltage across a reference-electrode is stated at equilibrium and it turns out that this voltage can be affected by three different mechanisms.

  1. Ohmic overpotential – when current flows through the electrode, the resistance of the electrolyte results in an additional voltage drop.
  2. Concentration overpotential – when the distribution of ions in the electrolyte is unevenly distributed we see a voltage difference.
  3. Activation overpotential – when one of the half reactions has a higher activation energy than the other this can result is the reaction proceeding predominantly in one direction resulting a different voltage.

(More discussion of this can be found in Medical Instrumentation: Application and Design from Wiley Publishing)

In my case I am not sure exactly the dominating mechanism (probably not ohmic overpotential because the currents flowing should be tiny due to the high impedance of the input amplifier).

I performed an experiment where I stuck two electrodes back to back and injected a current of about 1mA through it (step 1). I then stopped the current and let the voltage settle (step 2) before connecting a 1kΩ across the two terminals to discharge it (step 3).

Screenshot 2020-04-07 at 22.35.34

Experimental procedure

The result is shown below. We can see that I was able to charge the voltage across the electrodes to about 1.2V. When I disconnected the current it suddenly dropped 400mV to about 0.8V which I suspect was the ohmic overpotential due to the resistance of the electrolyte. But it is then clear that the voltage stays quite stable for about 100 seconds at 0.8V until I connect the 1kΩ resistor and discharge the voltage.

SCR43

Voltage across back-to-back electrodes vs time (200mV and 50 seconds per division)

I repeated this experiment, except instead of connecting a 1kΩ resistor, I connected a 1MΩ resistor to put less load on the electrodes during discharge.

SCR44

The same experiment with a smaller load (200mV and 50 seconds per division)

In this case we see that the electrodes hold their voltage for almost 250 seconds before the rate of discharge increased. I’m not sure of the cause of the sudden increase in discharge towards the end.

This shows the capability of a pair of these electrodes to hold a voltage and therefore present an offset voltage at the input of stage 1 (note that this offset voltage is not the same as common-mode voltage which is removed by the AD8226 because it is a differential amplifier). In practice I have seen an offset of approximately 30-50mV at the output of stage 1 which indicates an offset voltage of 7.5-12.5mV at the input to stage 1 (due to the 4x gain of stage 1). This gets amplified 220x by stage 2 resulting in a theoretical offset of up to 11V at the output which obviously totally saturates our +/-1.65V voltage swing.

In the previous article where I managed to briefly get DC coupling working, I suspect I got lucky and basically happened to have a pair of electrodes which well cancelled each other out, resulting in an acceptable offset voltage although there was still an offset of about 1V after all amplification stages.

For one more experiment I charged the pair of electrode up to 800mV one last time and then separated the electrodes without discharging first. One electrode had a thick coating of dark material which was the silver chloride, whereas the other electrode had a lighter appearance indicating more silver metal. This was due to the uni-directional charge current which resulted in the reaction generating lots of silver metal at one electrode and generating lots of silver chloride at the other electrode. This points to a concentration overpotential where the distribution of Ag and AgCl was not at equilibrium between the two electrodes resulting in a different between the two electrodes.

5F956546-3EAC-49C3-8010-51F00EF8D856_1_105_c

One electrode is dark while the other is light indicating silver chloride and silver metal

Now that I have found the root causes of the DC offset, I will discuss in a future article how I intend to solve this issue (or possibly how I have solved it – the tense of the article depends how things go).

N.B. Another potential major source of DC offset would be the input offset voltage caused by the LMV324 of stage 2 as it can theoretically be as high as 7mV which would result in an offset of 1.54V due to the 220x gain, however I am not seeing this to be the case. The part is pin compatible with other devices so I can easily replace it with a device with lower offset voltage.

One thought on “Project: EOGee – DC Coupling Part 2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s