Go Down

Topic: led strip remains on (Read 2873 times) previous topic - next topic

bricoleboy91

May 30, 2016, 10:47 pm Last Edit: May 30, 2016, 10:58 pm by bricoleboy91
Hi all,

I am new to arduino and electronic !!!
I have a white led strip with a 12V power supply.
I have a MOSFET that I want to control from my arduino to turn on/off my led strip with various intensity.
So I did the following :
- 12V+ is connected to led strip +
- left pin of MOSFET is connected to analog pin 5 of arduino.
- middle pin of MOSFET is connected to led strip -
- right pin of MOSFET is connected to ground of arduino
- 12V- is connected to ground of arduino.

I wrote a sketch which does analogWrite(5, 150) and then analogWrite(5,0) to turn on then turn off my led strip.
Everything works properly except that when I turn off the led strip it always remain lighted a little.
I assume that I should put a pull-down resistance but I didn't understand where.
Could you please help me?
Thanks a lot.

Grumpy_Mike


It is hard to say what your connections are from this photo.

What sort of mosfet is it, the pinout can change with different devices.

It is normal to include a 10K resistor between the gate of the mosfet and ground.

bricoleboy91

Hi,

I have uploaded a new picture with some labels to better explain.
My MOSFET is :
Mosfet STMicroelectronics STP16NF06L Canal N box type TO-220AB I(D) 16 A U(DS) 60 V.
It does not appear on the picture but I already tried to add a 10K resistor between gate and ground.
Thank you.

larryd

What is the output voltage on pin 5 when it is off?
Have you tried another MOSFET?

Quote
I wrote a sketch
Also a good idea to show us the sketch ;)

Use the </> icon in the posting menu to paste your code.
[code ]code goes here[/code ]

.
No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

bricoleboy91

Hi,

I have 15 identical MOSFET. I just tried and in fact I have this behaviour for 10 MOSFET. With the 5 other ones the led strip completely turns off. Does it mean that 10 MOSFET are broken? They are all new : I just received them last week.
About the sketch you are right :), it just does the following:

int pinStep1 = 5;

void setup() {
  pinMode(pinStep1, OUTPUT);
}

void loop() {
  analogWrite(pinStep1, 150);
  delay(1000);
  analogWrite(pinStep1, 0);
  delay(5000);
}

Grumpy_Mike

Why when you were specifically asked to post the code in code tags and shown how to do it did you ignore the request.

Put the 10K back even though you think it had no effect.

Do you imagin that those labels give any information about anything to those here?

bricoleboy91

Hi,

Sorry but i don't understand the last post. I have posted the sketch, haven't I ?

For the 10K, I added it from gate to ground without changing anything else. Is it the right way to do it ?
But it changes nothing.
I tried with another MOSFET (same reference) and with this one my led strip correctlty turn off completely when asked by the sketch.
Is it a MOSFET issue?
Thanks.


Grumpy_Mike

Quote
I have posted the sketch, haven't I
Yes but you haven't :-

Use the </> icon in the posting menu to paste your code.
[code ]code goes here[/code ]
Have you? This is considered rank bad manners here. If you could have been arsed to read How to use this forum it would have told you. But you were specifically told and you either ignored it or didn't understand it. If the former then you don't deserve any help, if the latter then you won't understand any help you get.

bricoleboy91

Ok I am sorry, I missed the point.

Code: [Select]

int pinStep1 = 5;

void setup() {
  pinMode(pinStep1, OUTPUT);
}

void loop() {
  analogWrite(pinStep1, 150);
  delay(1000);
  analogWrite(pinStep1, 0);
  delay(5000);
}

Grumpy_Mike

Thank you.

Quote
For the 10K, I added it from gate to ground without changing anything else. Is it the right way to do it ?
Yes that is the correct way to do it. It stops stray interference from turning the FET on during the boot up process.

Make sure that you have a good connection. There is no reason why it will not work unless there is something you are not telling us.

bricoleboy91

Honestly I think I forget nothing to say.
As asked in a previous post, I checked the voltage at pin 5. When the analogWrite(pinStep1, 0) is done, the voltage is 0 at pin 5. So it is ok.

My arduino is powered through USB while my led strip is powered by 12V external power supply.
But even when I remove the USB connection, my led strip remains on, with a very small light intensity.

If I just replace the MOSFET with another one having the same reference (<=> same model) then the problem disappear.

Grumpy_Mike

Quote
Honestly I think I forget nothing to say.
Yes I am sure that is right. But there is something that perhaps you don't know, or don't know to say. This is not blaming you in any way, but inexperience robs you of what is relevant and what is not.

So many times problems are solved here which are due to things the original poster didn't know were wrong and didn't mention. We can only look at what you say and the information you give us, and from that information everything should work. Strip boards basically are crap and some are very poor at making reliable connections. I never use them but solder everything up on strip board.

Quote
My arduino is powered through USB while my led strip is powered by 12V external power supply.
You need to connect the -ve of this external supply to the ground of the Arduino, but I think you have done this already.

Quote
But even when I remove the USB connection, my led strip remains on, with a very small light intensity.
That is the specific case the 10K is designed to counter.

Now you might not have a 10K it might be some other value but you might not be aware of this. That is the sort of thing I mean by things you might not know you don't know.

Quote
If I just replace the MOSFET with another one having the same reference (<=> same model) then the problem disappear.
That could be a faulty part, did you get it from a reputable supplier or was it off eBay? Stuff on eBay can come from the manufacturer's reject bin.

larryd

If things work with one transistor but not the other, (repeatedly) then it suggests component problems.

BTW, try a lower value resistor (~470 ohm) just to see if the results change..


.
No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

bricoleboy91

You need to connect the -ve of this external supply to the ground of the Arduino, but I think you have done this already.
Yes this is exactly what I did.

Now you might not have a 10K it might be some other value but you might not be aware of this. That is the sort of thing I mean by things you might not know you don't know.
That could be a faulty part, did you get it from a reputable supplier or was it off eBay? Stuff on eBay can come from the manufacturer's reject bin.
I get it from a known website in France, not on ebay.
I have ordered new set of MOSFET to see if it improves things.
I will let you know.

Thanks all.


Go Up