Electrical – Input selection for dry contact vs pnp

input

On my board I have to acquire dozens of input digital signals. Each one might be a dry contact or pnp (12V). I have to isolate them from the MCU side.

The basic circuits could be:

dry contact: pull-up resistor to 12V and input across the optocoupler diode

pnp input: series resistor and input between the other end of the resistor and GND

What could be a simple circuit to handle both configurations? It's ok a front-end compatible with both or a single dip-switch to select.

Best Answer

If the dry contact is floating, just wire it as if it were a PNP - now you are analyzing a single type of input - a contact (or BJT) that pulls-up to 12 volts.

I would use an opto with its LED in series with a current limiting resistor and connect this between PNP (or dry contact connected to 12 volts) and ground: - enter image description here

If you can't take the dry contact to 12 volts then you can still use the opto method but the anode of the opto would connect to 12 volts and the resistor (R1) would connect to the dry contact (or NPN equivalent).

R1 is chosen so that about 20 mA flows when the dry contact or PNP closes.