Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does the DAC and gain circuit work in practice? #80

Open
KevinOConnor opened this issue Mar 26, 2023 · 2 comments
Open

How does the DAC and gain circuit work in practice? #80

KevinOConnor opened this issue Mar 26, 2023 · 2 comments

Comments

@KevinOConnor
Copy link
Contributor

KevinOConnor commented Mar 26, 2023

Hi. I'm trying to understand how the DAC and opamp gain circuit work in practice on the Haasoscope.

At first glance the circuit appears to be a simple "differential amplifier" circuit (eg, as described at https://www.electronics-tutorials.ws/opamp/opamp_5.html ). However, my Haasoscope doesn't seem to work like that in practice.

For a standard differential amplifier, if I connect a 1x probe (zero ohms) then I'd expect the voltages to roughly follow the formula probe_voltage = dac_voltage * (1 + input_resistor/feedback_resistor) - adc_voltage*input_resistor/feedback_resistor. So, if I connect a 1x probe to GND, and I want the ADC to receive 0.900V (128 reading on the ADC, center line at 0V in the application), then I'd expect to set the DAC voltage to 0.7615V ( (0 + 0.900*1100000/200000) / (1 + 1100000/200000) ).

In practice, however, to get 0.900V on the ADC I need to set the DAC voltage to 1.0575V (2115 in the software) on my Haasoscope (v9.01 board purchased in Nov 2022). This is puzzling because this is a higher voltage at INA- than at OUTA on the opamp, while a standard differential amplifier would always have a higher voltage at OUTA than INA-. As part of investigating this, I setup the Haasoscope in the above configuration and applied a multimeter to the pins of the MAX4416, and I can confirm that the DAC voltage is 1.0575V (probe on INA+ pin), that the opamp does maintain a corresponding voltage of 1.0575V on INA- pin, and that the ADC voltage is receiving 0.900V (OUTA pin).

My best guess is that leakage current from the IN+ pin to the IN- pin on the opamp is dominating the stable state voltage. (The mcp4416 has only a 60Kohm differential resistance, which is rather small relative to the 400Kohm and 4Mohm feedback resistors.)

So, I'm wonder if there is a better understanding of how the opamp circuit is supposed to work in practice? Or perhaps I'm missing something important, or have an incorrect understanding of the circuit.

Ultimately I'd like to be able to write software that can take a user supplied voltage range and automatically configure the DAC voltage and 10x gain mode accordingly. However, I haven't been able to determine a good formula for predicting an appropriate DAC setting. I can kinda predict the results when using "gain1x mode" (there seems to be a static offset of ~0.350V from nominal predictions), but I haven't found a simple pattern when in "gain10x mode".

Let me know if there is a better place to discuss topics like this.

Thanks in advance,
-Kevin

@drandyhaas
Copy link
Owner

Did you have a look at the schematic?
eagle/max10adc_v9.0_schematic.pdf

It's an inverting opamp configuration, with the offset from the DAC going into the + pin.

@KevinOConnor
Copy link
Contributor Author

Yes, I have studied the Haasoscope schematic.

Unfortunately, if I model the opamp circuit using Ohm's law and Kirchhoff's law, the predictions for DAC settings do not match the actual DAC settings I need to use.

I'm looking for insight into how I can find an appropriate DAC voltage to bring the ADC input to 0.900V given a known probe voltage. Do you know of a formula (or theoretical explanation) for doing that?

For example, the Haasoscope circuit would predict a DAC setting of 0.7615V to get 0.900V at the ADC when a 1x probe is connected directly to gnd:
https://www.falstad.com/circuit/circuitjs.html?ctz=CQAgjOCmC0AcIAYB0AmFCDsmyzAVgDYECsAWAkWPcBEAlEPGMMAKAHlwMK5aVTavcIlYBzEENLwhsWnNYB3SoNlceqhKwBKE1dACcPMCmmHE5sAitXzcxEjysAhhLDrae1fHyvql6zbI3GCk+v4IhAj6CCjUQQQ+4VasAE66gmaS8LRJ1qnpEpluhRQ5ufnQxZUmdKSuNXwBmkqVRjWtJSJKBHXV8J7yLVU9rqUiOh20UrbmAvbBcbYO2qMgAMx4DNMbDHZzYEgRGItyy0MUJtLFO121IGh1qigYu4qrD++EImkdHyMfjQCFSeX1+XzKTWBfFBqgEdlyyRcvxeynuKO81EqfiaOUOeAwUmOMVI6BJ9HAeOONCBExBbXgsTGOSaM1OjiUTxRYG4aNe4kkNkka12Ik43IuKP4fC5IgAHhJnq5YBdSBBKrA1iA6vwQAAVAAWkAA9ilIAAXACWAGMnAAbAA6AGcACIAQQAwk6AG5G21mpyiSCseXQNbeXBcOo4Orauquq1mgCudqdbs9jp9foDQaAA

However, in practice I need to use a DAC voltage of 1.0575V. Not only would this predict an ADC voltage of 1.25V, but at the actual ADC voltage of 0.900V, the potential at the IN- pin is higher than both the potential at the ADC input and the probe input. Thus, in practice, current flows from the IN- pin over the 200Kohm feedback resistor to the ADC - with an ideal opamp current should flow in the opposite direction across that resistor in this case. (In the link above, with the theoretical circuit, current flows from opamp OUT to the left, but in practice on my Haasoscope it is flowing from opamp IN- to both the left and right.)

Cheers,
-Kevin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants