Electronics > Projects, Designs, and Technical Stuff
Driving CC RGB LED directly from MPU without flickering (using 3 pins PWM)
beduino:
Hello, Probably obvious thing for many, but I'd like to use CC (common cathode) RGB LED as indicator in cycling helmet,
so I'd like to avoid any flickering, but maybe smooth pulses at the rate of cadence (RPM of chainring) at computed colour.
Idea is to use discrete elements like NPN transistor, current limiting resistor but also inductor and maybe Shottky diode to provide something like buck converter for each Red/Green/Blue channel controled by MPU PWM ISR using 3 pins ?
No need for too many colours available, but I'd like to avoid LED flickering by changing LED current instead of manipulate RGB colour with high frequency PWM directly each Red/Green/Blue component.
As I said, no problem to make something like overkill in this application, to have nice steady shining RGB LED colours without any flickering...
I've WS2812B RGB LEDs, but unsure whether its light is flickering or not, since didn't setup experiment to verify this - additional issue is driving those leds using 1 pin require relative high frequency, which might be problem, since I'de like to put RGB LED without driving circuit maybe as far as a few meters away from MPU, do not sure if WS2812B RGB LED will work controled by longer wire :-//
Anyway, main concern is flickering in this application, since cyclict might have in sight light output from this RGG LED for a long time hours ride, so avoiding any flickering is a must, I think...
UPDATE: Realized that probably I need CA (Common Anode+) RGB LED to use capacitor in parallel to drive each RB channel directly from MPU with additional current limiting resistors.
NOTE: I've CC (Common Cathode -) RGB LED - it doesn't matter too much since I've implemented in MPU software CC RGB LED by default, but CA RGB LED can be enableld when needed.
Latest schematics without MPU (ATTiny85 8MHz ) below:
NivagSwerdna:
I know it's not exactly what you asked but I really really like...
http://www.ti.com/product/LP5569
I've been playing with these recently and they are great fun. Talk to them via I2C, your MCU can even go to sleep whilst the effects continue.
Claims "12-Bit 20-kHz Internal Individual PWM Control Without Audio Noise"
beduino:
--- Quote from: NivagSwerdna on October 31, 2019, 08:01:07 pm ---I've been playing with these recently and they are great fun.
--- End quote ---
I'd like to be sure RGB LED will not flicker at high frequency.
Do you have some real experiment data to proove that?
Meantime, I've found on other forum that adding capacitor in parallel to LED smooth its current while driving using PWM.
I've already made simple simulation like below with 3mA green LED and it looks like it could work in my case, since I do not need blink this RGB LED at higher frequency than 3Hz, while we have quite nice steady LED current with 22uF capacitor @ 2.5kHz 25% duty cycle 8)
Since, I've 10kHz MPU timer used to provide system time updated in 100us intervals, I could use it for 2bit PWM: 0% 25% 50% 100% which means I should be able get 4*4*4=64 RGB colours which is fine in this application, I think.
Now, it is time to implement this PWM idea at the end of 10kHz timer ISR and in main code do some tests by using only one byte to store RGB 64 colours on 6bits and maybe use free 2 MSB bits to store something like 4 step dim level adjustable by using a few switches additionally limiting CA (Common Anode+) RGB LED current when needed :-/O
NOTE: Blinking at 0Hz-3Hz will be controled based on I2C sensors data and has nothing to do with PWM flickering.
What do you think about this capacitor in parallel to LED to make PWM current more stable to avoid flickering?
StillTrying:
"while we have quite nice steady LED current with 22uF capacitor @ 2.5kHz 25%"
Most normal people wouldn't notice the 2.5kHz PWM even without the cap. I'm using a 2.3kHz LED desk lamp ATM. I think the cap could be a lot smaller than that maybe even as low as 0.2uF, anything that smooths the edges of the PWM helps to make it a bit less noticeable.
thm_w:
WS2812 is ~400Hz PWM frequency, but you can get other devices with higher levels: SK6812 1.2kHz, APA102C 20kHz.
If you drive at 5V I'm sure 1M or so cable would be ok, but would want some ESD mitigation.
Navigation
[0] Message Index
[#] Next page
Go to full version