I'm working on a circuit using an attiny2313 to control 3, 3W RGB LEDs.
I'm using 3 outputs from Timer0 and Timer1 to switch on the red, green and blue color channels. I have them set up in fast PWM mode, so that I can set the brightness of each color channel with the duty cycle of the timers.
This works fine at changing the intensity, but my problem is when the duty cycle should be 0% (OCRXX = 0) the LEDs are still on, when they should be off (at least in my thinking).
I've tested this with just a small 5mm LED on one of the PWM outputs, and it also faintly glows, so I'm fairly certain this is some kind of software issue and not something wrong with the hardware.
Here's what it looks like:
That LED should be completely off, but it isn't. The other LED is off because it's common anode is disconnected.
This is the schematic:
The transistors and resistor values are all wrong in that schematic, but that's how it's hooked up.
This is how I've set up one of the timers:
TCCR0A |= (1<<COM0A1) | (1<<WGM01) | (1<<WGM00); // fast PWM TCCR0B |= (1<<CS02); // clk / 256 OCR0A = 0;
If anyone could point me in the right direction here, I would really appreciate it. Thanks!