common anode 12V+ RGB LED STRIP connections

hi guys, i have a common anode 12V RGB LED STRIP. ive made the connections as follows-

  • only difference is i have used an external 12 v supply ( rather than the arduino +5v & GND ).
  • also i have used 1k ohm resistors ( not sure why.. i just read it somewhere online ).
  • im also using N channel MOSFETS ( TO 220 )

Now the situation is, everything seems to be working fine most of the time, but sometimes the leds jus flicker and dont change color when the code is telling it to. Now i kind of blamed it on my breadboard connections which arent very sturdy, but im also wondering if these glitches are happening because im using the wrong resistors or MOSFETS ? i just want to be sure that my circuit connections are absolutely perfect, so could anyone guide me on that?

also i came across some projects which used heat sinks for the transistors. is that necessary??

Most RGB strips are in fact, common anode - it does make it easier to control them with common N-channel FETs or NPN transistors.

You have not specified what type of FETs you have used - this is important. If correctly chosen "logic level" FETs, they should not require heatsinks for reasonable lengths of strip. 1k resistors are fine.

May be as well to post your code.

ok honestly, im not sure what FETs these are. ive attached a pik of the data sheet.

as for the code.. here it is -

#include <Servo.h>

Servo myservo;

char val; // Data received from the serial port
int greenPin = 11;
int redPin = 10;
int bluePin = 9;


 
 void setup() {
   
   Serial.begin(9600); // Start serial communication at 9600 bps
   pinMode(greenPin, OUTPUT); // Set pin as OUTPUT
   pinMode(redPin, OUTPUT);
   pinMode(bluePin, OUTPUT);
   myservo.attach(8);  // attaches the servo on pin 8 to the ser
   myservo.write(0);
   analogWrite(redPin, 255);
   analogWrite(greenPin, 220);
   analogWrite(bluePin, 0);
 }
 
 
 
 void loop() {
       
   if (Serial.available() > 0){ // If data is available to read,
     val = Serial.read(); // read it and store it in val
     
     if (val == '0') { // change color to BLUE
       analogWrite(redPin, 0);  
       analogWrite(greenPin, 0);  
       analogWrite(bluePin, 255);  
    
       myservo.write(180); // 
       delay(1000); // turn servo back and forth 180 degrees, ONCE
       myservo.write(0); // 
     } 
     
     else if ( val == '1') { // change color to RED 
       analogWrite(redPin, 255);
       analogWrite(greenPin, 220);
       analogWrite(bluePin, 0);
     } 
    
     else if ( val == '2'){ // change color to GREEN
       analogWrite(redPin, 0);
       analogWrite(greenPin, 255);
       analogWrite(bluePin, 0);
     } 
   
   }
   
 }

thanks

OK, the next page of the datasheet gives the gate threshold voltage as minimum 2, maximum 4V and the graphs on the next page suggest that it will satisfactorily conduct a few amps at logic voltages.

I cannot spot any clear concerns with the code so my only concern would be whether you are expecting too much from the timers, but that is an area with which I have no experience at this point. There you go!

sorry but i dont know what you mean by timers :frowning:

either ways thanks a lot!! what im going to do is solder all these connections on a tag board and hopefully my led strip should stop acting funny when the connections are tight