Pages: [1]   Go Down
Author Topic: LED strip light fade  (Read 950 times)
0 Members and 1 Guest are viewing this topic.
Croatia
Offline Offline
Sr. Member
****
Karma: 11
Posts: 443
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
I'm working on a model train layout and as a part of lighting system we have a 7 meter segment we wish to light up using an LED strip. It is 12V 48W so it requires a bit too much current to run on some other equipment we have which allows us to turn on and off other small lights such as house and street lights railway crossings etc with various effects.
We want the LED strip to light up progressively over the period of a few minutes to synchronize it with the day/night cycle; to slowly turn on when the night falls and to slowly turn off at dawn.

My idea was to use our existing computer controlled equipment which is already synchronized with the day/night cycle to send the signal and trigger the turning on and turning off fading. The fading itself would be controlled by one ATtiny45 optocoupled to protect it from the on/off signal (15V since it powers other lights). ATtiny45 would then drive a MOSFET which would push the necessary current towards the LED strip.

So, am I on the right track?
Would analogWrite be a good command, considering ATtiny45 haves PWM outputs?

Thanks for any insight on how would you approach this.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Would analogWrite be a good command,
With suitable MOSFET, yes. Keep in mind that the LED output is not linear. That is, an increase in PWM value from 40 to 50 will not result in the same level of perceived brightness change as an increase from 100 to 110 or from 240 to 250.
Logged

California
Offline Offline
Sr. Member
****
Karma: 3
Posts: 433
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I feel like maybe that the perceived brightness of daytime would be similar to the perceived brightness of an LED, especially taking in a persons adjustment to brightness over the day. It might actually be a desired effect...

And if not it's quite simple to fix, but causes some ugliness in the lower numbers.
Logged

Offline Offline
Edison Member
*
Karma: 32
Posts: 1288
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

smiley-grin Yeah... the PWM is perfectly linear...  It's our perception that's approximately logarithmic.  So, a PWM change from 10-20 (a 100% increase) will appear to be a bigger change in brightness than a change from 100 to 110 (a 10% increase).

If the change is slow enough, say sunrise effect over a 10 minute period, you can't really see the change happening anyway, so you won't notice any "nonlinearity" in the rate-of-change.
Logged

Croatia
Offline Offline
Sr. Member
****
Karma: 11
Posts: 443
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for replies, guys.
I'm not worried about the ugliness at low power. The idea is for this strip to turn on at dusk, glow bright during the night and turn off at dawn, so low power will happen while room lights are strong so the uneven progress should be masked.

I'm more interested in whether you think ATtiny45 is a good chip to do this and would it be capable of doing what I want.
Logged

Pages: [1]   Go Up
Jump to: