Ignore voltage below threshold

automotivemicrocontroller

I am trying to detect the presence of +12v on V2 to trigger a digital pin on a micro controller.

I am using an opto isolator as I am under the impression that it is the best way to isolate my circuit from the potentially noisy automotive circuit.

When V2 is activated by the vehicle, it outputs betweeen 9 and 12v, activating the opto and pulls the digital pin low.

However, when V2 is inactive, it is outputting around 2v, which causes the digital pin to read high, with an occasional low. Ideally, I would like to avoid disturbing the vehicle's circuit as much as possible.

How can I ignore V2 unless it is greater than, say, 5v? Is a Zener diode between V2 and R1 the proper way to solve this?

schematic

simulate this circuit – Schematic created using CircuitLab

Best Answer

Zener is an OK way.

Or consider a resistor P1 to ground to reduce range of V at pin.
eg adding a 680R P1 to ground will reduce sensitivity.
Lower R = more reduction.
Too low = no operation.