SimpleThings:
Would adding potentiometer as R3 work ?
Well I have some theoretical knowledge about the op amps ( amplification , inner resistance , etc.) , but could you be more specific on rail-to-railness I don't know much about it.
Yea, well... Ideal opamp with 5V supply voltage, set to the amplification of 2, will amplify the input of 2.5V exactly to 5V. However, lm358 is not really ideal.
If you power it from 5V with A set to 2 via the resistors and give it 2.5V, it will give you around 4V. (I am not looking at the datasheet at the moment, so this is just some number that I remember from my experiments).
You need to have a sufficient overhead, so that the voltage you want to output isn't too close to the Vcc supplied. Same applies to the other rail, so you can't go all the way to the ground with the output.
The overhead is in the datasheet. Keep in mind that it's also a function of the source/sink current.
this datasheet seems cool
search for
Output Characteristics Current Sourcing and Output Characteristics Current Sinking
And... Well, you can use a pot. But then you'll have an arbitrary amplification and you won't know what it is, unless you pull the pot out of the circuit and measure it. ![]()