Cutting power to 12V cicuit when arduino is disconnected

Hello everyone!

I quite new to electronics and building circuits but will try to explain as best I can the purpose of my current build and what isn't working.

Purpose:
In short the Arduino is acting as a PWM fan controller that reads inputs from TMP36 sensors and adjusts the PWM signal accordingly. The 4-Pin PWM cable is connected to a Phanteks Universal controller with a built in voltage regulator that is in turn connected to multiple 3-Pin fans that do not support PWM (I know this part can be done by building my own circuit but this felt like the simpler option, at least in the initial version of the project). All this is working great!

Problem:
If the Arduino is disconnected for some reason the PWM connection goes down, but the Phanteks input port is still receiving 12V. This causes the Phanteks to assume PWM voltage is 0 and lowers the voltage of all of the connected fans to their lowest setting. If instead both PWM and 12V are disconnected the Phanteks goes into unmanaged mode and sets all fans to 12V, this is what I would like to happen if the Arduino is disconnected.

Wiring diagram

Theorized solutions:

  • S1 - NPN Mosfet
    This does not seem possible as it needs to be placed as a low side switch and because of the grounding from the Phanteks own input power (left side) the circuit will always be grounded
  • S2 - PNP Mosfet
    This initially looked really promising as it would be placed as a high side switch and would block the incoming 12V on the 4-Pin. However as there is only one power supply and common ground the Gate pin (5v) would receive 12V and fry the Arduino
  • S3 - Relay/Optocoupler
    I am currently leaning towards this solution

Query
Are my above assumptions correct and the Optocoupler is the way to go, or is there a better solution?

Thank you so much for any assistance!

First- please draw a proper schematic. Something drawn in pencil on an envelope is far superior to a silly pretty Fritzing picture.

"However as there is only one power supply and common ground the Gate pin (5v) would receive 12V and fry the Arduino"

?? This makes little sense- Arduinos control 12 and 24 volt loads all the time using Mosfets as switches. And, except for very specific cases, you want all power supply grounds connected together.

But an optocoupler is a foolproof way of isolating the Arduino.

Hi SteveMann,

Thank you so much for your feedback! I will most likely proceed with the optocoupler.

Is this schematic is this any better?

Regarding the PNP Mosfet I'm still very new to all of this but I based my assumption on this:

You need to have two power sources - one for the Arduino, and a separate 12V power source for the motor.
You cannot connect the Arduino's barrel jack to the 12V! This will create a common ground between your Arduino and the 12V power supply. And it would fry the Arduino when you are creating the common VCC needed for this circuit. (With an N-Channel MOSFET you don't have this problem since you want to have a common ground between the power source and the Arduino)

In the circuit you showed, the p-channel mosfet is connected to the arduino pin via an NPN transistor (which is the way to do it). The base of the transistor won't see 12V.

In your first fritzing diagram, you have the input and output of the fan controller both connected to 12V, this cant be right. Surely the output is connected to the fans?

Another solution would be to pull up the fan controller pwm pins using a resistive divider to get the appropriate voltage.

Hi trojanhawrs,

Thank you so much for the suggestion, I will look into it!

In your first fritzing diagram, you have the input and output of the fan controller both connected to 12V, this cant be right. Surely the output is connected to the fans?

The outputs of the controller to the fans are not in the diagram only the inputs.

  • Left side is the 4-pin connector that would usually be connected to a fan header on an ATX motherboard.
  • Right side is the dedicated 12V power for the controller to be able to power the 7x fan outputs

"You need to have two power sources - one for the Arduino, and a separate 12V power source for the motor.
You cannot connect the Arduino's barrel jack to the 12V! This will create a common ground between your Arduino and the 12V power supply. And it would fry the Arduino when you are creating the common VCC needed for this circuit. (With an N-Channel MOSFET you don't have this problem since you want to have a common ground between the power source and the Arduino)"

I disagree with this. Except for really unique conditions, you always want a common ground for all power supplies.

There is nothing wrong with using the barrel jack to provide 6-12V to power the Arduino. I have an Uno that has been powered with a 12V wall-wart into the barrel jack for over a year with no issue. The spec allows for higher input voltage, but I would not ever go above 12V. The precaution is that the regulator on the Arduino has no heat sink and everything over 6V has to be dissipated as heat.

If you already hve the parts, I think the S2 drawing should work fine. In the bipolar NPN transistor, the collector-emitter current is controlled by the base-emitter current. There is no connection from the base to the collector, so your I/O pin will not be exposed to 12V. And your drawing is pretty much the standard way of controlling a power source which has a higher voltage than the processor is running at. So that ought to work.