I have a device that can have different things plugged into it. I'm trying to use a resistor on these things to uniquely identify the thing. That is, if I plug in Thing A, I can read the resistance as 100Ohms and know that it's a Thing A. If I plug in Thing B, I can read the resistance as 200Ohms and know that it's a Thing B. I know resistance varies with temperature, and tolerance, so I want to have some wiggle room on each unique code.

I'm using a voltage divider and an ADC to measure the resistance. Assuming I have a constant 3V input, a 12 bit ADC reference of 2.5V, I will use resistors with a 1% tolerance, and I want as many unique codes as possible, with a small gap in between each, how do I calculate how many unique codes I can get?

I was first thinking that I could use a 2k resistor, and then the second resistor could be anything from 0 to 10k. With 4095 steps in 12 bits that means .6mV per step. At 1% tolerance, that means the top bin could be anything from 9900 to 10100, so 200 ohms wide. That's only 80 bins, though. However, a 100 ohm resistor would only vary from 99-101, or 2 ohms wide, so a linear formula is clearly not appropriate.

How can I figure out the correct number of unique bins that I can reliably detect?

  • \$\begingroup\$ A DMM can measure resistance < 0.1% over 5 decades with stepped current sources. how many bins do you need? To calculate best-case accuracy, divide the maximum INL error by 2N, where N is the number of bits \$\endgroup\$ Dec 29, 2016 at 23:42
  • 2
    \$\begingroup\$ If you plug in anything, you have to grant wide safety margins to reliably detect anything. Contact resistance varies a lot, could be Ohms, and that depends on insertion force and humidity, too. \$\endgroup\$
    – Janka
    Dec 30, 2016 at 0:02
  • \$\begingroup\$ You may want to use unique ID chips as the DS2401 instead. They even come in a canned fashion (DS1990) which you could glue or weld to the things you want to identify. \$\endgroup\$
    – Janka
    Dec 30, 2016 at 0:04
  • 1
    \$\begingroup\$ Consider using a constant current source to drive the unknown resistor instead of including the unknown R in a divider. I think you might be able to get more resolution of resistance this way. You might also want to include a built in reference resistor to calibrate the current source or resistance divider before taking each reading on the unknown R. \$\endgroup\$
    – FiddyOhm
    Dec 30, 2016 at 0:19
  • \$\begingroup\$ I'm hoping for something like 200-400 bins. Janka had a good point about contact resistance, which may be an issue. I'm hoping that by being in the higher decade of resistance the few ohms from contact resistance will be insignificant. \$\endgroup\$ Dec 30, 2016 at 1:18

1 Answer 1


If you use E192 0.5% resistors then there are 192 values per decade. If you set each decade as A/D full scale (ie 2.5 V) then the values are 4096/192 apart --> 21 * 0.6 mV --> 12.6 mV apart. So easily discernable by your A/D.

  1. Test which decade a resistor is in by setting a current (or simply a series resistor) so the top value of the decade is 50% scale (1.25 V). The voltage should be between 10 and 2047. If the A/D output value is less than < 10 or > 2047 choose a higher or lower decade to test.
  2. Once you know the decade, set the measurement current to get full-scale with the largest resister in the decade. Measure the A/D value to identify the bin.

You should be able to measure at least 3-4 decades with little complexity and using a single purchased resistor giving a practical number of bins around 768.

You could do the same with E96 1% resistor values and get 384 bins in 4 decades.


Your Answer

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

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