Electronic – Control two LEDs with two wires and inverter


I have a door sensor (magnetic Hall Effect) that I want to use to build a simple indicator: red LED if closed, green LED if open.

Here's the tricky part: I want to run only two wires to those LEDs, and I'd like to do it completely in analog circuitry. Here's the approximate outline:

CircuitLab Schematic 95msbh

I've tried putting something simple together with BJTs (an inverter, a bistable multivibrator etc.), and I feel like this is the right track — that there's just one small tweak I need to make — but I'm stumped as to how to get the voltage to flow. I've done extensive Googling and reading up on tutorials and I've found nothing close to what I'm looking for.

How do I get voltage to flow one direction if the switch is closed and in the other direction if it's open?

Best Answer

When using a red and green LED, you can utilize the difference in LED forward voltage as in the circuit below. Make sure to use high efficiency LED's. These have a low internal resistance and a nice and sharp bend in the forward voltage/current curve.


simulate this circuit – Schematic created using CircuitLab

Normally the green LED lights, which has a forward voltage of approximately 2V. Then when the switch closes, the red LED light and due to its lower forward voltage, approx. 1.8V, the green LED will turn off from (voltage) starvation.

If the green LED does not entirely turn off, you can add a regular 1N4148 diode in series with it to make the effect stronger, but this is usually only necessary with cheap and relatively low efficiency LED's.