Led Strip arduino analogWrite problem!

Hi,

I recently got an Arduino Uno, and since im a beginner, i decided to do something fairly simple and connect a LED Strip to it that would light up at different levels of brightness.

The problem i stumbled upon is, even if the LED Strip is off during the loop, 2 leds in the middle of the LED Strip always stay on!

Second problem is, even if i got the code to start from the lowest brightness to the highest, it runs backwards (highest to low).

LED Strip i have is 5M of 3528 Waterproof 12V LedStrip!

And here is the code:

// Pin 8 has an LEDstrip connected!
int ledStrip = 9;

void setup() {                
  // initialize the 9 pin as an output.
  pinMode(ledStrip, OUTPUT);     
}

void loop() {
  analogWrite(ledStrip, 100);
  delay(2000);
  analogWrite(ledStrip, 200);
  delay(2000);
  analogWrite(ledStrip, 255);
  delay(2000);
}

What am i doing wrong or is possibly the faulty strip?

How is the strip wired to your Arduino?

groundfungus:
How is the strip wired to your Arduino?

Positive wire of the strip is connected to the Vin on the arduino, and negative to the pin 9.

Im powering arduino through the power jack with the 12V adapter.

So you have probably fried the Arduino pin. They can only sink 40mA, that is about enough for two LEDs.
You need to use a transistor or FET to switch the large current from the strip. Oh and use another pin you screwed that one.

Grumpy_Mike:
So you have probably fried the Arduino pin. They can only sink 40mA, that is about enough for two LEDs.
You need to use a transistor or FET to switch the large current from the strip. Oh and use another pin you screwed that one.

Well thats what i get when not consulting the manual -_-.

Is there way to check if the pin is by any chance still alive?

12V LED strips, the 12V will fry the IO pin. If there are more than 1 3-LED segment connected, that will fry the LED pin. May or may not be immediate.
If the uC feels warm or hot to the touch, it is already damaged.

Well thats what i get when not consulting the manual -_-.

Manual? Datasheet says in no uncertain terms:

Absolute Maximum Ratings*

*NOTICE: Stresses beyond those listed under “Absolute
Maximum Ratings” may cause permanent damage
to the device. This is a stress rating only and
functional operation of the device at these or
other conditions beyond those indicated in the
operational sections of this specification is not
implied. Exposure to absolute maximum rating
conditions for extended periods may affect
device reliability.

Voltage on any Pin except RESET
with respect to Ground …-0.5V to VCC+0.5V
DC Current per I/O Pin … 40.0mA

ViTALiTY:
Is there way to check if the pin is by any chance still alive?

Just put an LED and resistor on the pin and try and blink it.

ViTALiTY:

groundfungus:
How is the strip wired to your Arduino?

Positive wire of the strip is connected to the Vin on the arduino, and negative to the pin 9.

Im powering arduino through the power jack with the 12V adapter.

If you didn't fry your arduino, you definitely fried the pin. If it's not smd, order a new chip. 5m of 3528 requires 12v and draws up to 5A or more depending on what color you have and how many LEDs are populated on the strip. You definitely will need a MOSFET transistor since your pins will only output 5v 40ma. If your chip is smd, or to get by until you get a new one, switch to a different pwm pin, but make sure you wire the MOSFET in before you do it. They are about $2.50 at Radio Shack.