# Using op-amps to read real-time resistance values over a wide range

Background

I have been using a simple inverting op-amp circuit and Arduino to measure the resistance of a photoresistor (light 5k, dark 200M), like in the schematic below. This provides linear data which is good for the calibration of light intensity.

simulate this circuit – Schematic created using CircuitLab

I used -5V as the input voltage. The output voltage was reading from an Ardunio Uno (resolution 10 bits). The resistance of the photoresistor can be calculated as below.

R = - RF * Vin / Vout


The measurable resistance range is decided by the resistance RF of the reference resistor. Taking the RF = 1k in the schematic and Vin = -5V as an example, the measurable resistance of the photoresistor is from 1k (Vout = 5V) to 1.023M (Vout = 1/1023 * 5V), despite of the decreased accuracy in the large resistance range.

Question

Now I need to measure the real-time resistance change of the photoresistor over a larger resistance range (1k to 100M).

Is there a way to improve this circuit, to be able to measure the dynamic resistance values of the photoresistor over at least five magnitudes (1k to 100M)?

I read this post "Reading dynamic resistance values over a wide range" but I still want to keep with the inverting op-amp for its linear output, which makes it easier to calibrate the light intensity for my test.

In the meantime, I also try to divide it to several ranges. I am using extra analog input ports on Arduino to read from extra inverting op-amps with shared photoresistor but different RF, i.e., op-amps in parallel. As shown in the schematic below, I planned to use a current mirror to provide the same input for these op-amps, and use different reference resistors in these op-amps. By carefully selecting these reference resistors, it should be possible to have at least one output with good resolution. However, this design may produce very high voltage to damage the Arduino...

simulate this circuit

Follow up on July 29, 2019

Thanks to @GRTech 's suggestion of using a log amplifier, I simply put the photoresistor in a log amplifier as shown in the schematic below.

simulate this circuit

According to the calculation:

Vout = n * VT * ln(Vin / (R * Is))


The measurable resistance range would be largely increased as shown in the picture below. I think I just need to figure out a way to make the output voltage to span from 0 to 5V to maximize the resolution on Arduino analog input.

• Usually souch wide range measurements using logarithmic resolution and consiquently based in log and/or square root amplifiers. This is common especially on photodiode applications Commented Jul 27, 2019 at 2:16
• Hi @GRTech Thanks for your suggestion. I've updated the question with a log-amp circuit trial in the end. Is that what you meant? I am a mechanical engineer and very new to circuit design... Commented Jul 29, 2019 at 16:11
• Exactlly. Then you can drive an Analoge-to-Digital converter (Arduino?) to have a full resolution in entire band. Commented Jul 29, 2019 at 23:35

The circuit in your follow-up does provide a logarithmic response. But look what happens when the diode temperature changes (lines are separated by 10 C):

You could just amplify and shift this response to fit your ADC, but temperature compensation would be needed (and not trivial).

Neil_UK's answer provided in the link you mentioned could be used as an input for a variable current source and controlled by the uC as an auto-range resistance measurement device.

RS is your sensor. Each RR V2 pair represents a digital output with a range resistor. I'm assuming you can provide $$\\pm5V\$$ to the op. amps. and your uC provides $$\0V\$$ and $$\3.3V\$$ at the output. Please adapt to your case as the op. amp. here is not rail-to-rail.

• Hi @vangelo, thanks a lot. So if I understood right, in your last two figures, you are suggesting me to use multiple digital outputs on my Arduino to make a multi-range resistance measurement device for my sensor. But I am not sure whether you are suggesting me to use only one RR V2 pair for each measurement depending on the known resistance range of my sensor, or to use all RR V2 pairs at the same time. I cannot do the former, since the resistance is changing from 5k to 200M in 30 seconds and I need to record all resistance values within the 30s. ... Commented Jul 29, 2019 at 18:17
• If you meant the latter, I need to put my sensor in multiple op. amps. as R2 at the same time, I am not sure how can I do that. Commented Jul 29, 2019 at 18:19
• In the meantime, I am learning to design a temperature compensated log amplifier as you suggested. Thank you very much for your help! Commented Jul 29, 2019 at 18:21
• 30 seconds is quite a long time, it should be fine. What sample rate do you need? You use only the 2 op. amps. in the diagram. Your firmware will start with high in the digital output with the smaller resistor (adapt the values to your case) and switch to low as you approach the voltage limit, switching the next output to *high. I put only one digital output in the diagram for simplicity. Add others as needed and calibrate each range with known RS values. Commented Jul 29, 2019 at 18:21
• I see what you meant. That's the best way to do multi-range measurement. I didn't think about using the firmware to control the active digital output during the 30s measurement. In the firmware, I can even write an if statement to define when to switch the digital output. Commented Jul 29, 2019 at 18:31