Despite the fact that I'm pretty new to electronics I'm working on a quite ambitious project which is basically a USB-Midi Controller attached to different devices that send different signals. The common power source is a external 24V Battery which powers a pcb with two buck converters (5V 3A) and a USB Power Delivery controller. The latter powers a USB Hub which powers - amongst other devices - a teensy which is attached to and powers a PCB that mainly serves as user interface with different buttons and faders.

There are also two mosfets on this second PCB which are controlled by the Teensy and serve as switches between the 5V supplies and other devices.

I hope the following graphic will make things a little bit clearer:

simplified block diagram of the project

I was wondering how to build the circuit of the mosfets. In my opinion it's not neccesary to connect Teensy GND and the buck converters ground since basically the minus of the 24V battery is the common reference potential, but people in a Teensy-related forum told me that I have to connect those two because otherwise there would be a chance that the 24V would roast my 3.3V only Teensy.

the two versions of the circuit

I don't fully understand this and I'm wondering if connecting them could lead to a ground loop since theyre connected at two points in the project.

I hope you guys can help me to get a deeper understanding of this matter. Thank you in advance!

  • \$\begingroup\$ What happens if you pull the teensy power cable out of the hub? How is the teensy ground connected to battery return then? \$\endgroup\$
    – scorpdaddy
    Mar 1, 2019 at 19:15
  • \$\begingroup\$ That's true but in this project the teensy would never be pulled out of the hub so as long as everything is fine it is always connected to the battery return. It's not even possible for the user to pull any cables out of the hub. What about my concern regarding a ground loop, is it legitimate? \$\endgroup\$
    – mr_highway
    Mar 1, 2019 at 19:30
  • \$\begingroup\$ While it would create a ground loop, there is nothing stopping you from redoing the grounds into a star pattern instead. Also, depending on "The user would never do that." is a bad design strategy. \$\endgroup\$
    – scorpdaddy
    Mar 1, 2019 at 19:47
  • \$\begingroup\$ I probably didn't make that clear enough: The user is not able to do that unless he takes a screwdriver to open the case. Regarding the star pattern: As far as I understand it, my design is a star pattern since the ground of all the single devices are only connected at the power pcb. If I'm forced to connect the grounds on at the mosfets I honestly don't know how I could redo the grounds into a star pattern, since teensys ground will always be connected to the power boards ground as well due to the usb connection. \$\endgroup\$
    – mr_highway
    Mar 1, 2019 at 20:47

3 Answers 3


There are two issues only one of which you have mentioned.

  1. For current to flow between two circuits there must be a continuous loop path. In this case the Teensy ground MUST be connected to the same ground as the 5 volt power modules that it is controlling (or attempting to).

  2. You have shown N channel MOSFETs. To turn an N-channel MOSFET on the gate must be driven to some voltage more positive than the MOSFET source. Typically the gate needs to be 2 or 3 volts above source ( but it can be as much as 5 or even 10 volts) depending on the device chosen. Special “logic FETS” are available That accepts low gate-to-source Drive voltages but even these will typically need at least 1 volt of Gate Drive relative to source. As the source here is meant to be at 5 volts when the MOSFET is on, the gate needs to be driven to say 7 or 8 volts positive relative to ground to turn it on.

If the Teensy has a 5 volt supply this will not happen. As the gate can be driven to say 5 volts maximum The MOSFET source terminal can only rise to about 2 or 3 lower than the gate, so you will only get about 3 to 2 volts output.

However, as the Teensy has a 3V3 supply, Even if logic MOSFETs were used which needed only one Vault of drive you would still only get about 2 volts of output from the MOSFET.

