How would I measure resistance over a certain length? In this case the resistance is variable.

What I have in my head is that you would output a certain amount of current from one pin, and measure how much comes back from the other.

I'm not sure if this would work, or how to implement it in code.

I've seen this forum post, but it's not making much sense to me.

How can I measure resistance?

  • 4
    Read up on voltage dividers. It's 2 resistors in series. Usually the resistor values are known and chosen depending on what output voltage you want given a set input voltage. But, if you have a known/unknown resistor and can measure the output voltage you can determine the value of the unknown resistor.
    – sachleen
    Apr 7, 2014 at 0:48
  • 1
    @sachleen That is a valid answer.
    – asheeshr
    Apr 7, 2014 at 1:58
  • 2 points: first, input current = output current (Kirchhoff's current law). Second: you mentioned a "certain length", do you really mean length or duration? If it is length, then an important question is about how long? Are we talking about centimeters, meters, kilometers?
    – jfpoilpret
    Apr 7, 2014 at 4:34
  • Do you know what Resistance Value (in Ohms) your resistance is and how accurately you need to know the value? This would help answer the question. For example, measuring 0.01 Ohms would require a different approach than measuring 1000 Ohms; and measuring to 50% accuracy would be very different to 0.1% accuracy.
    – akellyirl
    Apr 8, 2014 at 14:29

1 Answer 1


you cant control current output to a pin BUT you know a pin output 5V (if using a 5V a arduino, 3.3v in other case).

Then what you need is a know resistence resitor, so you can set up a voltage divider and then read the resulting voltage with an analogRead. That give you a 10bit precision value that you can easily translate to a voltage, and then use the formula on the linked page to find R1 or R2 (depends on how you wired up your know resistor)

  • So I saw the Wikipedia article you linked to on voltage dividers -- I'm still confused. Is a voltage divider something I need to buy (like a part), or can I make one myself? I saw a schematic on the wikipedia article using a resistor and a capacitor, but it didn't specify values for the parts...
    – evamvid
    Apr 7, 2014 at 20:40
  • I saw @sachleen's comment too, but I'm still confused!
    – evamvid
    Apr 7, 2014 at 20:54
  • no, you can build it yousel using only ONE resistor, see figure 2: Vin is 5V, Vout is what you read from analog pin, R1 and R2 are your know resistor and the resistence you want to know. lets say you want measure R1, then you know Vin, Vout, R2, and you use the formula at "To solve for R1:" For the R2 value there is no a "right" value: it have to be choosen based on what you need. You know that ADC has only 10bit, so 1024 step, this mean it can measure 5V/1024step = 0.004V/step. Starting from this, and expected min/max R1 value, you can use the forula for R2 to fing a goo value!
    – Lesto
    Apr 7, 2014 at 20:55
  • Also, I thought resistors reduce current, not voltage! Are we measuring current or voltage?
    – evamvid
    Apr 7, 2014 at 20:58
  • Read the wikipedia article, resistor work for current and voltage, it depends if they are on series or parallel. those are basic notion of electronics, you should look for a basic book in your nearest library
    – Lesto
    Apr 7, 2014 at 22:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.