# Voltage-controlled switch using op-amp

The problem I'm trying to solve: I have a vehicle that has 3 wires for the tail/brake light. When the vehicle is on there is 12 V+ between the red and black wires and there is 7 V+ between the red and orange wires. When you hit the brakes the 7 V+ between the red and orange wires steps up to 10 V+.

So I need to create a circuit that will turn on a set of LED lights when the voltage goes above 9 V. Currently, my circuit consists of a voltage divider (changing 12 V down to 9 V), an LM324N op-amp, and an FQI50N06 MOSFET (schematic shows IRF540).

For some reason, on the op-amp, when there is no input, the output is on, when the non-inverting input is higher than the inverting input the output is on, and when the inverting input is higher than the non-inverting input the output is off.

So in my mind, this circuit is working, except when there is no input, then the output should be off.

EDIT: Something that just popped into my head as soon as I posted this: I wonder if putting a diode on the output would prevent the output from being on when there is no input.

EDIT2:

EDIT3:

• What do you mean by "no input"? There is nothing at all connected (open circuit)? The inputs are at 0V? Something else?
– Null
Commented Sep 29, 2015 at 15:33
• Correct, 0V. If I completely disconnect the non-inverting input. If the non-inverting input is 3v+, there's no output. Commented Sep 29, 2015 at 15:36
• You shouldn't have an open circuit at the input(s), which I'm assuming is what you mean by "completely disconnect". Op amps have an input bias current (even if it's very small) and that current needs a path to flow.
– Null
Commented Sep 29, 2015 at 15:39
• If you disconnect either input, it effectively goes to almost the supply rail. A 100K resistor from the input to ground will stop that. Commented Sep 29, 2015 at 15:45
• You LED lights wont get anywhere 12 V due to opamp output swing and gatesource volts needed to drive the FET .consider a P channel design ,it will be cheap because your currents are not high . Commented Sep 29, 2015 at 20:06