3
\$\begingroup\$

This is a question I managed to solve! But because it took me 2 weeks to find out the issue and write this whole question, I leave it here for anyone that might face the same issue at the future.

Short question: I use this hookup as part of a potentiostat sensor and I am trying to debug a weird behavior of the op amps (R11,R12 placement idea taken from here):

schematic

simulate this circuit – Schematic created using CircuitLab

I bias the input of the potentiostat (Poten.Vin) with a sq wave pulse that has a start/end voltage (from -0.8 to +0.8V in reference to my Virtual GND (2.5V), an amplitude voltage, step voltage and frequency. Example screenshot from PStrace software:

PStrace sq wave
where I take samples/measures of the current at Potentiostat Vout for the Ireverse and Iforward currents.
this is the output at Potentiostat Vout:

potentiostat vout

Two seemingly parallel lines but when they get subtracted, they are not parallel. And I do not understand why the are not paallel, their subtraction shows a pattern of a wave-like behavior. I believe this is something that has to do with the op amp's priciple/functions that I am not aware of.

Long question:

I am making a potentiostat PCB and at the process I am comparing my results with a commercial potentiostat. I have managed to replicate the cyclic voltammetry and chronoamperometry techniques and the results are the same as the commercial potentiostat so I am on the right path.

I am stuck at a point, where I am making the squarewave voltametry technique. There is no real need to know how an potentiostat operates, as I managed to replace the sensor with resistors so that the schematic can be analyzed easier. I will first talk about how I saw the problem in the original schematic with the potentiostat sensor and then I will show how I replaced the sensor with resistors.

schematic

simulate this circuit

MAX4238 datasheet

This is the electrode/sensor:

potentiostat sensor

What I dont show in the schematic are the decoupling capacitors on 5V and 2.5 voltage rails . I have placed about 10 100uF decoupling capacitors and 5 22uF caps close to the op amps. The C35 is for foltering, without it my output is noisy. I figured out to place C35 by placing capacitos here and there, I am not sure how else I could better filter the potentiostat.

In sq wave voltametry I measure the Iforward and Ireverse currents. The final curve is the result of subtraction of the forward/reverse curves. So in my screenshot I show all of my three curves.

My maximum current is ~the same as the commercial's one, but the maximum point of my curve is pointy, or distorted, but never "curved" as the commercial's one (theoretically, it must be curvy).

data for comparison with commercial potentiostat:
potensiostat curvy top when they overlap:
curve comparison

So I traced the issue in one point: I probed the CE (CE point shown in the schematic as well, its the output of OP-AMP (A)) of the electrode and I noticed that on the Reverse current the voltage does not "behave" as the forward voltage. See below image, the voltage at CE, as the curve rises faster, the voltage at CE, for the reverse current gets distorted:

CE potentiostat sq wave voltametry probing

So at ~2.5V I have a fast rising curve of current and its the voltage that the potentiostat (A)'s positive reference input is.

Apart from CE's "weird/problematic maybe" probing, I didnt see anything weird on the rest of the circuit.

I thought this was an issue with how fast my op amp is so I swapped the MAX4238 op amps with MAX4239. I then needed to change the C35 to a lower value and add a resistor in op-amp B since they would oscillate otherwise. But the circuit still had the same issue. And then I replaced the sensor with resistors based on this paper

My hardware, demonstration of measurement and the sample on the sensor:

my potentiostat

Questions:

  1. How could I debug this behavior to see where its coming from? My knowledge to op-amps theory is limited. I am thinking of placing capacitors around the op amps to see if something changes, for example capacitors between the inputs of the op amps.
  2. Where do you think this issue comes from? Op amp A or B?
\$\endgroup\$

2 Answers 2

4
\$\begingroup\$

The issue was the DAC not outputting a linear output voltage. I figured this out when I biased the output of the DAC to my MCU's ADC and I saw this waveform on the output (I also added a straight trend line so that the difference is shown):

trend line DAC output - measured

This was hard to notice that is why the debugging was so difficult. In MCP4725's datasheet one can see the voltage shift:

DAC voltage shift
And I think the one to blame here is also the INL error:
INL vs code DAC

Same goes for my Atmega328p's ADC:

Atmega328p ADC shift

Now the question becomes: is it really the DAC or my MCU's ADC shift?

After re-building the circuit with a better DAC: It is mostly the DAC's shift that causes the eroors, as the MCU's ADC shift doesnt have so much of an effect when the voltage bias to the ADC has a large range (several Volts). The result with a better DAC (I used AD5423):

sq wave voltametry better DAC

Also, in my question I mentioned:

the voltage at CE, as the curve rises faster, the voltage at CE, for the reverse current gets distorted:

The reason of the distortion was the R1, R2 resistors were originally 110R and thats a low impedance input, I needed a larger impedance input to the potentiostat. I replaced R1, R2 with 10k resistors, (I also edit them in my question to be 10k) and there is no distortion on the pulse signal.

\$\endgroup\$
1
\$\begingroup\$

Your requirements call for a decent 16-bit DAC.

Also, you'd probably want some self-diagnostic functionality, and for that you don't want MCUs built-in ADC, but an external ADC as well, and likely a "slow" 24-bit sigma-delta part, since that will be inherently much better than the DAC, and will let you get diagnostic data out without probing the thing manually. A cheap MUX would do the job of connecting that ADC to various circuit nodes for diagnostics.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.