I need to develop a MCU-based board that must read 10 "lines".
Each "line" is associated to 2 open/closed switches connected to the central board through only 2 wires.
For each "line" the MCU should detect the following states:
- short circuit
- switch A open (switch B doesn't care)
- switch A closed, switch B open
- switch A closed, switch B closed
One simple solution is to measure the resistor of the "line" and change the resistor when switches toggle.
Rb |--/\/\/\/---SWB--| | | MCU ------------SWA------+-----/\/\/\/-----+ Ra | GND ---------------------------------------|
- short circuit: R=0
- SWA open: R=infinite
- SWA closed, SWB open: R=Ra
- SWA closed, SWB closed: R=Ra // Rb
The switches are "remote", they could be connected through 10-50m cabling. It's a home environment, not industrial. Some noise could be present casued by some household appliance.
A simple solution is to use a pull-up on the MCU board and measure the voltage of the "line" through an ADC. However in this case I have the MCU 3.3V supply on the cables and it could be too low and susceptible to some electrical noisce.
There is 12V power rail too on the central board, so I can use a pull-up to 12V. However in this case I have to decrease the voltage in order to measure it through the ADC integrated in the MCU. An op-amp is sufficient, but I have 10 lines, so I need 10 op-amp!
I'd like to keep the circuit simple but robust enough. Any suggestion?