Shuffle that red over to D4 and I think you'll have a better result. The tiny core doesn't give you hardware PWM control on D3 so the effect of analogWrite() will be a harsh cut-over from OFF to ON.
As identified above, you will still need to drive them using a transistor of some sort as (from page 166 of the ATTiny85 datasheet) the maximum power for any one pin is only 40mA so rather than sourcing the LED power from a pin you'll want to control it from a pin, and have the LEDs draw their power directly from a source that's attenuated by that transistor-PWM combination.
kculm:
Darn, I spent all day reading up On NPN because I have a bunch.
Common-cathode LEDs cause these pains.
It's basically the same though, except the output will be inverted (pin LOW=LED on).
kculm:
First, Do i have to use Transistors? When I hook it up to My Arduino (with the right resistors) it works like a charm. But when i put it on a Bread Board with a atTiny85 and my DC power supply set to 5v. it works. Not a well, the transition are not as smooth. Is that because of the lack of transistors or is it the at85 .
The chip's I/O pins start to burn up at 40mA. There's no way you can drive six LEDs from one pin without damaging the chip (the effect you see is probably the chip fighting for its life).
kculm:
And lastly. will I need a resistor on the base pin of the PNP if so can you recommend the size.
Yes, and for the same reason: You have to keep the current coming out of the chip below 40mA.
Shuffle that red over to D4 and I think you'll have a better result. The tiny core doesn't give you hardware PWM control on D3 so the effect of analogWrite() will be a harsh cut-over from OFF to ON.
I have one last issue, When I run it with out transistors on the Arduino it works smooth. But when I use 3, PNP transistors it works fine up until the Green to Blue transition. It almost dims out completely then flicker to blue.
You can see what I am talking about here.- YouTube The first 45 sec our so is with out Transistors. After a few sec of blackness it with transistors.
Shuffle that red over to D4 and I think you'll have a better result. The tiny core doesn't give you hardware PWM control on D3 so the effect of analogWrite() will be a harsh cut-over from OFF to ON.
There's a hardware limitation: Pin 3 can only output the inverse of pin 4, pin 4 is the 'true' signal.
While that's strictly true for the datasheet, in reply #38 of this thread on ATTiny85 and PWMCoding Badly explained that the inverted PWM output can't be used by the Arduino cores for ATTiny. My own testing confirms this gotcha - that D3 is not able to use hardware PWM with the arduino-tiny core. Software PWM like the tone() function works fine on all 5 of the standard ATTiny85 IO pins though, so there's an easy way around this limitation if you must use that leg.
kculm:
I have one last issue, When I run it with out transistors on the Arduino it works smooth. But when I use 3, PNP transistors it works fine up until the Green to Blue transition. It almost dims out completely then flicker to blue.
You know the PWM is working so it has to be a power supply problem. You probably need some decoupling. Add ceramic capacitors between ground and 5V next to the transistors (as close as you can), see if that helps.
fungus:
There's a hardware limitation: Pin 3 can only output the inverse of pin 4, pin 4 is the 'true' signal.
While that's strictly true for the datasheet, in reply #38 of this thread on ATTiny85 and PWMCoding Badly explained that the inverted PWM output can't be used by the Arduino cores for ATTiny. My own testing confirms this gotcha - that D3 is not able to use hardware PWM with the arduino-tiny core. Software PWM like the tone() function works fine on all 5 of the standard ATTiny85 IO pins though, so there's an easy way around this limitation if you must use that leg.
I don't know how the cores use the timers. I know that using hardware PWM on D3 and D4 at the same time wouldn't work for analogueWrite() functions.
kculm:
I have one last issue, When I run it with out transistors on the Arduino it works smooth. But when I use 3, PNP transistors it works fine up until the Green to Blue transition. It almost dims out completely then flicker to blue.
You know the PWM is working so it has to be a power supply problem. You probably need some decoupling. Add ceramic capacitors between ground and 5V next to the transistors (as close as you can), see if that helps.
Thanks I will give that a try when I get home tonight. But so I am clear. I need to put a Cap from a Ground pin on the Arduino to the emitter on the PNP // Or is it from the Ground real to the 5v real.
And what size Cap.. ( Way to much to learn, I am glad it is fun).
kculm:
Thanks I will give that a try when I get home tonight. But so I am clear. I need to put a Cap from a Ground pin on the Arduino to the emitter on the PNP // Or is it from the Ground real to the 5v real.
Between ground (any ground) and the 5V power line as close to the PNP as possible (touching it is good).
kculm:
And what size Cap.. ( Way to much to learn, I am glad it is fun).
0.1 ... 0.22 uF, that sort of size, but only ceramic type.
kculm:
Thanks I will give that a try when I get home tonight. But so I am clear. I need to put a Cap from a Ground pin on the Arduino to the emitter on the PNP // Or is it from the Ground real to the 5v real.
Between ground (any ground) and the 5V power line as close to the PNP as possible (touching it is good).
kculm:
And what size Cap.. ( Way to much to learn, I am glad it is fun).
0.1 ... 0.22 uF, that sort of size, but only ceramic type.
I am using 3 transistors, so I am thinking one for each?
Also I cant thank you guys enough, I am learning so much.