Measuring resistance - problems with analogRead values

I have been attempting to measure the resistances of 2 wires and then comparing them using the Arduino Uno. To do this, I have made use of 2 LM317s with 47 ohm resistors to adjust the output current and the measuring the voltage in parallel with the wire afterwards. The schematic is attached. In order to gain more resolution at the small voltages the wires read, I am using the internal 1.1V AREF. The problem I am experiencing now is that I cannot seem to get the Uno to measure anywhere near the values the wires are actually showing.

For example, I used a multimeter (Fluke 87) to measure the voltage that is applied across a wire. The measured value was .084v, which when divided by the set current gives me a resistance value that is within a tenth or so ohms of the actual value. Yet, when the arduino measures the voltage from the wire it returns something closer to .35V. Obviously this is a pretty big difference. Anyone have any clue why this seems to be happening? I have included some code I have been using to test the resistance values quickly. It's possible there's something off there? I have added delays after each reading and throw out the first, but that doesn't seem to help at all.


#include <Average.h>

void setup() {

  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);


void loop() {
  digitalWrite(7, HIGH);
  Average<float> ave2(10);
  for(int i=0; i<11; i++){
  float current2 = .0268683;
  float voltage2 = ave2.mean() * (1.083/1023);
  float res2 = voltage2/current2;
  digitalWrite(7, LOW);
  digitalWrite(8, HIGH);
  Average<float> ave1(10);
    for(int i=0; i<11; i++){
  float current1 = .0268683; 
  float voltage1 = ave1.mean() * (1.083/1023);

  float res1 = voltage1/current1;
  Serial.print("Resistance 1: "), Serial.println(res1, 7);
  Serial.print("Resistance 2: "), Serial.println(res2, 7);
  Serial.print("Voltage 1: "), Serial.println(voltage1, 7);
  Serial.print("Voltage 2: "), Serial.println(voltage2, 7);
  digitalWrite(7, HIGH);


A digital output can do 20mA (40mA shortcut current).
The 47 ohm at the LM317 makes 27mA. At 27mA the output is no longer 5V, but lower. That should be no problem, as long as the LM317 can keep the current constant.
27mA into 5 ohm makes 0.135 V.

With such low voltages, every ground wires must be perfect, and you might need a 4 terminal resistor measurement : Four-terminal sensing - Wikipedia

To check the Arduino, you have to measure the voltage at the analog input, with the black wire of the multimeter to the GND of the Arduino board.

When something is not right, return to the most simple and basic code. Use analogRead() and convert it to a voltage. Compare that voltage with a multimeter.
If everything is okay, you can add the library and calculate the resistance.

Which library is that ?

The library is from here: Arduino Playground - Average

It'a purpose here is to give me the mean of the values read. I have attempted to measure the resistances using both that method and the normal analogRead(). By measuring the voltage over the entire circuit and by attempting to measure a second 47 ohm resistor, I was able to read the voltage around +/- 0.1v. One reading I was able to get the exact 1.245V that is over it but wasn't able to replicate this every time. That isn't too surprising though given that the resolution is 4.9mV at 5V for the ADC. I attempted to do something like this then by using the internal AREF and calibrating it (I got 1.083V) but the measurements just fluctuate wildly when I try and measure anything with such low voltage.

Since I'll only every need to measure things that are 20 ohms or lower, give or take, would using an op amp to amplify the voltage have any effect? I could use a different resistor and drop the current lower and then amplify so that the circuit will output 0-5V but would be measuring the low ohm wire.

Another consideration would be to purchase an ADC with more bits, but I'm not totally sure that would solve the problem either.

Edit: I would also guess that the breadboard I'm using has some role, as well as the ground wires like you said. May be worth purchasing some higher quality components.

HX711 may be your solution: A HX711-based MilliOhm Meter – dannyelectronics

Such low resistor values, and using a breadboard ? Those things don't go together.

A 16-bit ADC will improve it a lot ADS1115 16-Bit ADC - 4 Channel with Programmable Gain Amplifier [STEMMA QT / Qwiic] : ID 1085 : $14.95 : Adafruit Industries, Unique & fun DIY electronics and kits.
You do need that four terminal resistance sensing, because 16-bits that make no sense are not very useful.

For the average, you don't need the rolling average, and not the mean, deviation and so on. You can take a number of samples (3 to 1000 or more) and use the average of those samples.

I really like the HX711 solution.

Yes, a breadboard's contact resistance could be an ohm or more, its not really suitable, although
there is a reasonable chance it is in a good state if newish (not oxidized).

For measuring low resistances a 4-terminal measurement is normal, and you might want to
amplify the output with an opamp in differential amplifer configuration for more sensitivity and so
only on ADC input is needed. Beware error due to opamp input offset voltage - go for a "precision"
rail-to-rail opamp.