Basic window detector

Thread Starter


Joined Oct 28, 2011
Hello all, this is sort of a continuation of a circuit question asked on this forum a couple years ago. I think I know how to do this but wanted to make sure before I actually make the circuit.

Here's a general diagram:

EDIT: seems to be broken, here is url:

So as you can see I'm trying to make a window detector circuit that makes an LED turn on if the voltage is below or above a certain threshold. In this case, I want the LED to turn on above 2V or below 1V.

I think I know how to devise the relevant equations:

VREF1 = R3 / (R1 + R2 + R3) * V+
VREF2 = (R2 + R3) / (R1 + R2 + R3) * V+

I'm just unclear on what to make R values. It seems that R2 always comes out as 1/2, which makes sense mathematically (if you set VREF1 = 2, VREF2 = 1) but makes no sense to me in the real world. I've always used resistors with usually at least 100 Ohm values. But maybe I'm wrong. Help?

Thread Starter


Joined Oct 28, 2011
Do you know V+ ??
And set the current that flow through R1; R2; R3 in range 10mA....1mA
Yeah I set V+ = 5V. Are you saying I should apply loop rule? I'm unsure how to do that with comparators.

EDIT: Upon seeing your new post, I see how if V+ is 5, R1 should be 3K for those values. Any particular reason why you chose R3 = R2?
Last edited:


Joined Feb 17, 2009
Simply use the Ohms law.
The current thats flow through R1; R2; R3 is equal
I = V+ / ( R1 + R2 + R3)
So if we set I =1mA we have
R3 = 1V/1mA =1K
R2 = (2V - 1V)/1mA = 1K
R1 = (5V - 2V)/1mA = 3K
So use R3 = R2 = 1K and R3 = 3K
Or for example R3 = R2 = 6.8K and R1 = 20K.
For more accurate voltage setting you need to use the potentiometer.