0
\$\begingroup\$

In this tutorial,

enter image description here

The author makes this weird(to me apparently) connection of 5V pin of arduino to 12 V power supply, and explains itself by:

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)

However, I really did not understand why connecting grounds of two power supplies together and then applying HIGH or LOW to the Gate of the p-channel MOSFET does not do the trick.

So, a little bit help on understanding what is going on would be appreciated.

\$\endgroup\$
2
  • \$\begingroup\$ @jsotola If the connection stays same with the picture, it will be +12 V, and I understand that it will harm the MCU. My question was actually about removing that connection between +12 V terminal of the battery and +5V pin of the Arduino. But, you are right to make this comment because I said that "I did not understand the risk of........", I should edit it. \$\endgroup\$
    – muyustan
    May 9, 2020 at 1:46
  • \$\begingroup\$ change your thinking .... a GND is actually a chosen reference point ... choose the top red line as GND ... the arduino barrel jack will have GND and -5 V .... the arduino pin6 will output either a 0 V or -5 V .... the motor has -12 V applied to one side and GND switched by the MOSFET on the other side \$\endgroup\$
    – jsotola
    May 9, 2020 at 1:51

2 Answers 2

2
\$\begingroup\$

Based on your clarifying comment after your posted question, I think that what you are asking is why you can't connect this differently, so that instead of tying the +5V and the +12V lines together, you tie the grounds together, and then just drive the MOSFET gate with the Arduino HIGH or LOW output.

If that understanding of your question is correct, then the answer is that the MOSFET will never be turned off, because the source terminal will be at +12V and the gate terminal will be at +5V at the highest. So you will have at -7 Volt Gate-Source voltage even when you are trying to turn off the MOSFET, and it will always be on.

\$\endgroup\$
1
  • \$\begingroup\$ yes, I missed that one, thanks \$\endgroup\$
    – muyustan
    May 9, 2020 at 13:50
1
\$\begingroup\$

This is a valid although not usually recommended approach.

As JSTOLA notes, "ground" is simply the name for a reference point (or for a planet :-) ).
Here 5v+ and 12V+ are common "ground".
Arduino 5v- is 5V below this common "ground" and
Load 12V- is 12V below this common "ground".

Arduino high = 5v+ = 12V+ = "ground"
= MOSFET gate off.

Arduino low = 5V-
= MOSFET gate on

At no point is the Arduino exposed to voltages outside its voltage ratings. This is an entirely functional and workable arrangement. It involves the connection of power supplies in ways that are unfamiliar to many and risks the accidental connection of eg -ve supply rails to each other, mit spitzen sparken and maybe magic smoke. How much this matters depends on circumstances.

This arrangement ONLY works if the 5V and 12V supply do not have their negative connections commoned - as the circuit originator notes.
12V- is 7V below 5V-.

\$\endgroup\$

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.