Basic Power: 12v LED Strip, 5v Arduino

Hi guys, this is for a last minute halloween costume, so any advice is greatly appreciated! I am an experienced programmer (C, Javascript, PHP), but relatively new to arduino. I have successfully worked with buttons, and simple LED lights.

I have a 12v 3m LED strip which I'd like to control with my Arduino Duemilanove, and I'm curious about power.

What's the best/safest way to power this, and how would I wire that, basically? Every project I've done up until now can just use the basic 5v power.

To complicate things further, how would I power/control FOUR of these with one Arduino?

I'm using these LEDs
http://www.ebay.com/itm/5M-RGB-150LEDs-12V-36W-Flexible-LED-Strip-5050-Light-44K-Remote-Controller-/181001916763?pt=US_String_Lights_Fairy_Lights&hash=item2a248e115b

And this tutorial

Which seems about right except those LEDs are 5v, not 12.

Thanks, so very much.

Phil

Also, for sake of development, if this is possible, I -do- have external power for the LEDs, and could just "interface with them" if that even makes sense. Use the wall warts for power, and the arduino to control.

I can worry about making it portable later.

You need an external NPN or N-channel transistor.
Arduino drives the base/gate of the transistor.
Transistor sinks current from - of LED strip to ground.
12V connects to + of LED strip.
3-color - need 3 transistors.
This shows a 74HC595 shift register driving the transistors, can be driven from arduino pins also.

A logic level N-channel low Rds part like this would work well.

First, thank you very much for taking the time to respond!

Second, I think I got the right kind of NPN transistor (I bought a few), and I currently have the emitter, wired to the GND of my arduino board, and the base is going through a 1k Resistor to a digital pin out.

I'm not really sure where to connect it to the RGB strip. As I mentioned the RGB strip is powered, and the only four connectors I see on the segments are R, G, B, and 12V+.

So I'm not sure where to connect the collector...

I've attached pictures of a segment of the strip, as well as the wiring that i can splice into.

Thanks, again,
Phil

I got it! Thanks so much!

Collector's connected to the R, G, B pins?

Yep! The other problem I was having was in the way I was getting power, I was sorta scared of these ac adapters and did some hybrid thing where I was 'splicing' into that line. I finally abandoned them altogether and used the tip/sleeve of the actual wall wort itself. Worked like a charm!

Now I have a WHOLE NEW problem which isn't related to this, so maybe not right for this forum but I'll throw it out there just in case:

