4
\$\begingroup\$

I want to use a MOSFET for high-side switching of the DRV425 fluxgate as it has no enable pin, and has quite a high power consumption (150 mW @ 5V -> 30 mA):

enter image description here

Before the P-channel MOSFET WTM2301 there will be a signal inverter SN74LVC2G04 for reasons not important for my question.

I only have 3.3 and 5 V available on my board and want to switch the MOSFET with a 3.3 V signal. The DRV supply is 5 V. The MOSFET datasheet mentions "P-channel", and from my understanding it can be used for high-side switching, however, the test circuit looks like low-side switching in the datasheet.

Can anybody provide some guidance on the chosen parts/ the circuit? Before manufacturing the board it would be great to get some feedback from experienced people. To be honest, I am confused with the datasheet and not sure this will work.

\$\endgroup\$
3
  • 7
    \$\begingroup\$ Your MOSFET is incorrectly connected. Look at the bulk diode. \$\endgroup\$
    – Andy aka
    Commented Apr 1, 2023 at 9:41
  • 1
    \$\begingroup\$ Your FET's upside down. \$\endgroup\$
    – Hearth
    Commented Apr 1, 2023 at 21:25
  • \$\begingroup\$ Flip the MOSFET, and use a level-shifting gate such as 74HCT1G04. (You may need to use single instead of dual, depending on what the other gate is driving.) \$\endgroup\$ Commented Apr 2, 2023 at 5:16

4 Answers 4

5
\$\begingroup\$

A cheap solution would be the following (NMOS + resistor). If you are ok with some current consumption when the PMOS is ON, you can try it.

Case1: PMOS is OFF

enter image description here

Case2: PMOS is ON enter image description here

You can increase R1 further and reduce current further but should make sure that the current is able to beat the IDSS of M3 and pullup M2 gate to 5V when M3 is OFF. Another potential risk is if there are sharp voltage transients of large magnitude expected on 5V supply, the transistor M2 could turn ON momentarily (when it is supposed to be OFF) if R1 is very high.

A level shifter would not have any current consumption. So, it is definitely better if you can afford it.

\$\endgroup\$
3
  • \$\begingroup\$ Thank you all for your quick answers. So if I understood the feedback correctly you would also prefer (if possible) the Voltage Level Translater solution right? As here: i.sstatic.net/9VZCt.png Yours is also a very nice solution. The MOSFETs M2 and M3 in your example are the same and the WTM2301, right? \$\endgroup\$
    – Maxim
    Commented Apr 1, 2023 at 17:27
  • 1
    \$\begingroup\$ @Maxim, yes, if possible, a voltage level translator performs better. I think you can remove the inverter if you are using the level translator because it seems to have a strong driver. In my scheme, M2 is your pmos WTM2301. M3 is an Nmos. You need to choose a 3.3V compatible logic MOSFET. \$\endgroup\$
    – sai
    Commented Apr 1, 2023 at 17:47
  • \$\begingroup\$ Perfect, thank you very much. I did not explain this, but the signal after the level shifter will be used for two DRVs, where only one will be active in all cases. And in one path there will be this inverter (in the other branch there will be nothing between MOSTFET and TXU). \$\endgroup\$
    – Maxim
    Commented Apr 1, 2023 at 18:36
4
\$\begingroup\$

First, as per @Andy aka comment you need to swap S and D terminals of the MOSFET.

Second, your inverter is powered at 3.3V so its output voltage is at most 3.3V.

When you need to turn on the load, you feed 1 at the inverter input, its output is pretty much near 0V so it is -5.0V in respect to the drain. The transistor is as on as it is possible. Good.

When you need to turn off your P-MOSFET, you will feed zero at the input of the inverter, the MOSFET's gate will be 1.7V below the drain potential.

The threshold voltage of WTM2301 is -0.4 .. -1.0V so your MOSFET will be somewhat conducting. For a 30ma load this will be "on" for any practical purpose (see the datasheet).


You need a level shifter.

Since you happen to use an inverter, you may simply use an inverter powered by 5V bus. Most of 5V MOS logic series them will be happy with 3.3V logic levels at the input.

\$\endgroup\$
6
  • \$\begingroup\$ Great thank you very much! From my understanding the SN74 supports also 5 V supply. So basically I only need to switch D and S of the MOSFET and supply the SN74 by 5 V, right? \$\endgroup\$
    – Maxim
    Commented Apr 1, 2023 at 10:53
  • 1
    \$\begingroup\$ VIH of the SN74LVC2G04 is minimum 0.7*Vcc when VCC is between 4.5 to 5.5V. This means at VCC=5V, input should be atleast 3.5V for the inverter to consider it as logic 1. If input is 3.3V, it falls in the grey zone where you cannot be sure of the output of the inverter. Second concern would be the current consumption of the inverter if input = 3.3V and supply is 5V. \$\endgroup\$
    – sai
    Commented Apr 1, 2023 at 11:03
  • 1
    \$\begingroup\$ True! I overlooked that, thank you! It might be overkill but then I will just place the level shifter TXU0104 between ESP and Inverter (I will need the non inverted signal for another switch). This should solve everything then. \$\endgroup\$
    – Maxim
    Commented Apr 1, 2023 at 11:33
  • \$\begingroup\$ ... or use an npn bjt with two resistors as an inverter \$\endgroup\$
    – fraxinus
    Commented Apr 1, 2023 at 19:44
  • \$\begingroup\$ Strikes me it ought to be possible to use a resistive divider to raise the ESP output voltage slightly. This should then be sufficient to drive the 5V inverter – or the MOSFET directly – without needing a proper level shifter. Or an inverter, for that matter. I can make an answer with a diagram if you like. \$\endgroup\$ Commented Apr 1, 2023 at 19:57
