# Arduino Resistance Measurement

#### Definition

The electrical resistance of an electrical conductor is a measure of the difficulty to pass an electric current through that conductor. It is measured in Ohms.

## Measurement of resistance (50 Ohm to 500K)

Measurement of resistance is again from V=I x R,  R = I / V or using voltage divider circuit.

 I = Vout / 1K VRx = 5 – Vout Rx = Vrx / I Rx = (5 – Vout) / I Where: Rx = Resistance to be measured VRx = Voltage Across Rx I = Current flowing through voltage divider Vout = Voltage measured by ADC

## Resistance Measurement Arduino Code

```/*
Resistance Measurement - www.circuits4you.com
Reads an analog input on pin 0, converts it to resistance, and prints the result to the serial monitor.
*/

// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:

// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1024.0);

float I = voltage / 1000;
float VRx = 5 - voltage;
float Rx = VRx / I;
Rx = (5 - voltage) / I;

// print out the value you read:
Serial.print("Resistance:");
Serial.print(Rx);
Serial.println(" Ohms");
delay(1000);
}
```

## Result of Resistance Measurement

Open the serial terminal and see the resistance value, in this experiment I found that if you remove zero from 5.0 and make it 5 or 1024.0 to 1024 the code will not work.