I'm trying to accurately measure a resistance using the analog input.
RefV variable contains a pre measured value, the measurement was performed by closing the circuit without R1 so basically it is the Voltage source or the VT(Voltage Total).
On my code below, the first thing it does is close the relay to add the resistor in the circuit then perform a measurement. The measure value will be stored at dRes. dRes now represent V2 in the circuit, then by doing RefV-dRes v1 is calculated. Since R2 is known in theory I can calculate for R1. With my code I was able to calculate for R1 if it is 100 OHM or more (tried and tested with 100, 470 and 1k Ohms), but I was hoping I could capture up to .2 Ohms if possible. I was trying it with my 2.4, 5.6 and 10 Ohms resistor and I can't seem to get an accurate measurement or it won't show measurement at all.
digitalWrite(13, HIGH);//Turn the relay on and add the resistor to be measured in the circuit
delay(500);//Stabilize the relay contacts
test=analogRead(A0);
dRes=map(test,0 ,1023, 0, 6600);//Map A/D digital data. 6V max voltage divider is two 1.5k OHM resistor with 1% tolerance
dRes=(dRes/1000);
digitalWrite(13, LOW);
delay(10);
float v1;
float v2;
float R2=3000;// Load resistors value-This is the voltage divider for the analog input composed of two 1.5K resistor
float I;
v1=RefV-dRes;//Get voltage drop on relay. RefV is the reference voltage.
v2=dRes;
I=(v2/R2);//Compute for Current-I=I1=I2=.....
//By knowing the I, R1 can be calculated
ContR=(v1/I);// ContR is the R1 in the circuit so R1=V1/I, R1 also represent the resistor to be measured
dContR=ContR; //Transfere value to another variable (for LCD Display)
I'm hoping to get away with simple circuit or without using amplification if possible.
but I was hoping I could capture up to .2 Ohms if possible.
The Arduino hardware is nowhere near good enough to read that sort of resolution, you have about .1% native accuracy but that doesn't include the non-linearities in the ADC. You're looking for 1 in 30000 accuracy.
can't seem to get an accurate measurement or it won't show measurement at all.
With a 5v reference the ADC has a resolution of ~5mV, I suspect the voltage across those small resistors is not enough to register.
Also if reading .1R in 3000R the other components have to be very accurate, resistors, power supply, voltage reference etc.
You need to amplify the signal, maybe using a current-sensing amp designed for current shunts would work OK, or a diff-amp.
Change your hardware setup, measure voltage across R1 :
GND ------ R1 -------R2 --------- +5V
Know, that arduino could read a voltage 100 mV more or less accurate, to measure 0.2 OHm you should supply 0.5 A into resistor. Check if resistor able to handle this current (and PSU). Than you choose R2 = 4.9V / 0.5A = 9.8 OHm.
To decrease a current, or measure even smaller R, you need OPA, which could bring 1000 000! times difference, make it possible to measure as low R as 0.000 0002 OHm, or use uA current,
Thank you so much for a quick respond. Your inputs are noted and highly appreciated. You have pointed me on the right direction and saved me a lot of time to research now that I know where to start.
Standard way is to wire the resistor as a 4-terminal device (I think the term is a Kelvin resistor) and measure the voltage of both ends using the sense wires and take the difference. No current must flow along the sense wires, you use the other two connections for that.
If the voltages are going to be small a rail-to-rail instrumentation op-amp is the best way to boost the differential signal level up to the 5V range.