LED strip dims but does not go off

Im a beginner, I built my first project - to drive a LED strip on my RC submarine project.

Using Arduino nano, I do three things - learnt from other examples

  1. interpret the 40MHz receiver signal to switch on and off the LED-strip (as well as pin 13 on the nano)
  2. use MOSFETs to control the colors of the 12V battery powered LED strip
  3. measure remaining battery power and change color when below a threshold.

The software seems to work - the LED goes bright and off and color changes when below voltage
BUT instead of ‘off’ the LEDs dim. I’ve seen other reports like this but did not recognize good solution. I tried varying the pulldown resistors between 1k and 100k, no effect. I use three IRLB8721.

/*RGB strip control from Futuba 40 MHz receiver

*/
#define RED_LED 6
#define BLUE_LED 5
#define GREEN_LED 8
#define Voltcheck A0 //volt controle pin

int gBright = 255;//brightness setting during test and operation
int rBright = 255;
int bBright = 255;
int delaytime = 1000;//test time individual LEDs
int ch7; //40 MHz channel to switch on/off RGB strip
int LED = 13;//assign LED on nano
float volt;//input signal from battery circuit
float voltage;//calculated voltage

void setup() {
pinMode(7, INPUT);//input channel from 40 mHz receiver
pinMode(LED,OUTPUT);
pinMode(GREEN_LED, OUTPUT);
pinMode(RED_LED, OUTPUT);
pinMode(BLUE_LED, OUTPUT); 
pinMode(Voltcheck, INPUT);

Serial.begin(9600);  

TurnOn();//run testing program once

}
void TurnOn() {
  digitalWrite(LED,LOW);//switch nano LED off
  
    analogWrite(RED_LED, rBright);
    delay(delaytime);
    analogWrite(RED_LED, 0);
  
    analogWrite(BLUE_LED,bBright);
    delay(delaytime);
    analogWrite(BLUE_LED,0);
  
    analogWrite(GREEN_LED,gBright);
    delay(delaytime);
    analogWrite(GREEN_LED,0);
}
void VoltRead(){
    volt = analogRead(Voltcheck);//read voltage on pin A0
    voltage = volt * 11.0*5.0/1023;
    Serial.print("voltage: "); Serial.print(voltage);Serial.println();
}    
void loop() {
    
 VoltRead();
 
 if(voltage < 10){//if voltage below 10V then make LED red irrespective of ch7 position
   analogWrite(RED_LED,rBright);
   analogWrite(BLUE_LED,0);
   analogWrite(GREEN_LED,0);
   digitalWrite(LED,HIGH);//blink nano LED when power too low.
   delay(100);
   digitalWrite(LED,LOW);
 }
 else{
     ch7 = pulseIn(7, HIGH,25000);//read pulsewidth of channel 7
     if(ch7>1500){
      analogWrite(RED_LED,rBright);
      analogWrite(BLUE_LED,bBright);
      analogWrite(GREEN_LED,gBright);
      digitalWrite(LED,HIGH);
     Serial.print("switch: "); Serial.print("AAN");Serial.println();
    }
    if(ch7<1500){
      analogWrite(RED_LED,0);
      analogWrite(BLUE_LED,0);
      analogWrite(GREEN_LED,0);
      digitalWrite(LED,LOW);
     Serial.print("switch: "); Serial.print("UIT");Serial.println();
    }
}
delay(100);
    }

sorry for poor schematic - its a big learning curve....

D8 is not an analogWrite() controllable pin. 3,5,6,9,10,11 are the pins that analogWrite() supports.

#define GREEN_LED 8
analogWrite(GREEN_LED,gBright);

Try disconnecting the mosfet gates from the Arduino pins. Does the strip go off? If not, connect them to ground. If that does not work, post a schematic, and some bright, sharp pictures of your circuit so we can clearly see every wire and component.

Thanks for the quick replies!

Changed output 8 to 7 - this did not solve if

I did as PaulRB suggests, and the LEDs did NOT go off on disconnecting the gates from the Arduino.
Then grounded each in turn which did let that LED go off. Not sure how to fix that.

here is a picture of the circuit. pins 23-25 are where the LED strip attaches.
The resistors to ground are 100k, but I tried 10k and 1k too.

Thanks Freek

LED strip fritzing.pdf (1.38 MB)

the LEDs did NOT go off on disconnecting the gates from the Arduino.
Then grounded each in turn which did let that LED go off.

I think that means your pull-downs are not working. 100K is too high but 10K should have worked fine. With no power connected, measure the resistance from mosfet gate to ground connector for the 12V battery. That should read the same as your pull-down resistor value, but I suspect it will read open-circuit.

The measured resistance over the first gate to ground is the same as the pulldown resistors, the LEDs are on with the gate not connected to Arduino, and they dim a lot, but do not go fully out on grounding the pins. I cannot think of anything else than that the mosfets might be defective (due to soldering?).

"Changed output 8 to 7 - this did not solve if"
3,5,6,9,10,11. 7 is not in that list.

Is this that you are trying to wire up? Your fritzing picture does not show that.

I currently have 8 N-MOSFETs controlling 8 LED strips.
An Arduino controls 74HC595 shift register to control the gates. I could add some more screw terminals and drive the gates directly as well.
(Apparently these LED strips I bought years ago did not age well, not all LEDs are turning on, at least not all the time, so I haven't secured them yet. The Reds do, the Greens do, the Blue and Yellow are kind of iffy.)

The resistors are just there to keep the gates from floating and possibly turning on while the Arduino is being reset; the IO pins default to Input during that time and until your sketch declares them as outputs, and then turns them on.

Try the standard example blink sketch, but instead of setting one pin high or low, set all 3 pins connected to mosfets to high/low. Does the strip go off?

Sounds as if the grounds are not actually connected together on that protoboard!

Ok I went back to the breadboard with new components - and on the breadboard it now works as needed ! Tomorrow I'll try to solder a new protoboard - I'm not sure if my limited soldering might have damaged a mosfet or nano - as I cannot spot or measure a difference between the breadboard and protoboard - but I do get each pin soldered in 5 seconds or so. Seems best to me to keep the breadboard running for the moment and solder a new set. Thanks everyone for the help - great community.

What iron are you using? What power? Temperature controlled? Bit size?

High power irons with large bits and no temperature control are more likely to cause damage to components. A low power (< 25W) is safer, if there is no temp control.

Hi Paul, Im using a weller WHS40 station with temp control usually at 350C and a 2 mm bit.
I used that to solder the new Arduino nano to its "legs" - which I used in the breadboard.

It all worked, I could switch LED strip on and off with the transmitter and the testsequence of the LEDs also worked.
Today resumed testing and somewhere along the line the arduino loses connection, reset button does nothing, disconnecting and reconnecting to power sometimes seem to make the sketch run partially for a few seconds but its as if the arduino lost its program. Tried to reload the sketch and get following error . What does this mean? the arduino worked and then it did not.....?

Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:/Users/Freek/.arduino-create/arduino/avrdude/6.3.0-arduino17/etc/avrdude.conf"
Using Port : COM5
Using Programmer : arduino
Overriding Baud Rate : 57600
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xfb
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xfb

That means the pc cannot get a response from the nano when it tries to upload the sketch. Try a different usb cable.

Also check your soldering on the back of the board for solder bridges. Even a tiny speck of solder in the wrong place can cause a short circuit which could explain the behaviour of your circuit.

Check for "dry joints" too. Each solder joint should look smooth & shiny. Any that look dull or lumpy, remove them with a solder sucker and re-solder the joint.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.