I'm sure this has been asked 1000 times in the past but can't find a suitable answer.
Long and short of it.
Attiny45 chip in a circuit. 4 regular pins in use by flashers and constant on leds. 2 pwm pins are needed to drive 2 or 3 leds each in a face.
The other pins are fine, using 2n7000 mosfets to supply the leds on those with 5v but I need an alternative to a mosfet so I can drive the other 4 leds with smooth fading from my current code.
DrAzzy:
Why do you need something other than a mosfet? That's what's not clear...
Oh I need the pwm pins to be able to drive multiple leds on a fade. A mosfet will just act as a gateway between none and full voltage doesn't it? That's why I'm using them on the other pins as that's easy to manage. But I need to be able to fade several leds off 2 pins without muddying the code I already got
i think ive overlooked what a mosfet can actually do.
basically im using an attiny45 to run a model planes lighting. one of the wings are "shot off" so i indent on making 2 sets of 2 leds fade alternatively to simulate fire in the smoke (using coon wool for the effect)
so im using 2n7000 mosfets for the flashing leds that will go to the wingtips, white strobe lights and static led to illuminate the cockpit (im actually only using one led per bit, so 1 green, 1 red, 1 white static on, and 1 white flashing then running fiber optic stand to transfer the light where it needs to be)
however the 2 pwm pins are like this:
pin 0 = 1x yellow + 1x red fading on and off
pin 1 = 1x amber + 1x red fading on and off alternately to pin 0
all the pins are running the mosfet just so the IC doesnt get overloaded by driving too much current through the whole thing.
so i need a mosfet or alternative to put on the PWM pins so those 2 pins dont fritz out and blow the chip.
wvmarle:
Of course you can use a MOSFET just like the blinking ones. PWM is nothing more than blinking very fast, more on is brighter overall to your eyes.
Try and you'll see.
i'll give it a go when my components arrive next week, just id head you couldnt PWM with them. perhaps that was in relation to that specific mosfet. then i also thought the responce time would be too sluggish to handle it. ah well i'll play next week. thanks guys.
MorganS:
How many raccoons do you need to catch to make coon wool?
Seriously, switch to addressable LEDs. Fully color-controllable with a nearly unlimited number of LEDs on a single data pin. No MOSFETs at all.
Alternatively, look at the chip used in the Adafruit motor shield. You get a number (like 4 or 8) of PWM outputs from an I2C (two-wire) input.
that actually doesnt make sense, the reason for using mosfets is to control muptiple leds off 1 pin, the current on pins is limited and you need the mosfet to power multiple leds as not to damage the arduino or IC.
Can drive a whole bunch of addressable LEDs off one pin.
Those 'intelligent' LEDs already have PWM drivers inside them, and they come in all shapes/sizes.
This article explains a bit.
Wouldn't trust that destructables website blindly though.
Leo..