2
\$\begingroup\$

The MOSFET as you have shown it is upside down. You need its source S at the top, connected to the positive supply.

When switching high-side with any P-channel transistor, to switch off the load (flux gate IC), the potential at the transistor's gate must be very close to its source, +5V in this case. To switch on, using the MOSFET you propose, the gate will need to be significantly lower than \$V_S - V_{GS(TH)} = 5-1 =4V\$, say, 3.5V at most. In other words you require gate potentials significantly above or below +4V.

A 74HC logic device powered from +3.3V is not capable of providing that (its output will be 0V or +3.3V), so some kind of translation from 0/+3.3V to <+3V/+5V is necessary.

You have a few options. In all circuits below, M1 is your WTM2301 MOSFET, and G1 is one of the 74LVC2G04 inverters:

schematic

simulate this circuit – Schematic created using CircuitLab

Above, we shift the output of the inverter upwards by using diodes to develop some offset voltage, 2V (A) or 3V (B). This provides M1's gate with potentials of 3.0V and 4.8V (A), or 2.0V and 5.0V (B).

I include option A only for completeness; I don't recommend it, since all other solutions I present here will provide a full 5V "high" signal.

More "clean" solutions, getting M1's gate as far as it's possible to get from +4V given a +5V supply, require an active approach:

schematic

simulate this circuit

In option C, M2 is low-side, and can be switched directly from G1's output. For 0V and +3.3V inputs, M2's drain goes between +5V and 0V, perfect to drive M1's gate most effectively, but the signal is inverted.

Option D is a design popular with "bidirectional level shifter" modules like those from ADAFruit, but it has the advantage over option C that it does not invert. It also uses the least components, which is nice.

Driving a MOSFET gate requires a lot of initial current to charge and discharge gate capacitance. You'll notice that in all these designs R1 is present to reduce this load on G1's output.


Update

If you wish to use the TXU0104 in the manner you showed us, that's OK. However, since you are clearly in the market for options, and since the TXU0104 seems a bit overkill, I assume you are free to explore other ideas too.

The simplest by far is to use a TTL level compatible inverter or gate, which will trigger correctly for outputs from 3.3V CMOS devices like your ESP32, but produce 0V/5V outputs perfectly suited for the MOSFET gate. By using such a device, level translation and inversion is performed in the same unit.

Any 74HCT gate will do this. I don't think you need schmitt trigger inputs, since the ESP32 outputs will not be slow or noisy. You can use any regular inverter, such as those you find in a 74HCT04, or 74HCT2G04. You could even use NAND or NOR gates configured to invert, like those in the 74HCT00 and 74HCT02.

If you really need schmitt trigger inputs, then devices like the 74HCT2G14 and 74HCT132 are perfect. All the following circuits will level-translate and invert simultaneously:

schematic

simulate this circuit

It's always useful to have a few NORs and NANDs available for other tasks, but whatever gates you don't use in the packages, don't leave their inputs unconnected. Always tie unused inputs to ground or the positive supply.

As long as the 74HCT device has a supply of +5V, you can apply inputs of 0V/5V or 0V/3.3V, and you will get outputs of 0V/5V. That means you can use these "HCT" things between your existing "LVC" output and the MOSFET, if you wish.

I'm a bit embarrassed that I didn't think to suggest this solution in the first place. Big oversight on my part, sorry.

\$\endgroup\$
3
  • \$\begingroup\$ Thank you Simon, great answer with a high learning effect! What would be your recommendation concerning reliability at the end: either go with your proposed option D, or (as space and cost is not critical here) go with a dedicated voltage level translator as shown here: i.stack.imgur.com/9VZCt.png \$\endgroup\$
    – Maxim
    Commented Apr 2, 2023 at 7:22
  • \$\begingroup\$ @Maxim if you're going to the trouble of level shifting, just use such an inverter in the first place e.g. 74HCT1G04. \$\endgroup\$ Commented Apr 2, 2023 at 8:24
  • \$\begingroup\$ @Maxim as Tim Williams said, there are other options. I'll update my answer to talk more. \$\endgroup\$ Commented Apr 2, 2023 at 11:33
1
\$\begingroup\$

The ESP's output can be raised slightly from 3.3V using a resistive divider to the 5V rail. In this way, its output can be translated from 0–3.3V to, for example, 3.0–4.3V.

schematic 1

Simulation link here.

Alternatively, you can retain the inverter (at a 5V supply) for a more decisive switch-on of the MOSFET (and therefore more output current):

schematic 2

Simulation link here.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ You can also use two diodes in series to replace the 5.1k resistor, and the voltage on the MOSFET gate will be -3.6V (ON) and -0.3V (OFF). \$\endgroup\$
    – PStechPaul
    Commented Apr 1, 2023 at 22:48
  • \$\begingroup\$ For that matter, you could just omit the 5.1K resistor entirely, and tristate the GPIO to switch off the MOSFET. Even better. \$\endgroup\$ Commented Apr 2, 2023 at 12:23
  • \$\begingroup\$ The high voltage will be limited to about 4 volts due to the GPIO protection diodes. And that might also cause malfunction of some of the ESP's functions. \$\endgroup\$
    – PStechPaul
    Commented Apr 2, 2023 at 21:05

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.