I implemented an op-amp subtractor based on the following circuit
The op-amp is a TL071 and supplied with +-15V. The Vref is obtained by connecting the common end of a potentiometer to the input and the other two terminals of the potentiometer are connected to +15V and ground. So I can adjust the value of Vref from 0 to +15V.
The problem is: when I change the value of Vin, the Vref also changes. Why is this happening?
I thought about your solution. The potentiometer I use is a 22k ohm one. If I manage to get an output of 3v from the 15v source, it is equivalent that there is a resistance of 17.6k ohm between 15v power source and 15v terminal of potentiometer. Is there any point to connect another 1k ohm resistor in between?
Your problem is that when you change Vin, causing the output voltage to change, the current through R1 and R2 changes as a result. This change in current generates a different voltage drop across the potentiometer impedance. Thus you need to make the impedance at Vref much smaller then R1 and R2. You can do that by using a unity-gain, non-inverting op amp from the pot output to provide Vref.
Yes. The amount of error is related to the relative value of R1 and R2 as compared to the equivalent pot resistance. So you can reduce the error (but not to zero) if you increase the value of R1 and R2 and reduce the value of the pot resistance. You have to decide what the tolerable error is for the Vref change with a change in Vin.