MCU interface to detect a wide input voltage
If you need a threshold, simply implement a threshold!

Comparators are made for that. So:







simulate this circuit &ndash; Schematic created using CircuitLab

Thresholding is what analog comparators do. I used the R5->D1 combination to give you a stable reference voltage that the variable R6 can divide down to give you the 0.318 V threshold you need to detect 5V on the input.

You can replace R5->D1 with a voltage source that your module probable brings (3.3V or something like that).