-1

I would like to control power to Arduino B from signal of digital pin from Arduino A.

I use IRFZ44N MOSFET as switch and +12V DC source. The Arduinos have common ground. The connection is:

  • Gate: signal from Arduino A (+5V or 0V)
  • Source: +12V
  • Drain: Vin of Arduino B

At this settings Arduino B is powered regardless of the value on the gate. What am I doing wrong and how should I change the settings to get the desired result? I know I misunderstand how the transistor works, please show me the correct approach.

closed as off-topic by VE7JRO, Juraj, MichaelT, sempaiscuba, esoterik Jun 20 at 1:45

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about Arduino, within the scope defined in the help center." – VE7JRO, Juraj, MichaelT, sempaiscuba, esoterik
If this question can be reworded to fit the rules in the help center, please edit the question.

  • share your schematic here and sketch using to control the gate voltage. – Vaibhav May 26 at 8:54
  • 2
    That mosfet has a body diode between the Source and Drain. So this diode will always let current though, no matter what the voltage is at the Gate. That N-channel mosfet isn't ideal for high-side switching. It would require additional circuitry, and even an extra power source as far as I can see. It's a lot easier to do low-side switching. That is; switching the GND instead of 12V. – Gerben May 26 at 14:27
  • @Gerben you mean to connect +12V directly to the Vin of Arduino B, Source of the N-MOSFET to ground and Drain to GND pin of Arduino B? Can the signal from Arduino A to the Gate switch the power correctly then? – Jan Turoň May 26 at 16:56
  • Yes, that's what I meant. But you have to be careful if you have any other connections between the two Arduinos (for example a wire between TX and RX of the two Arduinos). – Gerben May 27 at 15:01
  • @Gerben indeed, I just fired up two GPIOs: to set the pin to LOW and close the transistor gate was not the brightest idea. Is there any simple solution to prevent damage when the GND pin accidentaly disconnects? – Jan Turoň May 27 at 15:34
3

You have an N-channel MOSFET. That is not suitable for switching the 12V supply of an Arduino.

Instead you need a P-channel MOSFET which has the gate pulled up to 12V using a resistor, and then an N-channel logic level MOSFET which is used by the Arduino to pull the gate of the P-channel MOSFET LOW to turn it on.

Something like:

schematic

simulate this circuit – Schematic created using CircuitLab

When the GPIO is HIGH it turns M2 on. This pulls the gate of M1 down, turning it on. When GPIO is LOW, or not actively being driven (thus being pulled down by R2), M2 is off. This allows the gate of M1 to be pulled up to +12V by R1, switching M1 off.

  • Thank you for the nice design. Would it be possible to pull the M1 gate to just +5V and open it by writing LOW to GPIO? (Without M2) – Jan Turoň May 26 at 15:27
  • No. That is why you have m2 in the circuit. M1 has to be pulled to 12v. That's how a MOSFET works. – Majenko May 26 at 15:28
  • @JanTuroň A P-channel MOSFET's "threshold" voltage is the voltage of the gate below that of the source. It's listed in datasheets as a negative voltage. With the source at 12V the gate has to be at the source voltage to be fully off, or below 12V minus the threshold voltage to be on. You can turn it on, but never off, if you can't get the gate up to (or very near) the source voltage. – Majenko May 26 at 19:41

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