## Current Source to Measure DC Resistance of a Wire

Have you heard of a current source before? In electronics, when you hear the word source, it means that part is “giving” or “providing” something, in this case, a current. The opposite of sourcing is sinking, this means that part is “taking” or “demanding” something.

For example, in a simple LED circuit connected to a 5V supply, the power supply is sourcing power (voltage and current), while the LED is sinking current.

What you normally have in every circuit is a voltage source, or more accurately described, a power source. This is normally your voltage regulator which specifies on its datasheet that it is capable of giving you a stable voltage supply (let’s say 5V) for up to a maximum value of current (let’s say 800mA) at 25C.

However, for some applications, what you require is a constant current source rather than a constant voltage source. Following our previous example, the current source will provide you with a constant output current for a range of given voltages, or more useful, a range of load resistances.

A few real-world examples where current sources are used:

• Driving LEDs: LEDs change their brightness level according to the current flowing through them. In a simple project, you normally set this brightness by selecting a resistor value and that’s it. However, in real-world applications, the temperature changes of the device will make the forward voltage drop of the diode and the resistance value not constant. Having a current source set to the desired level will fix this issue.
• Battery charging: some battery technologies such as Lithium, require constant current charging up to a defined voltage level. A current source lets you control the value of this current.
• Measuring resistance: in order to measure resistance, according to ohms law (R=V/I), you need to know the value of the current flowing and the potential difference (voltage) across the resistor in order to determine its value. By setting a current source to a determined value, makes this variable constant and easy to calculate.

# Current source circuit to measure resistance

In this article, a simple circuit to measure the resistance of a low ohmic conductor will be proposed. This circuit can be used in situations where you are checking if a long wire attached to a mechanical switch has been disconnected.

## Circuit Diagram

The following circuit is a current mirror. This type of circuit lets you control the current of the output transistor by setting up the current on the internal transistor.

The current source specification for this circuit will be 10mA for up to 100ohms load.

### Setting the current

To calculate the current output we use the following equation:

To calculate the Q related values you can look into the datasheet, or directly probe in LTSpice, I prefer the latter.

Iout = ((330ohm*(5V-(10000ohm*296uA)-0.68V)/120ohm)-0.65V)/280ohm

Iout = 11.03mA

### Calculating the resistance of the wire

Now that we have the current output of our circuit and we know the voltage drop of the wire by measuring the voltage at the input of the wire with respect to GND, the resistance can be calculated as follows:

Rloop = Vout/Iout

So for a sensed voltage of 1V, then we will have a resistance of Rloop = 1V/11.03mA = 90.6ohms

### Other components

A first-order simple RC low pass filter is placed before the MCU to filter any high frequencies that could have coupled on the cable and a 4.7V Zener diode is used to protect the MCU by shunting any possible voltage spikes.

### Simulating the circuit and performing a Monte Carlo Analysis

The circuit was simulated with a 100ohm wire

As you can see, the actual current calculated by the simulation software LTSpice was 10.5mA, slightly different from the analytically calculated one. For the moment, let’s take 10.5mA as the correct value.

As explained in the Worst Case Analysis article, components have a tolerance that varies depending on manufacturing or external factors such as temperature.

Performing a Monte Carlo analysis using LTSpice can shed some light on the possible min and max value that the Iout value can become.

Using a resistor tolerance of 3% and a Vcc tolerance of 5%, we get the following results:

As you can see from the above graph, the Iout values can vary from 9.8mA to 11.2mA approximately. If in our Firmware we set up the Iout value as a constant of 10.5mA, then in reality, for a sensed output voltage of 1V, we can have a resistance ranging from:

1V/0.0098 = 102ohm < Rloop < 1V/0.0118 = 85ohm

With a nominal Rloop of

Rloop = 1V/0.0105 = 95ohm

Is an accuracy of +/-10ohm enough for your application?

## Improving the circuit accuracy

One quick and cheap way to improve the accuracy of the circuit is by sensing the output current through a current sense resistor:

This new sensing point senses both the output current by multiplying the sensed voltage by the value of the resistor (Vin*100R) and the new voltage value after the wire. Now we can calculate our wire resistance with the following equation:

Rloop = Vout-Vin/I_Rsense

Therefore for a sensed voltage Vout of 2V and Vin of 1V then we will have a resistance of Rloop = 2V-1V/(1V/100ohm) = 100ohms

Assuming the same voltage drop at the wire of 1V and a Rsense tolerance of 3%, our new accuracy is:

1V/(1V/(100*0.97)) = 97 ohms < Rloop < 1V/(1V(100*1.03)) = 103ohm

The new accuracy is +/-3 ohm.

# Conclusion

In this article, you have learnt how to implement a simple current source circuit that can be used to measure the resistance of a line. As you can see from the accuracy results, it is not a high accuracy circuit, even with the addition of the current sense resistor. However, for applications where you are looking for a more “rudimentary” response, this circuit will be cheap and easy to implement.

If you would like to download the simulation file and play around with the components values which I highly recommend, you can do so in here.

#### Roberto Weiser

Roberto has experience in electronic embedded systems design and programming from concept to production, including: power electronics, audio electronics, automotive, battery management systems and renewable energies control systems. Roberto is interested in technology and sustainability of which he has practical experience acquired in his University degree, Master's, external courses, placement and also from volunteering in Peru. Furthermore Roberto has skills for business, leadership and teamwork from his time as Chairman of the Latinos and Spanish Society and Resident DJ in Plymouth