# How many bins can I code using a resistor on an ADC

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?

• 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 Dec 29, 2016 at 23:42
• 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. Dec 30, 2016 at 0:02
• 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. Dec 30, 2016 at 0:04
• 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. Dec 30, 2016 at 0:19
• 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. Dec 30, 2016 at 1:18