I'm looking for a simple way to have an input to a device that is 24V compatible (truck voltage level). The idea is to have the "ignition contact" signal being inputed to a microcontroller unit. "Ignition contact" is 24V but microcontroller unit inputs are 5V.
I though of using a power MOSFET that has a Vgs of > 24V.
The safest way is to use an optoisolator - see attached picture, but in most cases a simple clamping circuit consisting of a (1-10kΩ) series resistor and 4.7-5.1V Zener diode (across the input and GND) should work well ..
For more details goto: https://www.cq.cx/interface.pl