How can a GPIO logic to high amp/voltage logic adapter be built using multiple voltages? (5v, 12v, 24v)
For wide range inputs, I managed to build one recently that worked from 5v to 30v or so with an optoisolator, zener diode, and a pair of resistors.  Basically, design the circuit such that the LED current at the input is in range for the entire voltage range that you are interested in.  It is also possible to stick a bridge rectifier in there to make the circuit insensitive to polarity, at the cost of around 1.2 volts or so of extra drop.  The resistor and diode are selected to produce the minimum turn-on current for the optoisolator at around 5V, ramping up to the maximum LED current when the zener starts to conduct.  







simulate this circuit &ndash; Schematic created using CircuitLab