Power Switch LED Fading Effect

Ya’akov

Joined Jan 27, 2019
10,256
PWM?
CPU?

Luminous intensity of a typical led is almost proportional to forward current. So wouldn't a current source be a better solution?
The ambient light level will of course be relevant to some degree, as to the viewers perception of lowest level of brightness.

The resistor, capacitor & transistor current source, must be the easiest solution with a good presentation of changing intensity?
The MCU solution involves one IC and a couple of passives, or possibly a very small and cheap MOSFET and a couple more passives. It is much simpler on terms of BoM and revisions do not require a new PCB. It is common today to find little 8-pin MCUs doing things like this in even the very cheapest products—because it is the easiest way to get the best solution.
 

Sensacell

Joined Jun 19, 2012
3,785
PWM?
CPU?

Luminous intensity of a typical led is almost proportional to forward current. So wouldn't a current source be a better solution?
The ambient light level will of course be relevant to some degree, as to the viewers perception of lowest level of brightness.

The resistor, capacitor & transistor current source, must be the easiest solution with a good presentation of changing intensity?
Yes, but remember that the human eye has a very nonlinear response to the light level.


In my job design fancy lighting stuff for very demanding clients, I have messed around quite a bit with attempting to dim LEDs with linear circuitry,
the results are always same- not enough ramp at the start.

You need a very non-linear function to make the LED look like it's dimming linear.
 

ElectricSpidey

Joined Dec 2, 2017
3,336
JFTR the circuit I posted is not "linear" it's analog. But as Professor Walter Lewin says, "That's just a point".

It was just offered as a simple solution.

The OP could breadboard the circuit and make up their own mind.
 

LowQCab

Joined Nov 6, 2012
5,101
The Micro-Controller route can have any ramp-up-curve that You can imagine,
it can even "breath" up and down for a set number of cycles, then remain "On".
.
.
.
 

MisterBill2

Joined Jan 23, 2018
27,639
I have in my house a small circular LED light fixture that fades to darkness when switched off, rather than going dark "Instantly." the fade-out lasts about 3 seconds, and it was not mentioned on the label at all. I suspect that the effect is due to a filter capacitor inside the unit. But given the price for it, it is very clear that there is no micro-controller inside. So the effect is certainly possible without any PWM or code.
 

Irving

Joined Jan 30, 2016
5,139
I have in my house a small circular LED light fixture that fades to darkness when switched off, rather than going dark "Instantly." the fade-out lasts about 3 seconds, and it was not mentioned on the label at all. I suspect that the effect is due to a filter capacitor inside the unit. But given the price for it, it is very clear that there is no micro-controller inside. So the effect is certainly possible without any PWM or code.
seriously Bill? How much do you think an MCU costs? The Attiny10 I suggested I can buy 10 for 80p. In the quantities that bulbs are produced it'll be way less. The Chinese manufacturers have a SOT23-6 packaged MCU, not ARM but very similar that is <0.1c 100,000 up!
 

MisterBill2

Joined Jan 23, 2018
27,639
seriously Bill? How much do you think an MCU costs? The Attiny10 I suggested I can buy 10 for 80p. In the quantities that bulbs are produced it'll be way less. The Chinese manufacturers have a SOT23-6 packaged MCU, not ARM but very similar that is <0.1c 100,000 up!
Consider first, that any interface with any MCU in a light fixture will add to the cost much more than add to the value, and consider that the light fixture I described has an integral LED assembly, not a bulb, there is no way it includes an MCU of any flavor. Not for the low price that it sold for. A similar sized "smart" fixture sold for over twice the price.
 

Irving

Joined Jan 30, 2016
5,139
But such devices do have an SMPS controller of some sort, at least the ones I've dismantled do, so any soft start/end function would be built into that chip. I wasn't questioning whether your bulb/fitting had an MCU in it, but your assertion that you can tell based on retail price. Yes, a smart fixture might cost double, but that clearly reflects the perceived customer value, since the works cost of adding a wifi chip is a few cents at most.
 

wraujr

Joined Jun 28, 2022
260
Start simple with LED and Capacitor. Experiment.
R1 + R2 set the current to LED
R1 and C1 determine ramp up time.
R2 and C1 determine ramp down time.
At first approximation if R1=R2, then ramp up/ down MIGHT be same but complicated by V at which LED conducts.
Sure someone with time could Spice Sim.
 

Attachments

MisterBill2

Joined Jan 23, 2018
27,639
The fade-out on that light fixture of mine is strictly a capacitor discharge function. Even if the supply inside is a switcher there is no need for a micro, not if they cost a penny a barrel.
 

Irving

Joined Jan 30, 2016
5,139
Final thoughts on this subject. I bread-boarded both options, test schematic shown below using a pair of matched LED (IV curves within 2%). Took a couple of hours to find an RC mix that was close to the original digital approach. Both solutions need around 4400uF capacitance to give a 2 second approx fade in or fade out. While the RC solution looks ok at first, its much harder to find the best R3/R4 combo and there's no guarantee that it will look similar on another board/LED.

1717861426532.png


In the video below, the analog fade is the top one, the digital fade the lower. The digital is brighter because the full LED current is used (approx 4mA), and there is no compromise between fade in and fade out..

And, yes, they are ATtiny85 not ATTiny10 as I didn't have any ATtiny10s mounted on a SOT-DIP carrier lying around at the moment.
 

ElectricSpidey

Joined Dec 2, 2017
3,336
The OP never requested a "fade-out" so I don't really see the need for the big honkin capacitor configured in that way.

There is no need to find any best resistor combination using the Op-Amp as shown in my example, assuming the LED has an internal resistor already installed, you simply choose the correct divider value to drive the LED depending on the supply voltage* to output the needed 6-volts.

*Which is unknown BTW.

Also, my example can produce full brightness and a much longer fade-in time with a much smaller capacitor.

Normally I don't choose to compete and compare my circuits with others, but if you are going to compare a micro to an RC based circuit, at least choose the proper competition instead of a strawman.
 

ElectricSpidey

Joined Dec 2, 2017
3,336
Why do you need a capacitor for the digital fade-in, I have created a few fade-ins using a micro and never needed a capacitor, I just created them using a loop and either direct GPIO pin toggling or the PWM module.

EDIT: Never mind I see the cap is needed to provide the power down cycle.

BTW now that I can see the video, I think they both look acceptable.
 
Last edited:

MisterBill2

Joined Jan 23, 2018
27,639
Now I have a relevant question: What is the value of such a fade-in and fade-out that makes it worth the effort, or worth ANY effort, for that matter???
 

AnalogKid

Joined Aug 1, 2013
12,153
Yes, the video link now works.

Without going anywhere near the obvious debate, the schematic spawns a new joke: How many microprocessors does it take to turn on a light bulb?

But seriously, the problem with that component in this context (a help forum frequented by noobs) is that the schematic doesn't really tell us anything. At first glance, I don't know if either pin 4 output is a logic level, analog, or PWM signal. Makes any kind of discussion tedious at best. For example, what is the purpose of U2 and its components? Is it simulating the physical switch going on and off? If yes, the question still remains about U1 pin 4.

If fade-off is not a requirement, then driving the LED through an emitter follower will cut the ramp capacitance by 100:1.

ak
 

Irving

Joined Jan 30, 2016
5,139
All of the above being true, and not sure where fade off came from. But worked it up as an tech challenge & discussion for my students as always looking for interesting examples!
 
Last edited:
Top