Evenin' all... Here's the thing - I'm trying to use an ATtiny85 to input (at pin7) a voltage, use the native ADC to then light up an RGB LED (20mA per channel, but that's way too bright, so I'm limiting that to about 10mA each). The circuit uses pins 3, 5 and 6 in PWM mode to control the brightness of the LEDs to cycle through the colours of the rainbow as voltage increases, starting at purple (0v), through shades of indigo to blue, through cyan to green, then yellow, orange and ending on red (4.5V).
So far, so good and it has been great fun learning the programming language (similar to C, but a lot easier), re-learning some old maths techniques, etc, but there are times when the light output glitches between colours as it reaches a "cusp", as it were. Most of the time it's really smooth, but when a new colour is about to make its presence felt (transition from yellow to red, for example), it kind of flickers between 2 states.
I put the scope on it, to watch the PWM signals, and noticed that the 0V to +5V PWM traces have little cut-outs in them, down to about 4.7V. I then put the scope onto the Vcc line and it's all over the place! It's definitely an artifact of the power supply's inability to cope with the current surges as the LEDs are rapidly switched on and off. Admittedly, I'm using a piddly little TO-92 format 7805, which has a limit of 100mA - I'm nowhere near that limit, but it can't help matters, so I've got some TO-220 format ones on order, capable of pushing out 500mA, which may solve the problem, to an extent.
So, the question boils down to this... is there a (relatively) simple circuit that will drive these LEDs? I'm already thinking along the lines of (a) a separate power supply for the LEDs, so the ATtiny's 7805 doesn't have to provide the current surges, and therefore its Vcc will stay much steadier, (b) transistor buffers for the LEDs, so the ATtiny's output pins see a much larger impedance (again, limiting the current that the ATtiny will be using). Maybe also a LP filter to "smooth out the edges" on the PWM spikes, but that's almost certainly going to lead to colours cutting off prematurely on low duty-cycle portions of my spectrum.
It struck me, though, that someone else might have already solved this problem, and I'd be grateful for any insights they might have.
Cheers.
So far, so good and it has been great fun learning the programming language (similar to C, but a lot easier), re-learning some old maths techniques, etc, but there are times when the light output glitches between colours as it reaches a "cusp", as it were. Most of the time it's really smooth, but when a new colour is about to make its presence felt (transition from yellow to red, for example), it kind of flickers between 2 states.
I put the scope on it, to watch the PWM signals, and noticed that the 0V to +5V PWM traces have little cut-outs in them, down to about 4.7V. I then put the scope onto the Vcc line and it's all over the place! It's definitely an artifact of the power supply's inability to cope with the current surges as the LEDs are rapidly switched on and off. Admittedly, I'm using a piddly little TO-92 format 7805, which has a limit of 100mA - I'm nowhere near that limit, but it can't help matters, so I've got some TO-220 format ones on order, capable of pushing out 500mA, which may solve the problem, to an extent.
So, the question boils down to this... is there a (relatively) simple circuit that will drive these LEDs? I'm already thinking along the lines of (a) a separate power supply for the LEDs, so the ATtiny's 7805 doesn't have to provide the current surges, and therefore its Vcc will stay much steadier, (b) transistor buffers for the LEDs, so the ATtiny's output pins see a much larger impedance (again, limiting the current that the ATtiny will be using). Maybe also a LP filter to "smooth out the edges" on the PWM spikes, but that's almost certainly going to lead to colours cutting off prematurely on low duty-cycle portions of my spectrum.
It struck me, though, that someone else might have already solved this problem, and I'd be grateful for any insights they might have.
Cheers.
