I've been trying to create an inverting op amp circuit with the following properties:
Vout = -Vin+5
So when Vin is 0V I need Vout to be +5V
The constraints are:
a. I have a single supply (+5V and ground)
b. Vin comes from a separate function generator and varies between 0V and +5V.
Using my trusty RadioShack electronics kit I have built a version of the circuit shown below. My version has some differences, such as a +5V supply, function generator connected to R1 (and thus to the inverting input), R1 is 2.5kOhm, and R2 is a 5 k pot, and the non-inverting input is connected to a 5k pot. I'm monitoring the output with a scope connected directly to the output pin. I've been able to tweak the pots to get more or less what I need, but no matter what I do a 0V input signal via the function generator gives me about +3.5 at Vout. I'm not sure how to modify the circuit to get the output curve I need. Any ideas, please?
The data sheet says that the high level output voltage, with 5V supply, is 3.8V typical (see page 5 of TI datasheet). Many single supply op-amps will not go rail to rail. You need to find a rail to rail op-amp or increase the LM272 op-amp supply voltage to get 5V out.
You can use the standard opamp differential amplifier circuit to do this, as well
as a proper rail-to-rail opamp (rail to rail on inputs and outputs).
The inverting opamp circuit with a mid-rail virtual ground is the same as a
differential amplifier circuit with the +ve input held at +5V and the Vin going
to the -ve input. All four resistors identical here.
Dave, as I understand it the voltage divider in my schematic is right. Look in the data sheet, also. The the circuit you show is for a dual supply. With a single supply the non-inverting input needs to be at +V/2 I've tested this and verified it to be the case.
As stated in my original post, Vin is 0V to +5V and is supplied by a function generator.
I see that Digi-Key have a search filter for rail to rail op amps, so I'll go looking with that. This is probably more elegant than setting up a voltage regulator to to increase the supply voltage on the op amp I already have. I can also rummage through the parts draw and see if there's a rail to rail amp in there somewhere.
You need EXACTLY 5.0 V at V+ (depending upon the project accuracy either you need a separate voltage reference or a pot connected between 0 and 9 V).
R1 has to be equal R2 (10 k will do; match resistors by means of a multitester).
Input impedance of the inverter would be 10 k (R1); it will draw [Vin/10] mA from the source. A pulse generator will supply such a small current with no difficulties (in fact, as the input voltage is going to be "negative" -under 5 V = V+- the pulse generator "draws" from the inverter 0.5 mA.; I don't think it's a problem).
It's OK. Don't worry about calculating everything because the Vin to Vout requirements I listed are just rough starting requirements. One reason I have those pots in my circuit is because I may want to change the slope of the curve. I just don't yet know what slope I want. Clearly the main issue I'm having is the lack of a rail to rail op amp. I'll correct that first.
The slope is -1: that means that the feedback resistor and the input (Vin) resistor have to be the same (this was correct).
I've been trying some sketches: the main problem is that somewhere in the circuit you need to have negative voltages (with respect to the earth you have) to carry out the analog computing.
I don't understand why do I need negative voltages? The circuit seems to work as I intend, the only problem is that the op amp isn't rail to rail so I can't get +5V out of it when the supply voltage is +5V What purpose would the negative voltage have?
raacampbell:
Ummm... . What I didn't understand was why I need negative voltages with respect to ground in this particular case.
You don't - as long as the op-amp is designed for "rail to rail" drive. If it isn't, then if it cannot drive to ground, you need to connect its negative supply terminal to a suitable negative voltage supply to compensate for this, and correspondingly if it is unable to drive to the positive rail, you need a positive supply of more than 5V.
The non-inverting input needs to be tied to exactly half the voltage range you wish to invert, and the resistors to the inverting input need to be equal. In fact, all four resistors need to be equal so that both inputs "see" the same impedance.
Oh - are you sure the function generator is not AC coupled?
The pots are just there because I wanted to play with the slope of the Vin to Vout transfer function. Eventually I'll want a slope that isn't 1 but I've not yet decided what I want. In principle, if I already knew exactly what I wanted, I wouldn't need the pots and could use fixed resistors.