In order to obtain 5 volts output the choices are either:

  • To use a P-channel MOSFETs with the source connected to + 5 volts and drain connected to output, and drive the gates low to turn them on and to 5 volts to turn them off, or

  • To use a gate driver to drive the gates of the N-channel mosfet to higher than 5 volts when the MOSFET is to be turned on.

  • \$\begingroup\$ Thank you for your answer. Regarding the P-Channel Mosfet: Since the teensy only has 3.3V output, how shall I drive the gate to 5V? \$\endgroup\$
    – mr_highway
    Mar 1, 2019 at 21:37
  • \$\begingroup\$ @mr_highway Read what I said above carefully. With a N Channel MOSFET It's worse than needing 5V Vg - you need MORE than 5V. If you want the source to be at 5V then as Vgs needs to be typically 3 to 5V then Vg above ground and as source is at 5V you need Vg to be 7 or 8 or 10 volts (depending on MOSFET used. | One solution is to use a P Channel MOSFET and to pull the gate low to turn on. There are still issues using 3V3 drive as the FET must be off at Vg = 3V3 = 1.7V below +5V. FETS that meet this spec are available but the circuit must be designed. ... \$\endgroup\$
    – Russell McMahon
    Mar 2, 2019 at 6:38
  • \$\begingroup\$ @mr_highway ... | One way to get a say 12V gate drive is to use a bipolar NPN transistor as a driver . Connect base to +3V3 via a resistor. Drive emitter with Teensy I/O line = Vin. Collector to say +12V via a resistor (say 10k - 100k ranghe). Collector to FET gate. || Set Vin in = 0, transistor on , collector low, FET off. | Vin = 3V3, transistor off, collector = 12, FET on. \$\endgroup\$
    – Russell McMahon
    Mar 2, 2019 at 6:41
  • \$\begingroup\$ McMahon Thank you, one last question: If I would replace the nmos with this (mouser.de/datasheet/2/427/SI7141DP-223663.pdf) pmos and connect source to Vin and drain to Vout, would it work without changing the rest of circuit b)? As far as I understand it, 3.3V at gate would switch the mosfet of, since 3.3V + 2.3V (treshold) > 5V and 0V at gate would witch it on. Is there a fallacy in my considerations? \$\endgroup\$
    – mr_highway
    Mar 2, 2019 at 13:50
  • \$\begingroup\$ @mr_highway You seem to have understood the P-MOS issue well ! :-). Answer: Probably. That MOSFET is nicely marginal, looking like it will work using graphs provided which are usually typical values. Drive the gates via a diode (Anode to Teensy) with a pullup resistor - maybe 100k or even 1 megOhm (gate to source) and it should work well and it MAY be OK without the diode. BECAUSE: Datasheet page 3. Name figs 12 34 56. - Fig 1 shows Vgs >=4v works well. Vgs 3v is poor. When Teensy is high at 3V3 you have 5-3V3 = 1.7V of drive so MOSFET SHOPULD be well off. ... \$\endgroup\$
    – Russell McMahon
    Mar 2, 2019 at 15:53

First of all, your circuit idea does not work. You are using enhancement-type NMOS (as source followers) to provide 5V from a gate drive of 3.3V. That just won't work.

Try either switching load ground, using PMOS (with some additional circuitry), or an integrated load switch to do the switching.

Now, to your actual question.

Assuming that all of your DC-DC converters are of the non-isolated type, yes, it will create a ground loop. But it might be a necessary one.

Given power consumption you will not really know what is the potential between the Teensy and your switches without directly connecting them together. This does mean that some of the ground current will be circulating through the Teensy.

You can avoid this by either:

  • Using isolated DC-DC converters and connecting the grounds together.


  • Using isolators (opto or any other kind) to drive the gates of the mosfets.

You can also manage transients in the ground loop currents by adding common-mode chokes to the Teensy power supply.

  • \$\begingroup\$ Thanks for your answer. It's a bit confusing to me. I tested Circuit b) using this Mosfet: mouser.de/datasheet/2/308/BS170-1118810.pdf on a breadboard and it worked perfectly. What do you mean by "switching load ground"? Maybe the reason for my confusion is my lack of English skills in combination with my lack of electronics skills. ;) Is it about the position of the mosfet in the circuit? \$\endgroup\$
    – mr_highway
    Mar 1, 2019 at 21:17
  • \$\begingroup\$ @mr_highway did you actually measure the voltage on the loads? These should not go any higher than 2V or so, or there is something that is not being shown in the diagram. If you are actually getting 5V on the loads, that means that the Teensy ground is floating at least 3V above the load ground, in which case your load will never receive less than 2V or so and operation will be highly unpredictable. \$\endgroup\$ Mar 1, 2019 at 21:25
  • \$\begingroup\$ No I didn't measure them, but I will as soon as possible. Please correct me if I'm wrong: To switch an N-Channel Mosfet "on" gate voltage must be higher than source voltage. Since pin 4 in my schematic is source, source voltage is 0V, isn't it? \$\endgroup\$
    – mr_highway
    Mar 1, 2019 at 21:33
  • \$\begingroup\$ @mr_highway No. In your circuit, source voltage is whatever voltage is developed at the load. But, regardless of what you may have heard, MOSFETs are not "switches" these can behave as switches but only under the right conditions. Your circuit does not provide such conditions. \$\endgroup\$ Mar 1, 2019 at 21:49
  • \$\begingroup\$ I think (hope) I'm beginning to understand. If I would take the mosfet out of the 5V1 "line" and connect pin 4 to "GND1_source" and pin 1 to "GND1_sink" instead and connect teensy GND to "GND1_source", my circuit would work? \$\endgroup\$
    – mr_highway
    Mar 1, 2019 at 21:58

Your Circuit a) connects only the gate of the MOSFET to the Teensy. So, there is no way to know what the voltage at the MOSFET's source will be with respect to any voltage on the Teensy. So, there is no way to be sure what the gate-to-source voltage will be for the MOSFET...you won't be able to reliably turn the MOSFET on and off. You must have some reference point to establish the voltage difference between gate and source.

There is not enough information to tell whether you might have a ground loop problem if you connect all of the grounds. We don't even know if the grounds from the buck converters are isolated from each other or from the "USB PD Controller". All of your grounds may be connected together whether you like it or not.

If you really want galvanic isolation between the Teensy and the MOSFETs then you should consider using optoisolators between them. Again, not enough information was given to provide more detailed suggestions.


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.