# Multiples voltage on a optoisolated MCU input problem

## The problem

Handle digital inputs on a MCU, the input could be 5V, 12V, 24V or an open collector.

## My solution

My approach is based on jumpers, given the fact that the inputs dont change behavior in time (if the input is 0v or 5v it will be that always and never will change to 12v or 24v or open collector), so I set the jumpers one time in my circuit to work with the desired voltage. This is the most smart way i can think to solve this.

## How it works

If the input is 0V and 12V, I set JP2 to 1-2, JP3 to 2-3, JP5 to 1-2 and JP7 to 1-2. If the signal is open collector; I set JP2 to 2-3, JP3 to 1-2, JP4, JP5 and JP6 dont care and JP7 to 2-3.

This seems to me the best way to go, but I don't like the amount of jumpers in my circuit, what do you think? what will be your approach?

• What's the maximum frequency of your input signals? Jan 2, 2013 at 22:23
• very slow signal, below 10Hz Jan 2, 2013 at 22:24
• What current can the sensors source / sink? Jan 2, 2013 at 22:26
• you mean the MCU inputs or the external signals? Jan 2, 2013 at 22:27
• I would change the 3 resistors to 1. Then in series a zener and parallel to the zener the LED (with a current limiting resistor). Or use a JFET (eg. BF256C) to act like a (series) current source and forget about resistors (and zener) all together. Jan 2, 2013 at 22:28