I will create a lamp which can light up in all the colors of the rainbow, i will add some effects like steady light (red, green blue), very fast switching between colors, slowly fading colors etc.
with these specifications
Red: Voltage 2.4v, 20ma
Green: Voltage 3.4v, 20ma
Blue: Voltage 3.4v, 20ma
I already brought resistors for these, to power them from a 5v voltage regulator. I figured out that i must use a transistor or a mosfet to handle the switching of the LEDs, as the Arduino won't be able to handle the current on the PWM pins. The LEDs will be connected in parallel each which it's own resistor. So i'll use three PWM pins, one for each color
Now my question is, shall i use a Transistor or a Mosfet? - as far as iv'e red the smartest is to use a mosfet, but i don't know if that is correct. The LEDs will use a maximum of 240ma, as far as i figured out(?). As i said, i will have a mode where the LEDs will cycle through colors really fast, so i need a transistor or mosfet that can switch very fast - i don't know if all is capable of that.
I would like you guys to help me find the right mosfet or transistor for my project, as i don't know what to choose, and what to look for, i have played with transistors before, but mosfets is all new to me, so i don't know which is the smartest for my application.
You haven't said whether the 240mA is total (so you will be driving 4 RGB LEDs, 80mA per PWM pin) or per colour (driving 12 RGB LEDs, 240mA per PWM pin). But it makes little difference. Unless you are making a PCB and using SMD devices, then transistors will cost a lot less than mosfets. I would use three BC337 transistors, each with a 330 ohm base resistor.
dc42
Thank you very much for your fast answer! - the 240mA is per color, therefore the pwm pins can't handle this. I am NOT going to use SMD components. I would like to ask you, why you would use a transistor rather than a mosfet? - is it just because the transistor is cheaper, or does it have some capabilities i will need, as the mosfet doesn't offer. I am asking because i red somewhere that mosfets are more generally used today, therefore i thought that this would be the best thing to use
again, thank you very much. I appreciate your help
JohannesTN:
dc42
Thank you very much for your fast answer! - the 240mA is per color, therefore the pwm pins can't handle this. I am NOT going to use SMD components. I would like to ask you, why you would use a transistor rather than a mosfet? - is it just because the transistor is cheaper, or does it have some capabilities i will need, as the mosfet doesn't offer. I am asking because i red somewhere that mosfets are more generally used today, therefore i thought that this would be the best thing to use
again, thank you very much. I appreciate your help
There are few low to medium-power mosfets available in non-SMD packages. The only ones I know of that would be ideal to switch 240mA are from the ZVN range, e.g. ZVN4206A. In contrast, there are lots of NPN transistors in TO92 or similar packages that will switch 240mA.
fungus:
Pretty much any transistor will do.
I disagree, you need a transistor with reasonable hfe and low saturation voltage @ 240mA. Low-current types such as 2N3904 would not work well in this application.
I disagree, you need a transistor with reasonable hfe and low saturation voltage @ 240mA. Low-current types such as 2N3904 would not work well in this application.
Damn, you found an exception!
I'd better name one: 2N2222 (or BC548 for Europeans)
I'd better name one: 2N2222 (or BC548 for Europeans)
2N2222 - better than 2N3904, but still not ideal for switching 240mA. Minimum hfe and maximum Vce(sat) are is 100 and 0.4V @ 150mA but 30 and 1.6V @ 500mA. So OK for switching 150mA, but not really suitable for switching 500mA. At 240mA I expect the hfe will be OK, but the Vce(sat) is likely to be a little high.
BC548 - definitely not suitable, it's a low current transistor like the 2N3904. On the datasheet I am looking at, minimum hfe is only specified @ 2mA, and maximum Vce(sat) is only specified at 10mA and 100mA.
The reason I like BC337 is that it maintains good minimum hfe at higher currents (100 @ 100mA and 60 @ 300mA), as well as low Vce(sat) (0.7V @ 500mA). The ZTX851 is even better, but expensive and less readily available.
I would say that for small current (<500ma) or very large current (>200amp), you are in bjt land. BJT is much easier to drive for small current switching and much more efficient at high current / high frequency switching.
Mosfets are attractive due to its low ohmic values. I would start considering them for 1amp+ switching, or moderate speed (<50khz). Their issue is inefficiency at very high current levels, or difficulty in driving them at high speed.