7
\$\begingroup\$

I need to be able to control the gain of an op amp with an mcu. I know the obvious way is to use a digital potentiometer or an op amp which was already designed for this purpose.

I am wondering if this will do the trick:

schematic

simulate this circuit – Schematic created using CircuitLab

basically the mcu can use the mosfet to switch another resistor in parallel to R2 which would increase the gain from 2 to about 27 in this example. So i'm thinking to have an array of mosfets, maybe 3 in total or so. Would that work ? I realize this would effect the high pass filter of C2-R2.

Another way of doing the same thing is putting R4 in series under R2 and shorting it out with the mosfet.

Which way is preferable ?

Thanks in advance !

\$\endgroup\$
  • \$\begingroup\$ You have already drawn the circuit in CircuitLab. Why not just go ahead and run the simulation, and find out for yourself. \$\endgroup\$ – Marla May 31 '14 at 13:29
  • 1
    \$\begingroup\$ I have already did that in LTspice, it seems to work. But I might have missed something, just want a 2nd opinion. \$\endgroup\$ – Mike May 31 '14 at 13:34
  • \$\begingroup\$ analog.com/static/imported-files/application_notes/… \$\endgroup\$ – Ignacio Vazquez-Abrams May 31 '14 at 15:03
  • \$\begingroup\$ What about a digital potentiometer like the AD5292? \$\endgroup\$ – Peter May 31 '14 at 17:33
6
\$\begingroup\$

Since you've run a simulation, go and do an AC sweep to see where the MOSFET capacitance starts to increase the gain (should be MHz, looking at it).

Also, for high signal levels (greater than a few hundred mV input), with the MOSFET off, the MOSFET body diode will cause huge distortion on the negative half cycles. A change in bias could prevent that, but watch out for 'click' effects on gain change if that is important to you.

\$\endgroup\$
  • \$\begingroup\$ Forgot about the body diode, thanks. Luckily my input signal is biased on about 6v dc. I did an ac sweep on the frequencies that are relevant to me, and the mosfet capacitance is insignificant at those low frequencies. \$\endgroup\$ – Mike May 31 '14 at 14:07
  • 1
    \$\begingroup\$ @Mike In the circuit you show the MOSFET is capacitively coupled so the input bias doesn't matter- the voltage across the MOSFET averages to 0V. \$\endgroup\$ – Spehro Pefhany May 31 '14 at 15:09
2
\$\begingroup\$

A good second opinion would be to breadboard it and feed in your expected signal. You have hinted that you are inputting a low frequency signal, thus the change in your filter characteristics should not be an issue. But, the only way to be sure is to break out some parts and give it a try!

I can tell you that I tried to use the second circuit you described to provide adjustable gain on a per sensor basis, and it worked perfectly. I felt it was easier to get the gain steps I wanted while keeping to common resistor values. It's possible to do the Same when the resistors are in parallel but harder to get the balance between the steps you want and the price of the resistors. The sample rate was only about 500Hz, though, so the mosfet capacitance did not mess things up for me.

One thing I should note about your circuit if you do intend to breadboard it, that pull down resistor R5 is going to sink quite a bit of current. If you intend to drive that input with a microcontroller pin, it will have trouble pulling that input high.

\$\endgroup\$
  • \$\begingroup\$ Oops, I meant R5 to be 10k. I will breadboard it up, but I don't have an oscilloscope so it won't be easy to see how it preforms. \$\endgroup\$ – Mike May 31 '14 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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