# Sensor Circuit Design, need help with Op-Amp

#### kanha

Joined Jun 30, 2010
3
Hi Everyone
I am trying to measure a variable resistance(Rv) which changes with input (X) according to the following equation

Rv = 0 Ohm at Xin = 1000
Rv = 1000 kOhm at Xin = 0

I am using the feedback resistor as 10kOhm. The input resistor is (Rv + 10kOhm). Hence, as per the close loop equation, I should be getting

At Xin = 1000
Vout /Vin = - Rf/Rin = - (10)/(10+0) = -1

with Vin = Vcc = 5V
Vout = -5V (or 5V with phase -180)

At Xin = 0
Vout/Vin = -Rf/Rin = -(10)/(10+1000) = 0
with Vin = Vcc = 5V
Vout = 0 V

I am using LM324 which is a standard Op-Amp and getting 0.6V for Xin = 1000 and 0.0V for Xin = 0.

Please can you let me know if I am doing something wrong.

Aliter
Using a simple voltage divider, between 10kOhm and Rv, I can see the voltage change from 0 - 5 V. The reason for using the OpAmp is to act as an inverter so that Vout ~ Xin rather than it be Vout ~1/Xin.

Best
Chandra

#### Attachments

• 172.4 KB Views: 30

#### KeithWalker

Joined Jul 10, 2017
459
Hi Everyone
I am trying to measure a variable resistance(Rv) which changes with input (X) according to the following equation

Rv = 0 Ohm at Xin = 1000
Rv = 1000 kOhm at Xin = 0

I am using the feedback resistor as 10kOhm. The input resistor is (Rv + 10kOhm). Hence, as per the close loop equation, I should be getting

At Xin = 1000
Vout /Vin = - Rf/Rin = - (10)/(10+0) = -1

with Vin = Vcc = 5V
Vout = -5V (or 5V with phase -180)

At Xin = 0
Vout/Vin = -Rf/Rin = -(10)/(10+1000) = 0
with Vin = Vcc = 5V
Vout = 0 V

I am using LM324 which is a standard Op-Amp and getting 0.6V for Xin = 1000 and 0.0V for Xin = 0.

Please can you let me know if I am doing something wrong.

Aliter
Using a simple voltage divider, between 10kOhm and Rv, I can see the voltage change from 0 - 5 V. The reason for using the OpAmp is to act as an inverter so that Vout ~ Xin rather than it be Vout ~1/Xin.

Best
Chandra
You are applying a positive voltage to the - (inverting) input of the op-amp with a reference of 0 volts on the + input. This will try to drive the output negative so it will remain at the lower output threshold of 0.6 volts. You need to make the reference voltage higher than the input to get a positive voltage on the output.

#### Audioguru

Joined Dec 20, 2007
11,251
The opamp in the schematic is not powered. The text says that Vcc is +5V but does not mention a negative supply.

#### KeithWalker

Joined Jul 10, 2017
459
Hi Everyone
I am trying to measure a variable resistance(Rv) which changes with input (X) according to the following equation

Rv = 0 Ohm at Xin = 1000
Rv = 1000 kOhm at Xin = 0

I am using the feedback resistor as 10kOhm. The input resistor is (Rv + 10kOhm). Hence, as per the close loop equation, I should be getting

At Xin = 1000
Vout /Vin = - Rf/Rin = - (10)/(10+0) = -1

with Vin = Vcc = 5V
Vout = -5V (or 5V with phase -180)

At Xin = 0
Vout/Vin = -Rf/Rin = -(10)/(10+1000) = 0
with Vin = Vcc = 5V
Vout = 0 V

I am using LM324 which is a standard Op-Amp and getting 0.6V for Xin = 1000 and 0.0V for Xin = 0.

Please can you let me know if I am doing something wrong.

Aliter
Using a simple voltage divider, between 10kOhm and Rv, I can see the voltage change from 0 - 5 V. The reason for using the OpAmp is to act as an inverter so that Vout ~ Xin rather than it be Vout ~1/Xin.

Best
Chandra
I think you need to understand more on how an op-amp works:
https://chrisgammell.com/how-does-an-op-amp-work-part-1/

#### kanha

Joined Jun 30, 2010
3
Hi Everyone

Thanks.

Actual Work:

I am trying to calibrate and fine tune a photoresistor (which has R inversely proportional to Light intensity).

I would prefer the voltage readings to be linearly proportional to illumination as it would make the calibration easier. Hence, require an op-amp to do the required amplification.

My current method:
Understood that in this case the voltage goes negative.

For, the OpAmp, I am using GND as 0V. Hence, the reading is absurd.

Can you help design a circuit with gain such that

Help to Design:
Vout/Vin = + Rf/Rin

Please note the negative sign. The positive non-inversion amplifier has typical gain (1+Rf/Rin) and this will not be of use while using Arduino.

Thanks
Chandra

Joined Mar 10, 2018
3,619
Why not just handle this in code. Do a least squares error curve fit, or a power
function fit, to generate a f() that simply takes the A/D value and "interprolates"
the A/D reading from it into values.

Regards, Dana.

#### KeithWalker

Joined Jul 10, 2017
459
Why not just handle this in code. Do a least squares error curve fit, or a power
function fit, to generate a f() that simply takes the A/D value and "interprolates"
the A/D reading from it into values.

Regards, Dana.
You can also scale and invert the reading from the A/D in the software:

Keith

#### TeeKay6

Joined Apr 20, 2019
457
You can also scale and invert the reading from the A/D in the software:

Keith
@kanha
Why not measure the sensor current rather than resistance? For many optical sensors the current is directly proportional to illumination, requiring little correction to be linear. I don't know what sensor you are using, so I cannot guarantee that that sensor responds in this way.

#### eetech00

Joined Jun 8, 2013
1,726
Hi Everyone
I am trying to measure a variable resistance(Rv) which changes with input (X) according to the following equation

Rv = 0 Ohm at Xin = 1000
Rv = 1000 kOhm at Xin = 0

I am using the feedback resistor as 10kOhm. The input resistor is (Rv + 10kOhm). Hence, as per the close loop equation, I should be getting

At Xin = 1000
Vout /Vin = - Rf/Rin = - (10)/(10+0) = -1

with Vin = Vcc = 5V
Vout = -5V (or 5V with phase -180)

At Xin = 0
Vout/Vin = -Rf/Rin = -(10)/(10+1000) = 0
with Vin = Vcc = 5V
Vout = 0 V

I am using LM324 which is a standard Op-Amp and getting 0.6V for Xin = 1000 and 0.0V for Xin = 0.

Please can you let me know if I am doing something wrong.

Aliter
Using a simple voltage divider, between 10kOhm and Rv, I can see the voltage change from 0 - 5 V. The reason for using the OpAmp is to act as an inverter so that Vout ~ Xin rather than it be Vout ~1/Xin.

Best
Chandra
What type of sensor is it?

#### ericgibbs

Joined Jan 29, 2010
8,878
hi,
I think he is working with a 'photo resistor', post #6
E