# LED help

#### Nekwan Angel

Joined Dec 16, 2015
3
I need a circuit in which a green LED will turn on only when the voltage is in between 1V - 3V. The voltage may change within the range of 0V - 5V. Can anyone help me with this task?

Last edited:

#### RRITESH KAKKAR

Joined Jun 29, 2010
2,829
yes i can with micro ADC or comparator

#### Nekwan Angel

Joined Dec 16, 2015
3
How would the circuit scheme look like if you used a comparator?

#### RRITESH KAKKAR

Joined Jun 29, 2010
2,829
have you used microcontroller

#### Nekwan Angel

Joined Dec 16, 2015
3
Yes, but I don't know how to ensure that there is a minimum of 1V and a max of 3V in the system. I don't know how to make sure that the LED works only in that area.
There is a random amount of voltage always flowing between 0V and 5V

#### RRITESH KAKKAR

Joined Jun 29, 2010
2,829
How would the circuit scheme look like if you used a comparator?
DO YOU KNOW VOLTAGE DIVIER?

#### RRITESH KAKKAR

Joined Jun 29, 2010
2,829
Yes, but I don't know how to ensure that there is a minimum of 1V and a max of 3V in the system. I don't know how to make sure that the LED works only in that area.
There is a random amount of voltage always flowing between 0V and 5V

#### DickCappels

Joined Aug 21, 2008
10,240
Yes that is a comparator but you need a window comparator

The voltages at the top and bottom of R3 define the window. In the example above, the LED is on when the In is above the voltage at the bottom of R3 but below the voltage at the top of R3.

For your case run the thing from the 5 volt power supply.

Is that enough for you to get started?

#### RRITESH KAKKAR

Joined Jun 29, 2010
2,829
what is window comparator

#### DickCappels

Joined Aug 21, 2008
10,240
It is a circuit with the same function as the circuit in post #8. Its output is low when the input voltage is between a lower and an upper limit. Or, you could design it high when the input is in the "window".

https://en.wikipedia.org/wiki/Window_detector

#### WBahn

Joined Mar 31, 2012
30,257
Yes that is a comparator but you need a window comparator

The voltages at the top and bottom of R3 define the window. In the example above, the LED is on when the In is above the voltage at the bottom of R3 but below the voltage at the top of R3.

For your case run the thing from the 5 volt power supply.

Is that enough for you to get started?

If Vin is within the window, then IC1 is trying to drive its output to +15 V while IC2 is trying to drive it's output to -15 V. So what is Vout?

EDIT: Papabravo reminded me that the LM339 is open collector, so Vout is well defined for this case.

Last edited:

#### Papabravo

Joined Feb 24, 2006
21,264
It is not clear what the supply rails are for the LM339, but it might interest some to know that the output is open collector. Vout will be at +15V when the LM339's output transistor is off. One might infer that the supply rails are ±15V, but that might not be the case. Further, the part has certain other restrictions on the input voltages for proper operation. The parameter of interest is called Input Common Mode voltage Range. IIRC if either input is within 1.5V or 2.0V of the supply rails the output could be inverted. This is a real gotcha of a thing to discover in production.

Last edited:

#### WBahn

Joined Mar 31, 2012
30,257
It is not clear what the supply rails are for the LM339, but it might interest some to know that the output is open collector.
Ah! And I knew this, too. But simply forgot. Apologies to Dick.

#### Papabravo

Joined Feb 24, 2006
21,264
Last edited: