PWMming high powered leds smoothly
hi - wasn't sure whether right place ask feel free tell me i'm wrong. i'm trying dim high powered leds using rf520 (these 3v 1a leds) , and coming across 2 problems:
1) leds not fading black entirely. @ around 2% brightness switch off. pretty low still noticeable. i'd try , achieve smoother fade black if possible.
2) don't seem able achieve non-linear dim looks better eye. have both log , sine wave equations in there , work lot better straight linear can't seem make dim curve steeper (i.e. dim more @ start , faster @ end). leds though @ full brightness until halfway through fade. :-(
i don't know if because of hardware or code.
here snippets of doing:
log
sine
thanks help!
1) leds not fading black entirely. @ around 2% brightness switch off. pretty low still noticeable. i'd try , achieve smoother fade black if possible.
2) don't seem able achieve non-linear dim looks better eye. have both log , sine wave equations in there , work lot better straight linear can't seem make dim curve steeper (i.e. dim more @ start , faster @ end). leds though @ full brightness until halfway through fade. :-(
i don't know if because of hardware or code.
here snippets of doing:
log
code: [select]
const int _pwmintervals=14660;
float _r;
static int _interval=0;
unsigned int _logxfactor=2;
static float _auto_power=0;
if (_interval<=_pwmintervals){
_interval++;
_auto_power=pow(_logxfactor,(_interval/_r))-1;
analogwrite(led,auto_power);
}
sine
code: [select]
while dimming:
_sinfactor=_sinfactor+(4.712/(twilight_length*3000));
auto_power=(sin(_sinfactor)*127.5+127.5);
analogwrite(led,auto_power);
thanks help!
quote
i don't know if because of hardware or code.so post code not schematic?
Arduino Forum > Using Arduino > LEDs and Multiplexing > PWMming high powered leds smoothly
arduino
Comments
Post a Comment