I’m new to this forum and have only posted on one other forum my entire life. I’ll try to articulate what I worked on before and the results I’m trying to achieve.
I have multiple levels to my project but I’ll take it step by step not to confuse people.
Project:
Fade high power LED in/out(up, down) without flickering.
The usually arduino led fade is not going to cut it. I need something more advanced. I’m past the stage of uploading my program on attiny mcu but I want to fix some issues I have.
When using arduino for example with pwm you don’t notice the flickering on a small LED but on high power LED you do. I am aware it’s due to the low frequency output (490hz default) and using different timers and libraries you can increase the frequency but I don’t want extra libraries and increasing frequency isn’t the correct way from what I was told.
I say flickering because as the high power led fades down I notice a small flickering just before it gets down to the very last bit. It seems to be a common issue. As the pulses become less the times slows down and you notice it.
I also know that the low end micro controllers are all 8bit which provides low resolution.
I was told to use at least a 32bit controller and gamma correction to fade in/out smooth without visual flickering.
I also did a lot of research and it’s also advised to use a mosfet driver even if I’m using a logic level mosfet.
Any suggestions and advice would be much appreciated.
I would very much like to hear from embedded software/core developers/engineers on this topic.
I have a video of the fade in/out I require but I can’t upload it here.
Hi Jason
I don’t know why increasing the frequency would not help. LEDs are pretty fast devices and it is your eye persistence that smooths things out and as you have noticed when the off time increases the flicker (which is there all the time with PWM control) becomes more noticeable.
I have a problem at home with bedside dimmable lamps. These dim in 3 stages and when on the lowest setting between about 10PM and midnight on the half hour they flicker like mad, most annoying. At this dim setting the lamp LEDs are responding to power line switching signals controlling off peak water heaters and other thing that are switched remotely. Nothing much I can do about that except fit incandescent globes which would smooth out the flicker.
Variable DC I don’t think is the answer as LEDs are perceived to be a bit non linear and a bit hard to control. Personally I would try for a higher frequency (without going too high) as I can’t see it doing any harm. Someone else might have had some experience here.
I have a couple of strings where I fade from one colour to the next but I reduce one colour while increasing the next so the brightness is not really changing, just the colours change.
As a matter of interest I have played with an Arduino UNO R3 (16MHz) and the maximum frequency attainable using the digital Write HIGH and LOW commands is about 125kHz. Probably the same for all 16MHz devices. This is going to be the subject of another post very soon for those interested. Watch this space.
Cheers Bob
Thanks for the reply but unfortunately I’ve been down that road. Increasing frequency ( adding libraries and addressing registers) is not the way to go in order to create smooth fade on high power leds that are driven with MOSFETs.
For hobbyist, home tiinkers playing around with low resolution mcu and small leds it’s ok but for a commercial product with very specific specs it aint going to do it
I’ve bumped your trust level up so you can post photos and links.
Also can you hook your circuit up to a scope to see what the waveform looks like?
I think Bob has pretty well hit the nail on the head.
Gamma correction will be necessary for the fading speed but you’ll need a higher ‘resolution’ the dimmer you go.
To get higher resolution on the lower end you’ll most likely need a higher frequency PWM signal or a filter to smooth the voltage out.
While the microcontroller may be 8-bit; the timers are the key peripheral in your project. Bob mentions getting 125kHz which will be more than enough for the human eye to see even the smallest changes.
Another product line that would be worth looking at is the WS281x or APA10x LED’s, they feature an onboard controller and with dithering you can get lower brightnesses with smooth changes.
That came about as the result of a few measurements with an Arduino UNO R3 recently. I had noted that pulses generated with digital Write had an error across the board of about 4µSec. I generated some pulses using digitalWrite with no delays and resulted in a pulse train of about 4µSec high and 4µSec low which equates to about 125kHz. I intend this to be the subject of another post very soon.
Cheers Bob