12V LED Strip - Some Segments Unresponsive?

Hello everyone, I am working on a project that makes an LED Strip respond to music using the MSGEQ7 chip. Forgive me if this a foolish question but I am having an issue where every other segment of the led strip is always on and unresponsive. (i.e. only half of the strip is blinking to the music)

I am using these LED Strips: http://www.gearbest.com/led-strips/pp_161659.html?wid=21

I have followed this guide: http://www.instructables.com/id/Blinking-LEDs-to-the-Frequency-of-Musi/

I followed this fritzing diagram:

except that I have an external 12V 5 A DC power supply plugged into the power rail with the MOSFETs and the 12V lead of the led strip pluged into the positive terminal of that power supply.

I don’t think my strips are faulty because they behave normally when I use the IR controller that they came with as opposed to my arduino.

Here is the code I was testing with:

/* David Wang
   Code that takes audio input from a 3.5mm cable
   and flashes an LED strip based on the frequency
   of the music.

   HUGE thanks to the arduino community
   If you see your code here, I owe you my gratitude


int analogPin = 0; // MSGEQ7 OUT
int strobePin = 2; // MSGEQ7 STROBE
int resetPin = 4; // MSGEQ7 RESET
int spectrumValue[7];

// MSGEQ7 OUT pin produces values around 50-80
// when there is no input, so use this value to
// filter out a lot of the chaff.
int filterValue = 80;

// LED pins connected to the PWM pins on the Arduino

int ledPinR = 10;
int ledPinG = 9;
int ledPinB = 11;

void setup()
  // Read from MSGEQ7 OUT
  pinMode(analogPin, INPUT);
  // Write to MSGEQ7 STROBE and RESET
  pinMode(strobePin, OUTPUT);
  pinMode(resetPin, OUTPUT);

  // Set analogPin's reference voltage
//  analogReference(DEFAULT); // 5V

  // Set startup values for pins
  digitalWrite(resetPin, LOW);
  digitalWrite(strobePin, HIGH);

void loop()
  // Set reset pin low to enable strobe
  digitalWrite(resetPin, HIGH);
  digitalWrite(resetPin, LOW);

  // Get all 7 spectrum values from the MSGEQ7
  for (int i = 0; i < 7; i++)
    digitalWrite(strobePin, LOW);
    delayMicroseconds(30); // Allow output to settle

    spectrumValue[i] = analogRead(analogPin);

    // Constrain any value above 1023 or below filterValue
    spectrumValue[i] = constrain(spectrumValue[i], filterValue, 1023);

    // Remap the value to a number between 0 and 255
    spectrumValue[i] = map(spectrumValue[i], filterValue, 1023, 0, 255);

    // Remove serial stuff after debugging
    //Serial.print(" ");
    digitalWrite(strobePin, HIGH);


  // Write the PWM values to the LEDs
  // I find that with three LEDs, these three spectrum values work the best
  analogWrite(ledPinR, spectrumValue[1]);
  analogWrite(ledPinG, spectrumValue[4]);
  analogWrite(ledPinB, spectrumValue[6]);

Any thoughts or suggestions? Thanks.

Looks like wiring mistakes.

Are those led strips common anode or common cathode? Which fets are you using?

The strips are common anode and the transistors I am using are N-Channel MOSFET 60V 30A : https://www.sparkfun.com/products/10213

The external 12V 5A power supply shares a common ground with the MOSFETs and Arduino. Am I wiring that correctly? I am also using an Arduino Due by the way.

Also, I commented out the line that set the analog reference voltage because I was getting a compiling error. Not sure if that affected anything.

  // Set analogPin's reference voltage
  //  analogReference(DEFAULT); // 5V

Thanks for your help!

Have a look at the schematic in http://forum.arduino.cc/index.php?topic=114705.msg863357#msg863357 (reply #2).

I've just used it with the same fets that you are using for a 4-channel dimmer; I changed the 130 ohm to 220 ohm (found it a little safer) and the 10k is no implemented yet.

Remove everything not related to the fets, write simple sketch and test them individually.

void setup()

void loop()
  // brightness
  static byte intensity = 0;
  // dimming (false) or brightening (true)
  static bool direction = true;

  analogWrite(yourPin, intensity).

  if(intensity == 255)
    direction = false;
  if(intensity == )
    direction = true;

  if(direction == true)


This will fade constantly one pin using PWM. Next test it out with the other pins (one at a time). Once you're convinced that everything works as should, start adding the other components. Keep the debugging statements in place and use Serial Monitor to check the behaviour.

Thank you for your help. I was able to solve my problem by moving the 10k resistors to the gate of the MOSFETs instead of the Drain. My circuit now behaves properly.

Thanks again.