I have a Sensor(maxbotix) and I want it to change the colors on the LED based on a range from the sensor. I have it working pretty swell except it's a little glitchy. I've tried a few "averaging" algorithms, but the Maxbotix rep said DONT AVERAGE (http://arduino.cc/forum/index.php/topic,20920.0.html), so I'm using a "Simple Mode Filter", but even that still has some occasional spikes. I'm sure it's something with my algorithm.

void setup() {                
  // initialize the digital zpin as an output.
  Serial.begin(9600);
  pinMode(redPin,OUTPUT);
  pinMode(anPin,INPUT);
  pinMode(led, OUTPUT);  
  oldVolt = analogRead(anPin);  
}

// the loop routine runs over and over again forever:
void loop() {
 
  anVolt = analogRead(anPin);
  difference = anVolt - oldVolt;

  if (difference == 0 )
  {
   
    oldVolt = anVolt;

    // This converts the scale from the  pulse (11-60)
    // to Analog (1-220)
    
    misc = anVolt - 11;
    misc = misc / 49;
    misc = misc * 220;
   
    lightLevel = misc;
 
    analogWrite(redPin,lightLevel);
    delay(50);
  }else{
 //  Serial.print("Bad Difference! ");
 //   Serial.println(difference);
 //   delay(70);
    oldVolt = analogRead(anPin);
  }
  
}

What do you want it do?

Well, I'd like the light to change, smoothly, as a person gets closer or further away from the sensor. I dug around and found a sorting/median algorithm which makes it work a bit better.

If anything, I think the real situation is that it's "too good"... meaning if a person is 10.5" away vs 10.6". it'll register that as a change, and "flicker" a bit towards it, and no one is ever completely still. I think in order to get it to be perfectly smooth I'd have to make it a little less sensitive to the change in distance, maybe by rounding somewhere or using a slightly different scale? So instead of having 50 steps (11-60), having 10.

No wait that won't work, I think I'd also need an algorithm for "fading" between levels, and use THAT instead of actually plugging in the hardcore level, that way the lights would never be told to go

analogwrite(pin, 10);
analogwrite(pin, 20);

it would just say

fadelight(20);

and keep track of the current value, and incrementally analogwrite up (or down) to the submitted value.

I'm thinking out loud here but does that seem sensible?

I think I'd just go for ultra responsiveness:

void loop() {
 
  anVolt = analogRead(anPin);  // read 10 bit value
  analogWrite(redPin,(anVolt>>2)); // set PWM to 8-bit value
  
}

OOH! I'll try that after I solve my next problem:

My transistors get SUPER hot. Like, within seconds, hot to the touch, have to use a tool to remove from the board.

I'm not great at Electronics/Math V=ir and all of that.

But I do know that it's a 12volt LED Strip, currently pulling power from a 12volt wall wart which is rated at 2A.

and I currently have a 100 Ohm resistor between the Collector and the Arduino, and the individual color channel goes directly to the Collector, and the ground goes directly to the Emitter.

I have two primary types of transistors to choose from

2N 3904 in a T0 case
-- Vceo 40 v
-- Vcbo 60 v
-- Vebo 6 v

2222
-- Vceo 60 v
-- Vcbo 30 v
-- Vebo 5 v

http://www.fairchildsemi.com/ds/2N/2N3904.pdf
http://www.fairchildsemi.com/ds/2N/2N3904.pdf

Any thoughts?

Okay, so those strips are like 20mA every 3 LEDs.
I think you get probably 12 LEDs/foot, and you have 3+ feet, so 12 or 13 groups?
Gotta be drawing 360+mA?
2N3904 is only good for 200mA, 2N2222 probably more, you posted the '3904 link twice.
I'd get some beefier transistors, TO220 cases (kind with tab you can put a heatsink on if needed), or logic level, low Rds, N-channel MOSFETs.

Again, thanks for acting as my personal angel right now. I don't know how to thank you other than to say thank you,

I think I have a 5 meter strip, and a grand total of 300 LEDs (60 LEDs/m), so that means I'm drawing....2000mA? ((300/3) * 20mA) right?)

I just read this (http://bildr.org/2012/03/rfp30n06le-arduino/) so I think I get the MOSFET transistor, conceptually, the details are still fuzzy. (How can I calculate transistor mA? I'm curious how you knew the 2n3904 was good for 200mA based on that chart.)

Would this work?

Phil

thephilmcc:
Again, thanks for acting as my personal angel right now. I don't know how to thank you other than to say thank you,

I think I have a 5 meter strip, and a grand total of 300 LEDs (60 LEDs/m), so that means I'm drawing....2000mA? ((300/3) * 20mA) right?)

I just read this (http://bildr.org/2012/03/rfp30n06le-arduino/) so I think I get the MOSFET transistor, conceptually, the details are still fuzzy. (How can I calculate transistor mA? I'm curious how you knew the 2n3904 was good for 200mA based on that chart.)

That MOSFET will work at up to 3A without a heatsink, but the circuit has a mistake - there needs to be a 150 or 220 ohm resistor between the gate of the MOSFET and the Arduino pin. Otherwise it will pull over-current spikes from the pin and exceed the absolute maximum ratings...

Would this work?

http://www.radioshack.com/product/index.jsp?productId=2062618

Phil

IRF510 ? Erugh, not a chance. Must be logic level, must have low on-resistance. That device is ancient and fails on both counts.

IRF510 is not Logic Level - its needs 10+ volts at the gate to fully turn on.
Logic Level parts will fully turn on for lowest Rds at ~4.5V.
Standard Level parts need 10+ volts, typically use an NPN as a buffer in front.

How can I tell by looking at them which is which? I apologize for my ignorance but a lot of this looks greek to me. The specs/and details charts of the individual MOSFETs don't seem to indicate whether they are logic level / low on-resistence...

http://www.frys.com/search?search_type=regular&sqxts=1&query_string=MOSFET&submit.x=0&submit.y=0&cat=0

You have to be able to look closer at their specs. Digikey is great for that.
N-channel mosfet
Fets single
logic level
through hole

sort by price. Get past the qty 2000 min buy items, and this part looks pretty good for low price, low Rds, and low gate capacitance.

Thanks for the referral - there's a local electronics place so I wouldn't have to worry about shipping -- do you think any of these might work?

Have to read their datasheet.
For example:

IRF734
FET Feature: Standard
Rds On (Max) @ Id, Vgs: 1.2 Ohm @ 2.9A, 10V
So its not Logic Level, and Rds is pretty high with a Gate voltage of 10V - so it's going to dissipate a lot of power as you put 2A thru it. P=IIR = 2A2A1.2ohm = 4.8W. Toasty! You want a part with Low Rds at Vgs of 4.5V.
Do a similar review of the specs on the others. Digikey is a good place to look things up, may have to look elsewhere as well - I don' see the BUZ11A there for instance.
Standard can be made to work. Logic level needs fewer parts. See Reply #14 for examples of both. Low Rds is key. a 50 milliohm part will only dissipate 22.05 = 200mW. That's a lot cooler and will likely not need any heatsinking.

Sorry to bounce an old thread, but did you ever get this to work? If so, would you be able to post a schematic?
Thanks!