I’ve ordered my Spark and while waiting for it to arrive I’ve been growing various different resources to try and find the best way to wire up an RGB LED Strip to the Spark Core. Since it’s such a new device, I haven’t come across anyone who has shared their success.
I’ve come up with the diagram below, which is based on the Arduino design by Jerome Bernard (although I did pick up a resistor wiring mistake on his green and blue MOSFETs).
I wanted to share this with the community here and get some input on the design. Will it work? Should I make any amendments to the design? The MOSFET’s I’m planning to use are the N-Channel MOSFET 60V 30A from SparkFun and the RGB LED Strip is a simple one I have ordered from eBay which has simple +12vRGB pins.
Looks like it should work, I don’t see a problem anyway
The only suggestion I’d make is hook the gates up to PWM capable outputs (A0, A1, A4, A5, A6, A7, D0, D1)
Depending on how much current you are planning on running to this strip, you may want to run your high power connections off the breadboard, and just tie the ground of all FETs to the breadboard so that a Vgs signal can be created properly referenced to the source pin of the FETs. Also the Spark is only capable of 20mA output to drive the gates, but since these are low gate capacitance FETs you will probably be fine.
Look for RGB LED strips that use the LPD8806 chip. You feed it high current (depending on how long your strip is). You control it with 2 simple I/O lines. Mine is 52 LEDs per meter and sold for $30/meter. Documentation is flaky so I had to just play with it. Now working so well that I’m considering getting 40 ft to encircle the whole room. Initially ran it with a PIC. Worked fine but not enough memory for buffer. Now using Propeller with 32K mem.
Thanks BDub – indeed the FET’s I purchased seem to have a good rep among the low power miro-arduino community. The blue LED wiring should definitely be to #4, thanks for noticing my mistake.
I’m planning on powering about 1-2 meters of strip per device, so am thinking that doing it on the single breadboard should be OK, but thanks for your tip. I’ll certainly keep it in mind when I look at doing some stuff around the house.
Hey Don – because these are going into a single-colour light box project, the basic strip will suffice, and much cheaper to wire up. Here’s a link to what I’m trying to achieve.
I’m not sure if I’ll use the Spark as the final core, as I’m thinking a simple Ardiono based DMX controller could do fine, but the Spark gives me an easy way of prototyping the solution to make sure it will work before we start building them all.
This is a crude script I wrote that should flash the onboard LED at D7, and in turn turn on each colour in the RGB strip. D7 flashes correctly, but the strip does nothing. No idea if it is my wiring or script that is the problem… when you get your Spark I’ll be interested to see how you get on… hopefully better than me.
You have the BASE and COLLECTOR of each Darlington NPN transistor flipped. Should be like this:
This code:
digitalWrite(BLUE, 256); // #1 you have two blues here as well
delay(1000);
digitalWrite(BLUE, 256); // #2
delay(1000);
digitalWrite(GREEN, 256);
delay(1000);
Thanks so much, BDUB. I’ve created the BASE and COLLECTOR pins and also made sure I’m using PWM outputs now for my colour outputs. With those changes, I get a very small faint RED led on every section of the RGB, but nothing else… from the RGB strip so I guess I have something else wrong.
I’m a bit concerned I’m hijacking Jeff’s thread so I’ll look and see how Jeff gets on and create a new thread later if I need to.
Thanks @Jeff. Still no luck. I’m totally new to electronics so I guess I’ve missed something. I’m guessing the problem is one of the two things…
The power I’m using is no high enough voltage to power the RGB strip (I’m using the VIN pin on the Spark rather than an independent 12V power supply. I’ve cut a very small section (about 4 inches) of RGB strip so assumed the draw would not be high enough to cause an issue… I’m assuming, perhaps incorrectly, if I were down on power I should at least some attempt at activity.
My RGB strip is faulty. The only thing I get on it now I changed the base and collector pins around is a very small red led, that never changes… here’s a picture…
Ah, @Happy, I would guess your LED strip requires 12V. My understanding is that the VIN pin is 5V whilst VCC is only 3.3V. Either way, this would not be enough for a 12V strip and would explain why it’s not working. I’m actually surprised that it hasn’t drained the Spark’s supply!
The reason you might be getting a tiny bit of red is that the red, green, and blue components of the RGB LED usually have slightly different power draws each.
What kind of transistors are you using? If they’re MOSFET’s similar to the ones I linked in my first post then try using the second circuit I posted and see how you go. If you’re using just a different transistor you may need to put another resistor between the PWM output on the Spark and the base (somewhere between 100-220 ohm depending on the transistor I believe).
If you want to check whether your strip is OK or faulty, simply hook up a 12V power supply to each of the contacts on the strip. As you connect the [-] line to [R] or [G] or [B] you should see it light up in that colour.
I’m using TIP120 Darlington transistors but I guess its the power supply. I’ll test with a 12V today, thanks again. What do you prefer to use as your external 12v power supply?
Hey folks, I’m working on a project for under cabinet lighting and I am planning to use this to up convert the power so that I can run up to 210W or 6A per channel, thoughts?
@srfnmnk, that module needs another module (LS-PWM-6A) to work. You will also need a 12v or 24v power supply that can provide the max 210W. What exactly are you trying to achieve with the lighting? Will you be using 12V lighting strips and dimming them?