1

I want to turn on 2 bulbs using 2 MOSFETs. The problem is that they both turn on when it should turn up just one light.

Code:

void setup() {
  pinMode(13, OUTPUT);
  pinMode(7, OUTPUT);
}

void loop() {
  digitalWrite(13,1);  
  digitalWrite(13,0);
}

See circuit below:

enter image description here

1
  • What sort of MOSFETs are they? (part numbers)
    – Nick Gammon
    Commented Jul 22, 2017 at 23:50

3 Answers 3

3

Try adding a delay into your loop. In your code pin 13 will toggle very rapidly, much too fast to see it. For example:

void loop() {
  digitalWrite(13,HIGH);  
  delay (1000);
  digitalWrite(13,LOW);
  delay (1000);
}

It doesn't look wired correctly. For an N-channel MOSFET the Source should go to ground, like this:

Low-side driver

0

The following circuit diagram works perfectly.

Mosfet circuit

-1

i prefer you to use relay to control any ac appliance with arduino it very much safe...enter image description here

Just follow this circuit diagram and use 5v relay in your project it will always work fine.....

1
  • I fail to see how this can help. OP is not attempting to control an A.C. appliance, the diagram clearly shows that they are D.C. Also, the OP has no button in their circuit, so that is completely superfluous. Commented Jul 18, 2018 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.