I have a strange behavior with the circuit below.


(the bidirectional logica level should be read as:

  • VL = Voltage Low
  • GNDL = GND Low
  • VH = Voltage High
  • GNDH = GND High

  • L1 = Low channel 1 (I did only draw 1 for simplicity, there are 4 in total)

  • H1 = High channel 1

This is the level shifter:

enter image description here

Voltages read:

  1. When the switch is open:
    • 1.98 V between GND and L1 (of the shifter)
    • 4.57 V on the gate of the Mosfet
    • LED is on
  2. When the switch is closed:
    • 3.30 V between GND and L1 (of the shifter)
    • 5.26 V on the gate of the Mosfet
    • LED is on

Of course the LED is always on since the gate voltage is in both cases high enough.

How can there be 1.98 V between GND and L1 while the switch is open (I assume the gate does not return any voltage) and 4.57 on the gate?

earlier tests

  • When I change the 10 KOhm resistor by a 200 ohm, the LED works as expected (on when closed, off when opened).
  • Without the level shifter and using 5 V for the entire circuit, also the LED works as expected
  • Without the level shifter and using the 3.3 V than the 2N7000 does not get enough voltage on the gate (therefore I want to use the shifters, at least until I receive my better mosfet, IRL44N).
  • \$\begingroup\$ What is this "bidirectional logic shifter"??? 99% likelihood it doesn't have the capability you imagine and would need here. High side switching with an N-FET requires a flying converter which is quite different from usual logic level conversion as it is not the logic level which needs to be converted but rather the ground reference. \$\endgroup\$ – Chris Stratton Mar 9 '19 at 23:10
  • \$\begingroup\$ @ChrisStratton I added a picture ... I assume if you put 3.3 V on the LV, 5V on HV, GNDs on the GNDs, and 0 V on LV1 I get 0 V at HV1, and 3.3V on LV1 I get 5 V at HV1. \$\endgroup\$ – Michel Keijzers Mar 9 '19 at 23:15
  • 1
    \$\begingroup\$ IF LED can be in FET drain lead then you need ONLY a high/low control signal. \$\endgroup\$ – Russell McMahon Mar 10 '19 at 11:49
  • \$\begingroup\$ @RussellMcMahon Actually I want a matrix, so need one for row (before) and for column (after) \$\endgroup\$ – Michel Keijzers Mar 10 '19 at 22:08

How can there be 1.98 V between GND and L1 while the switch is open (I assume the gate does not return any voltage) and 4.57 on the gate?

The first thing you need to understand is the schematic for the level shifter.

In all probability it is this schematic:

enter image description here

Some boards appear to have 2N7000 while other use the BSS138.

Here I've redrawn the schematic to achieve what I think you wanted to do:


simulate this circuit – Schematic created using CircuitLab

I've shown L1 as having only two states --> GND or 3V3, but if L1 was left open some leakage current (1-2uA) could flow from 5V to 3V3 via R2.

In your schematic you show L1 as connecting to 3V3 or to a 10k Ohm to Gnd. This would explain your strange measurements since the FET Source is then connected to voltage less than the 3V. This will allow a BSS138 to partially turn on and current will flow from the high voltage side to Gnd. This explains why you see 4.57V (about 200ua through R1) and 5.26V (I assume here your 5V supply is actually 5.26) between the two states.

  • \$\begingroup\$ Thank you very much for this explanation (although I have to analyze it better to understand it fully). \$\endgroup\$ – Michel Keijzers Mar 10 '19 at 21:24

Put the LED on the other side of the MOSFET, be sure to use a current limit resistor.

  • \$\begingroup\$ Actually I also have one on the other side (on both sides), for a led matrix, but I found the problem on the front side. And I have also a current limit resistor, but forgot to add it in the circuit (and somehow I cannot edit the circuit; seems to be a jpg only). \$\endgroup\$ – Michel Keijzers Mar 10 '19 at 21:11
  • \$\begingroup\$ @MichelKeijzers that's not what "on the other side" means. There is no reason whatsoever to have LEDs both above and below the switch in a display matrix. Wire the N-FET source to ground. An and all loads go on the drain in series with whatever current limit, and in series or parallel with each other as appropriate to their nature. \$\endgroup\$ – Chris Stratton Mar 10 '19 at 22:15
  • \$\begingroup\$ it should be in between the switching (of two mosfets), to control the rows/columns \$\endgroup\$ – Michel Keijzers Mar 10 '19 at 22:21

This is unworkable. The "logic shifter" part you show is, for your purposes, nothing more than a 10K pull-up resistor to 5v which can be disabled by the small signal FET which joins its two sides.

You are trying to use an N-FET as a high side switch, which means that you need a flying gate driver which can impose a suitable voltage of the Gate above the source in the situation where the Source is not grounded, but rather riding on the varying voltage of the load.

There are parts sold for what you want to do, under names like "High Side Driver" and they will be explicit that they provide an output referenced to the high side of the load. Mostly their justification for existence is that N-channel devices have historically been enough better than P-channel devices that it is worth the extra circuit complexity to use them even on the high side where they are an unnatural fit. If you were to look at say, quadcopter brushless motor drivers, you might find that some used a half bridged built from a combination combination of N- and P-FETs on the low and high side, while others (especially the more powerful) use all N-FETs with the necessary drive circuitry to apply those on the high side as well as the low.

For your purposes, it would be far simpler to just use an appropriate N-FET on the low side of the load.

If you need to switch the high side for some reason, you could consider a P-FET, or perhaps consider a USB downstream port power switch chip, which often consists of an N-FET and the needed high side driver packaged together in IC form. While intended for USB they usually work over a range of low voltages.

  • \$\begingroup\$ I think I have to check first what all your terms mean (flying gate driver', 'high side switch'. But so far thanks to let me know it could not work. \$\endgroup\$ – Michel Keijzers Mar 9 '19 at 23:16
  • 1
    \$\begingroup\$ Conceptually, imagine you had a battery and an optocoupler to get the gate vs source drive voltage "on top of" the load. though it's usually not actually done with an optocoupler. \$\endgroup\$ – Chris Stratton Mar 9 '19 at 23:32
  • \$\begingroup\$ I will use UDN2981 for the high side, but I thought I could already do a 'simple' setup with the mosfets I have (guess it's not so easy). Thanks for the answer. \$\endgroup\$ – Michel Keijzers Mar 12 '19 at 20:58

In addition to above answers, a MOSFET can put a voltage out of its gate pin if the internal oxide layer has a short due to either gate overvoltage or severe ground bounce. In this case a real chance of excessive gate to source voltage does exist.

With power OFF, disconnect the gate pin and measure ohms from gate to source and gate to drain. Any value under 100 megohm is a short, especially when voltage is applied.

If power is applied but gate is open, it should read almost zero volts to source if it is good, else a few volts on the gate is a sign the oxide layer is damaged, and is no longer an insulator.

  • \$\begingroup\$ I think this is not the case, since I measured during power off the gate->source and gat->drain resistance and it is at least bigger than 20 MOhm (max measurement on my multimeter). \$\endgroup\$ – Michel Keijzers Mar 10 '19 at 21:21
  • \$\begingroup\$ @MichelKeijzers That is why I gave myself an 'option-out' by wording it as "a MOSFET can put a voltage out of its gate" with the word 'can' in italics. I have run into bad MOSFETs and CMOS logic with voltage at an open input pin, usually due to static discharge, usually due to poor grounding procedures. \$\endgroup\$ – user105652 Mar 10 '19 at 21:59
  • \$\begingroup\$ Luckily it seems not the case here, but good to know it's a serious problem. \$\endgroup\$ – Michel Keijzers Mar 10 '19 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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