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.


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

void loop() {

See circuit below:

enter image description here

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

3 Answers 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() {
  delay (1000);
  delay (1000);

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

Low-side driver


The following circuit diagram works perfectly.

Mosfet circuit


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.....

  • 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. 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.