Go Down

Topic: Basic LED Strip Wiring - Stuck! (Read 1 time) previous topic - next topic

cbernett

Hello.

I have a simple white LED strip that I've had properly wired and working with code in the past. I went to reconfigure my board and can't get the strip running again. I have a photo of the wiring and the code I'm running. I'm tried it with even simple code to be sure that wasn't it - to no avail. Fairly sure I'm missing something in the wiring - any help would be much appreciated!

Claudia

Code: [Select]


int ledPin = 3;    // back strip connected to PWN pin 5
int FADESPEED = 20;     // make this higher to slow down
unsigned long previousMillis = 0; // last time update
long interval = 8000; // interval at which to do something (milliseconds)
boolean fadeIn = true;

void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}


void loop()  {
// fade in from min to max in increments of 5 points:
  //analogWrite(ledPin, 255);         
  unsigned long currentMillis = millis();
    if(currentMillis - previousMillis > interval) {
     previousMillis = currentMillis; 
     fade();
  }
}

void fade(){
   Serial.print("called fade, and fadein is ");
   Serial.println(fadeIn);
  if (fadeIn == true){
    for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=1) {
      // sets the value (range from 0 to 255):
      analogWrite(ledPin, fadeValue);         
      // wait for 30 milliseconds to see the dimming effect   
      delay(FADESPEED);                           
    }
     fadeIn = false;
  }
  else if (fadeIn == false){
    // fade out from max to min in increments of 5 points:
    for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=1) {
      // sets the value (range from 0 to 255):
      analogWrite(ledPin, fadeValue);         
      // wait for 30 milliseconds to see the dimming effect   
      delay(FADESPEED);                           
    }
     fadeIn = true;     
  }

}

1ChicagoDave

At first glance, I notice that the positive side of the LED strip is marked with "+12V".

Are you attempting to up-convert the Arduino's 5V output to the LED's required 12V by using that 3-prong device? (Transistor/regulator...?) 

What is the part number on that thing, by the way?

cbernett

Yes - that's exactly what I'm trying to do - and even more frustratingly, I had it working. I've tried this exact setup with a regular LED, which of course does not require that much voltage, and that works. My only guess is that somehow I'm not getting enough power to the strip but I don't know what would have changed and I'm matching the setup of other diagrams I've found on the web.

It is a transistor - specifically N-Channel MOSFET 60V 30A. Sparkfun page is:
https://www.sparkfun.com/products/10213

Still agonizing over this - help is much appreciated!
Claudia

Riva

Your image does not seem to match the bildr.org linked from the Sparkfun page. You seem to be trying to power the LED strip with 5V from the arduino, thankfully the forward voltage is to high or something else is wrong or you would probably overload/blow the arduino regulator.
http://forum.arduino.cc/index.php?action=unread;boards=5,67,10,11,66,12,15,17,21,22,23,24,25,29;ALL

cbernett

thanks for your reply Riva - but I'm not sure I follow. are you suggesting that I need to use external power to power the LED strip? as i said - i've had this working by powering it from the 5v on the arduino. my understanding is that the transistor up-converts the power to be enough for the strip. that said - i'm unclear how the board could be affected by trying to power the strip from the 5v, as there is no external power coming in?

thanks for your help!
claudia

Riva


thanks for your reply Riva - but I'm not sure I follow. are you suggesting that I need to use external power to power the LED strip?
Yes
as i said - i've had this working by powering it from the 5v on the arduino.
More likely you powered it from a 9-12V power supply that was also powering the arduino through the jack connector.
my understanding is that the transistor up-converts the power to be enough for the strip.
The MOSFET is just a switch that allows a low voltage (3-5V) to switch on/off a higher voltage (up to 60V for this particular MOSFET). It does not up-convert 5V to become 12V.
that said - i'm unclear how the board could be affected by trying to power the strip from the 5v, as there is no external power coming in?
The 5V pin on the arduino will only supply a small amount of current and if you try and draw to much then something on the board (or your PC if it's powering the arduino over USB) could be damaged.
http://forum.arduino.cc/index.php?action=unread;boards=5,67,10,11,66,12,15,17,21,22,23,24,25,29;ALL

cbernett

ahhh - thank you for this, success! and you're right - i switched the 12v wire from the LED strip to the Vin and it works. that said (and I should know this) but I'm not clear on the difference between the 5v and Vin pins and why one works but the other doesn't. Also - is it a bad idea to be using the Vin pin at all and should just switch to external power?

thanks so much - super helpful!
claudia

Riva


ahhh - thank you for this, success! and you're right - i switched the 12v wire from the LED strip to the Vin and it works. that said (and I should know this) but I'm not clear on the difference between the 5v and Vin pins and why one works but the other doesn't.
Vin is the unregulated voltage applied to the power jack on the arduino so if your using a 12V power supply it will be 12V. 5V as it's name implies is the output of the arduinos 5 volt regulator.
Also - is it a bad idea to be using the Vin pin at all and should just switch to external power?
A million dollar question that I'm sure other have views on but I personally always try to derive the power for >5V loads from the power source prior to it being connected to the arduino power socket. Routing a load through the arduino could cause extra heat build-up or damage to the PCB copper tracks.
http://forum.arduino.cc/index.php?action=unread;boards=5,67,10,11,66,12,15,17,21,22,23,24,25,29;ALL

Go Up