How to measure higher resistances (>1MΩ) accurately using a voltage divider with another high resistor as a reference, along with ADS1X15? When I use 1MΩ reference resistor it gives wrong results.
Post your current code and wiring diagram.
In general:
R1 is reference resistor:
R2 = R1 / (ADCmaxVal / ADCval - 1);
R2 is reference resistor:
R1 = R2 * (ADCmaxVal / ADCval - 1);
How accurately, 10%, 1%, 0.1%?
What accuracy do you have now?
Depending on your µC y the impedance of the ADC is in the ballpark of 1M or lower, so you'll most likely want a high impedance opamp in front of your ADC - or you use a constant current source instead of the constant voltage source.
You can use an op-amp as a unity gain buffer. The key consideration is the power supply—most op-amps won’t swing all the way to the positive rail, so you’ll need a slightly higher voltage.
For example, you could use one section of an LM358 and power it with at least 6V. The circuit would look like this:
- If you use a 5V supply, the output will be limited to around 4V due to the op-amp’s output swing limitations.
- To achieve almost a full 5V output, you can add a pull-up resistor to the output as a workaround.
Is it a "reference" or the fixed resistor in a voltage divider?
You MAY not need that and it may be more trouble than it's worth. Two equal-value resistors is a 50/50 voltage divider and you can read the voltage with the built-in ADC, as long as you don't need more resolution.
Assuming you have a DMM, check to see if the voltage is as-expected. If so, read the voltage with the Arduino (which is usually "foolproof") and that will help you figure-out if you've got a software calculation error.
You didn't show your code but as you may know, with a voltage divider, the relationship between the unknown resistance and measured voltage is not linear.
I assume DMMs use constant current and then the voltage is directly linear.
Old fashioned electro-mechanical meters measure current, so they apply a voltage and the measured current is linear (inversely proportional to resistance).
Couldn’t you slightly restrict the input voltage with a diode or extra resistance so it remains in the op-amp’s swing?
What is the highest resistance that might be tested? 1meg to ???
- Do some research into using a Wheatstone bridge.
Check this out by TI, especially section 2.3: https://www.ti.com/lit/pdf/sloa277 This part actually sources a very small current on the inputs because of the input structure. Use it in the correct configuration and you can get 1G ohm. It is an old part but it is readily available and not expensive. There are better parts if you want to look for them.
You havent given us much information to work with.
1: What degree of accuracy do you require? and why?
2: What circuit are you using?
3: How accurately do you know the values of your "reference" and "unknown" resisitors
4: In what way are the results "wrong"?
5: What code are you using.?
Please read and answer all those questions.