I do controls, and sometimes I want to monitor more dry contacts than I have digital inputs for. I'm cheap, and don't want to pay for more points, so sometimes I'll put some resistors in parallel with the contacts, and put the (resistor||contact) pairs in series, and read them using an RTD input. With three contacts, it's easy to pick three resistor values that give me 8 unique combinations within a comfortable range and with comfortable distance in between. Say 10k, 7.5k, and 15k. Moving on up to six contacts, I've now got 64 states, and picking 6 resistances from the E12 series that can satisfy 64 states may not even be possible.

Is there a succinct way to solve this problem of picking x resistances from a standard series, sticking within one decade? Something I can stick into Excel? Maybe it's very obvious once I restate the problem mathematically in terms of sets or combinatorics, but I worked hard in those classes once so I'd never have to do it again.

Electrically there are obviously many ways to convert a six bit digital value to an analog value, including using resistors and more decades, but anything more complex than single resistors pretty much moves me into "buying a pre-built" solution territory.

  • \$\begingroup\$ Something like an R 2R ladder making a kind of DAC might work. But that's just off the top of my head, I haven't had time to work out the details. \$\endgroup\$
    – John D
    Aug 1 '18 at 3:56
  • \$\begingroup\$ DAC's usually use dual voltages or currents or SPDT switches. , Can you choose 0.5% R values in binary R sequence to make a DAC with 6 SPST switches? with 1,2,4,8,16,32 [kOhm] to 0V and 64k to 5.00V using an 8 bit ADC? \$\endgroup\$ Aug 1 '18 at 4:13
  • \$\begingroup\$ Try looking up "R-2R ladder". \$\endgroup\$ Aug 1 '18 at 13:46

With a 8 bit ADC , you can easily gang 6 switches in a binary R ratios.

ADC's normally use SPDT or dual voltages or currents. But you have SPST contacts.

Rather than E10 values which have only 10% tolerance, you can choose the nearest 0.5% values of; 1k,2k,4k,8k,16k,32k

Proof of concept


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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