I am working on a project that I need to switch one of the IO Pins from a voltage range from 9V to 32V. It is for an automotive project that could be fitted to a 12V or 24V vehicle.
I have tried using a simple voltage divider circuit but at 9V there is only about 1V at 20mA on the input pin. If I change the resistor values to get a higher voltage at the 9V input, the current then increases at 32V beyond what I would think is acceptable.
Is there another way this could be achieved?
Any help would be much appreciated.