I have a project involving a LED strip.
LED strip is a 12V with 2835 smd. The Strip is connected to an external 12V AC source.
LED strip on/off is driven by a digital pin from an Arduino Uno Rev2 through a N-Channel MOSFET (IRL3803). Everything is triggered by a push button on a digital input pin.
Now everything works as expected but the only thing is when i turn the power on, the LED strip lights up for 2 or 3 seconds and then switches back off. Then everything runs ok : i can turn the strip on and off with the button.
Seems like there is some current driving the mosfet at boot-up.
Any suggestion to fix this ?
See attached schematic
PS : i have very old and basic knowledge in eletronics.
Well the code seems pretty straight forward, but here it is just in case :
const int buttonPin = 13;
const int ledMosfetPin = 0 ;
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output:
pinMode(ledMosfetPin, OUTPUT);
digitalWrite(ledMosfetPin,LOW);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledMosfetPin, HIGH);
} else {
// turn LED off:
digitalWrite(ledMosfetPin, LOW);
}
}
Yeah that did the trick ! Didn't know the Rx/Tx function would cause any issue.
I think i would have encountered some terminal and program uploading issues as well.. ?