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

  • What sort of MOSFETs are they? (part numbers) – Nick Gammon Jul 22 '17 at 23:50
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.....

  • 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. – Greenonline Jul 18 '18 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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