# Interfacing switched resistors to an ADC input of a microcontroller

I am tying to interface switched resistors to a micro controller (TI CC3220 - http://www.ti.com/lit/ds/symlink/cc3220.pdf) which uses 3.3VDC for its operation and has an ADC input range of 1.4VDC.

My requirements are

1. ADC input should not exceed 1.4 VDC
2. The switch has total 6 steps i.e 0 to 5, where in each step different resistor values are used to connect to Vcc and for 0 there wont be any connection to Vcc.
3. When the switch resistor module (3 wires to the module) is removed, ADC should always read high.

With my limited knowledge and experience, I have created a schematic as shown below. Would be great if someone can validate it or suggest other solutions to solve my use case.

Note : I do have constraints on additional components and cost, hence a cheaper and optimal solution is preferred. The ADC input impedance as per datasheet is 2.12K

Proposed Schematic (updated on 15-June-2018)

simulate this circuit – Schematic created using CircuitLab

• I would calculate the ADC input voltage (voltage divider equation and parallel resistors) for each option and make sure they're all under 1.4 volts. I don't think they all will be. – user253751 Jun 8 '18 at 5:47
• I would find out what the ADC input impedance is, and add that information into the question. Posing R3 to R7 values without knowing what load they're driving is a waste of time. Of course, the ADC input impedance may be 'very high', but there are types that are surprisingly low, it would be handy to know what this one is. – Neil_UK Jun 8 '18 at 5:49
• @Neil_UK there's a 9.8k impedance pulling the ADC input to ground, I doubt the ADC input impedance (mega-ohms?) makes much difference on top of that. – user253751 Jun 8 '18 at 5:53
• I'm glad you have it all under control then. – Neil_UK Jun 8 '18 at 6:02
• Why do you think removing the module would give you a high value? With 2.12k ADC input impedance, you can ignore R2, R1 will put about 0.3% of 3v into the ADC, I make that 10mV. – Neil_UK Jun 8 '18 at 7:11

Using pull down resistors, you can get the following ...

simulate this circuit – Schematic created using CircuitLab

As the resistance of the ADC is confirmed as 2.12k, with the module removed, you get more or less full scale out of the ADC. With the module in circuit, you can switch between 0, 20%, 40%, 60%, 80% and 100%.

With your schematic that uses 2 more resistors, you get 45% of FSD with the module absent, then switch between 45%, 48%, 50%, 55%, 64% and 96% of FSD. Is that some particular non-linear law you want to achieve?

• I did consider your design where ADC is pulled up and adding variable pull downs. But the problem is that these regulators have no connection for the 0 (zero) position. Hence it may not work. – Zacson Jun 12 '18 at 16:49
• Also with the module removed, I will not have R8 (1K). I have also updated my question with the calculations. Could you please validate ? – Zacson Jun 13 '18 at 3:14

My initial design (Proposed Schematic) which is mentioned in the question had a major drawback of spoiling the ADC pin when there is a loose contact i.e if the negative wire to the switched resistor module is disconnected, the ADC will get voltage more that the prescribed limit and spoil the pin.

Hence I may have to compromise my requirement of reading high value at ADC when module is removed as well as step 5, and handle various reading through my software itself.

Also if I was able to get a rotary switch shown by Neil_UK, it can be easily handled as per his recommended approach.