Author Topic: How to set OpAmp gain using microcontroller?  (Read 16351 times)

0 Members and 1 Guest are viewing this topic.

Offline envisionelec

  • Frequent Contributor
  • **
  • Posts: 286
  • Country: us
Re: How to set OpAmp gain using microcontroller?
« Reply #25 on: June 13, 2013, 11:54:19 am »
A motorized pot? :-//
 

Online David_AVD

  • Super Contributor
  • ***
  • Posts: 2797
  • Country: au
Re: How to set OpAmp gain using microcontroller?
« Reply #26 on: June 13, 2013, 10:52:57 pm »
A motorized pot? :-//

LOL - that's so much smaller and easier than an e-pot!   ;D
 

Offline mikes

  • Regular Contributor
  • *
  • Posts: 127
  • Country: us
Re: How to set OpAmp gain using microcontroller?
« Reply #27 on: June 14, 2013, 01:12:39 am »
You can use a jfet as a voltage controlled resistor. Google "voltage controlled resistor jfet."
 

Offline DoubleMTopic starter

  • Newbie
  • Posts: 9
Re: How to set OpAmp gain using microcontroller?
« Reply #28 on: June 14, 2013, 01:15:57 am »
Thanks to all of you guys! I will try to use LED/CDS method, but will also order few different types of digipots, and experiment with them if my first attempt fail.

If you choose to go with a digital potentiometer there is one important thing to keep in mind. That is it's internal wiper resistance.
Due to it's internal construction a digital potmeter is basically a switched resistor network. The selector that chooses the resistor according to wiper position has an internal resistance that could be around 70 ohms. So 10 mA of current through the potmeter (wiper) results in an 700 mV drop across the resistor. (just read about this in 'Mastering the I2C bus', and this thread came to mind)

So if used in the feedback path of your opamp you really need to keep this in mind.

I'll keep that in mind... thanks.

led+photoresistor approach is not that good, unless you can accept closed feedback loop and very slow settling time. Photoresistors are not linear, so you would have to build some sort of regulator measuring output signal from the amp and adjusting the LED current. This will be very slow, because photoresistors have rather high time constants.

You could use something like this: http://www.tme.eu/en/details/vtl5c10/tht-optocouplers-transistor-output/perkin-elmer/# but that kind of stuff tends to be rather expensive. For volume setting I would use digital potentiometer, as you can find many dedicated solutions. For anything of higher frequency range variable gain amplifiers are the only way to go.

I know it's not linear, but I'm planning to measure that function (LED current / CDS resistance) and try to approximate it in software, in worst case i will capture 50 points, enter them in table and then do a linear interpolation on the output of the PIC. Also, it doesn't need to be very precise or consistent, it's just for audio volume control and if the volume drift +/-10% over the period of few hours due to temperature change, etc., nobody could notice that probably.

I'm not really an expert, but I have a lot of confidence that this might work. If not, digipot is my second solution.
 

Offline DoubleMTopic starter

  • Newbie
  • Posts: 9
Re: How to set OpAmp gain using microcontroller?
« Reply #29 on: June 14, 2013, 01:22:45 am »
You can use a jfet as a voltage controlled resistor. Google "voltage controlled resistor jfet."

We already had this idea here on this thread, but the problem is that FET's are not bi-directional, like real resistors, and in the feedback loop of this OpAmp we have AC currents. Solution would be to shift the voltage up so that the whole signal is on the positive range (DC). This might not be a bad idea after all, I could try to experiment with it, while I'm waiting for my CDS sensors, so i have nothing to lose  :D

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf