I would like firstly to attach this to my Arduino Mega.
Im relatively new to electronics an i don't want to kill it or me.
Can i just attach 3 separate PWM channels to control each colour?
Can i just attach 3 separate PWM channels to control each colour?
No. Absolutely not.
You need a proper driver, preferably a constant-current driver capable of 350mA.
The ABSOLUTE maximum rating of an AVR output pin is about 1/10th this value.
There are a few ways to do this, and your actual intended application can change what you do.
I drive those exact LEDs with the CAT4109 driver from ON Semi. The catch? They're in a SOIC-16 package, so unless you are up for surface mount soldering, you're not going to be happy. It also only drives them at 175mA - that's fine by me, as they're still VERY bright, but you can parallel the outputs to get 350mA.
Just want to use parts available at your local radio shack? It gets much tougher, as we're dealing with a common anode led with some pretty serious current requirements.
If you have an application in mind, do share and it will help.
brucethehoon:
There are a few ways to do this, and your actual intended application can change what you do.
I drive those exact LEDs with the CAT4109 driver from ON Semi. The catch? They're in a SOIC-16 package, so unless you are up for surface mount soldering, you're not going to be happy. It also only drives them at 175mA - that's fine by me, as they're still VERY bright, but you can parallel the outputs to get 350mA.
Just want to use parts available at your local radio shack? It gets much tougher, as we're dealing with a common anode led with some pretty serious current requirements.
If you have an application in mind, do share and it will help.
i got one cheap online and wanted to drive it somehow.
I had thought about putting it in one of my reptile houses just for light and change the colour etc.
Sadly, it turns out that driving common anode RGB HIGH POWER (the kicker) leds is not terribly easy. If I were to give you the FAST/CHEAP version that breaks so many best practices rules, it would be:
1x radio shack perfboard.
3x mosfets
3x 3904 transistors
3x 10ohm TWO WATT (these are not your average resistors
Use the arduino to switch the transistors. Use the transistors to switch the mosfets and use the resistors to limit the current.
This is a wildly inefficient way to do things, but it would work. Also: your resistors will burn you to death after a few minutes.
Pointing back up at the top, those are two common, cheap constant current drivers that can be made to support your 350mA/channel LEDs. When I personally want to do it, and do it right, I use 3x CAT4101 constant current sinks (also ON SEMI). Those are rock solid, efficient and easily interfaced.
As Mike says, the resistor solution is.... not one. When I said the resistors will get hot, that's not the half of it.
Now, if you want to spend some MONEY on this, google RGB LED AMPLIFIER. There are units out there that will take 5v pwm out and amplify it to be between 350mA and 10A. Be sure you buy the right version... ~$25.
@bruce: Yes it works for common anode (+). Your thought is correct, but the sense is wrong; it does NOT in fact work for common cathode.
But you need to repeat it 3 times, one for each channel.
This circuit is actually cut from a schematic that does that.
If you look on the right side you'll see header SV1. That is where the LED goes. On the right side + comes in (3 pins just in case you are using 3 separate LEDs), on the left side, you'd connect 2 more copies of the circuit. But you can buy quad channel opamps to make things smaller and easier to build. In fact you can see on the schematic the opamp specced as MCP604 which is actually a 4 channel op-amp...
I made this circuit because the drivers I could find for sale were all for a specific current, where this one is adjustable with a large range, from about 10mA to 2A with the pot on the left. Also, a lot of LED driver chips are actually buck/boost converters so that you can drive a higher voltage backlight from a 3.3v device, for example. This is unnecessarily complex and expensive (but more efficient) for my application, which is to drive a LOT of high power LEDs. It is easier for me to get a single power supply delivering 5v (for example) and use this driver to knock the voltage down to whatever each LED needs.