Designing a circuit that triggers an opto with either 12VDC or GND input

With a 3 resistor and one IC (2 IC parts) analog circuit like a window comparator I find it is waste of time prepping and running for useful simulation. Plus no matter what a circuit simulation shows, you still have to actually build and test a real circuit.

I find that for me these types of circuits are usually breadboarded, fully debugged, and actual performance measured in under 1 hour.

1 Like

Hi @EvanZ ,

As Paul suggests, it may be educational to build the circuit on breadboard and observe the functionality by measurements. It may sound inconvenient, but can learn a lot.

Showing in attachment a few alternative circuits to achieve the desired functionality with using only discretes.
dk1.PDF (179.6 KB)



Hello Evan,

I trust our conversation was useful.

May I encourage you to continue. Know that it takes time to learn the art of electronics. You are on a good track as you work the simulations and ask questions. Know that the simulation is a great place to start as you can iterate through ideas very quickly - you can see what works and generally determine why. However, as @PaulHutch pointed out, there is great value in building circuits. You will find that things that look good on paper don’t always translate to the real world.

Best Wishes in your studies,


I haven’t given up, I was just away for a few days. Actually right in the middle of our flurry of activity the other day the forum cut me off. While trying to reply to you, I got a message saying I had reached my allowed posts for a new member, or something to that effect.

I fully intend to bench test this circuit before committing it to my project. But I’m using the simulations to sort out components and get down the right path first.

1 Like

I agree, but I’m just trying to sort out what I need to order in to do the breadboard tests.

Heke, thank you for your help. I put together your top circuit and it “mostly” works. I didn’t have the 1N4148 so I simulated it with a 1N4001 which I did have on hand and it worked great. However on the breadboard, not so much. I also didn’t have the BC109 but substituted a 2N2222A instead. When I first got the circuit together without the NPN the LED was slightly on, and the GND pin would turn full on. Once I put the NPN in place the LED lit full and no button pressing would change the state. After fiddling with it I found that by pulling the diode the 12V input then worked. So I have ordered in some 1N4148 diodes and some MMPQ2222A quad NPN arrays to play with.

I should be getting some LM339PWR quad comparators in later today to get back to APDahlen’s option.

1 Like

Hi @EvanZ ,

A nice demonstration of how simulations and actual physical circuits do not always align. My circuit A is not a particularly good design, sorry :roll_eyes:. The leakage current is too sensitive to the current gain of the transistor. I am afraid you’ll need to add one more component (a zener D2) to cut off the leakage.

The avalanche voltage of the zener can be anything from 5.1V to 10V. The diode and the transistor types are not critical here, almost anything that resemble diode and transistor will suit. 1N4148 and BC109 are given as an example, as they are very common household items. 1N4001 and 2N2222 should work well.

Cheers, heke


I have order in some Zeners and should test further today.

1 Like

Success! We have a working circuit! For an LED anyway. I will incorporate the opto when they arrive today!

Thank you everyone!


Hello EvanZ,
That is great news. Keep us posted on your progress.

1 Like