How to prevent led slowly fading out?

Is there someone that can tell me how i in simplest way can prevent a led slowly fading out when battery gets bad? I mean, i want the led to turn off quicly when voltage is low instead of slowly fading out.

Can someone give me an example how i can wire this and what component(s) to use?

I'm talking ordinary 5mm leds diode powered with one 18650 battery.

Is there an Arduino?

That will be tricky because you don't have a lot of extra voltage to "play with" and as the voltage drops the LED is going to dim. It's a lot easier to do with a 12V battery because you can power the LED & logic from a 5V voltage regulator. You probably need a boost converter to give you 5V as long as long as it can, until the battery gets too-weak. But a boost converter is extra circuitry that's going to consume power and shorten battery life...

There is a type of chip called a comparator. The output state changes when the input is above or below a reference/threshold voltage. It's the exact logic you're looking for, it's cheap, and it's easy (no software). But, it needs stable reference voltage, and most chips need 3.3 or 5V so it may not be reliable if the voltage is too low.

This 2 terminal 15mA device works down to 2.5V.

Bjerknez:
Is there someone that can tell me how i in simplest way can prevent a led slowly fading out when battery gets bad? I mean, i want the led to turn off quicly when voltage is low instead of slowly fading out.

Can someone give me an example how i can wire this and what component(s) to use?

I'm talking ordinary 5mm leds diode powered with one 18650 battery.

So you want to use the LED as basic battery level indicator, it goes out when the battery gets down to a predetermined output voltage?
Tom.... :slight_smile:

TomGeorge:
So you want to use the LED as basic battery level indicator, it goes out when the battery gets down to a predetermined output voltage?
Tom… :slight_smile:

Basicly, i want the led to light with the same strength to the battery reatch 3V and then shuts off.

dlloyd:
This 2 terminal 15mA device works down to 2.5V.

The chip "eats" 2.5 V. Not suitable here.

@OP a switching constant current source is probably the thing you need. There are chips designed for such LED driving. What are your requirements?

The Lm393 can be configured as a 'threshold detector which can switch off a transistor powering the led.I believe it is 'open collector' which means it will need a ' pullup resistor' . ( uh oh ! [cue JAWS theme music])

Bjerknez:
Basically, i want the led to light with the same strength to the battery reach 3V and then shuts off.

What will be the maximum voltage?
Will your project/circuit also run of this battery?
What chemistry is the battery?
Tom.... :slight_smile:

TomGeorge:
What will be the maximum voltage?
Will your project/circuit also run of this battery?
Tom.... :slight_smile:

The maximum voltage is 4.2V (18650 battery) and minimum voltage or the voltage i will the led turn off is 3V.
Its just battery and a few led diodes. No microcontroller or anything else.

Google 'comparator window detector'

What is forward voltage of the LEDs? What current you want?

Smajdalf:
What is forward voltage of the LEDs? What current you want?

Forwar voltage is 2.7V. I think between 10-20mA where 20mA is absolute max rating for the diodes.

Post#10

No significant brightness change if you use a red LED with a Vf of about 1.8volt,
but a blue/white LED with a Vf of about 3.3volt will have decreased brightness at 3volt.
Leo..

I know, but i do not want to use red led. I want to use warm white led and the warm white leds i got has 2.7V forward voltage.

Just a 40¢ MCU, 2.5-5V VCC.
Use megaTinyCore, Arduino IDE and UPDI programmer (cheap).
It can monitor VCC and adjust PWM to drive the LED.

So can an ATTiny85 but last tome I bought them they were $1.50 but that's still 'affordable'. I didn't
suggest it because the OP said "no MCU".

Yes, i know i can do this with a microcontroller, but i just wanted to know if it was a simpler solution to this. But i think i just use a 5V adapter an skip the battery.

Thanks for help btw :slight_smile: