I am working on my first arduino project. I am having a problem while driving an12v LED with MOS Driver Module.
The issue is: the MOS Driver Module light up and fades, but Led remains off.
I've tried 'fading' and 'blink without delay' (only changed the pin), but still the same problem.
The led does light up a couple of days ago. During these two days, after I leave it a while, sometimes led works sometimes not. It's so random.
When I unplug the power supply, the mosfet led stay on for 2 sec then off.
The last time it worked was when I reconnect the arduino DC power port. (I always leave the cable connected to the port, but not powering it). Now reconnect the port makes no difference.
Components:
Power supply: using external 12v power supply to the Arduino.
I am testing the 'fading example', only change the pin:
/*
Fading
This example shows how to fade an LED using the analogWrite() function.
The circuit:
- LED attached from digital pin 9 to ground through 220 ohm resistor.
created 1 Nov 2008
by David A. Mellis
modified 30 Aug 2011
by Tom Igoe
This example code is in the public domain.
https://www.arduino.cc/en/Tutorial/BuiltInExamples/Fading
*/
int ledPin = 5; // LED connected to digital pin 9
void setup() {
// nothing happens in setup
}
void loop() {
// fade in from min to max in increments of 5 points:
for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
// fade out from max to min in increments of 5 points:
for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
}
Not sure that image confirms that they are not connected. I don't think this MOSFET board has an opto-isolator, so I would imagine the GND header pin and the GND screw terminal must be connected on the board.
The power splitter cable may be providing a common ground for the mosfet driver and Arduino, although @lilyyyw did not draw a black line alongside the brown line in their diagram between the splitter and the Arduino.
Take your project apart. Put it back together, without cramming multiple wires into the same connectors. Use terminal strips or strips on the proto board to join multiple wires together, where one wire goes into one connector socket/screw.
Unfortunately, I tried and it didn't behave as expected.
May I ask why need to connect the GND of the MOS to the GND of Arduino, since the GND of the splitter has already been connected to the MOS GND? Thank you.
I tried to avoid cramming multiple wires into the same connectors. (Hopefully clip is fine). And it is still not working. The Mos module lights up but led is off.
Hi,
Can I suggest you disconnect ALL the other hardware and JUST have the LEDs output circuit connected?
And post an image of that, there are too many wires to just test the fade up and down of an LED.
Thanks guys. I tried modifying the code and the circuit. Now the maximum is 40pwm rather than 255pwm. It seems to be the same. Only the first two sec of the first plugin attempt works.
Thank you so much guys. I think I figure this out.
I borrow my friend's multimeter, we found out that the 12v external power plug only provides 7v power, which is enough for uno board but definitely not enough for led. Led is not damaged since it works with my friend's 12v plug. I will get a new plug then.
I truely appreciate everyone's time. Have a nice day!