0
\$\begingroup\$

Based on the question 4-5-v-on-gate-of-mosfet-while-switch-open I ask this more generic question.

Main project: I want to create a 16x8 (or so) multiplexed LED circuit Sub project: Creating a 2x2 LED matrix, typically this form:

GPIO->resistor->Mosfet->LED->Mosfet->GND

The mosfets are used to use for the LED external (5V) power. The resistor is for current limiting the LED.

I made this on a breadboard, using all 5 V (also from GPIO) and it works. The mosfets are 2N7000's).

However, when I tried to use for GPIO 3.3V, and using logic level shifters to convert from 3.3V to 5V I ran into problems (Gate always on, independent on GPIO).

So my main problem is to achieve this:

GPIO (3.3V) -> resistor -> Mosfet Gate (5V)

How should I convert this? The only solution I can think of is a level shifter. Or a voltage/resistor dividor, but that only works to lower the voltage, not to increase it.

\$\endgroup\$
  • 3
    \$\begingroup\$ Realistically, you need to buy MOSFETs that work with 3v3 drive. They're common and cheap (at least if you are willing to do surface mount, and still common even if not) - anything else is just overcomplicated. The issue with your previous question was that you were trying to do high side switching in a situation where you should have been doing low side. \$\endgroup\$ – Chris Stratton Mar 10 at 21:53
  • \$\begingroup\$ Well I ordered them (through hole, IRL44N's), but it takes some time to arrive, and like to continue a bit using the one I have. \$\endgroup\$ – Michel Keijzers Mar 10 at 21:54
  • 1
    \$\begingroup\$ A resistor at the gate will not limit the current through the LED; it needs to be in series with the LED. \$\endgroup\$ – CL. Mar 10 at 21:57
  • \$\begingroup\$ If you didn't mind wasting power and inverted logic and have correctly positioned the N FET as a low side switch, you could put a stiff pullup to 5v on the switching FET's gate and borrow a little BSS138 or whatever from your level shifter to clamp that low when you put 3v3 on the gate of that little FET. Or you could use a 5v buffer that accepts 3v3 input. But again, these are all suboptimal compared to just using a suitable FET. What is your current anyway? Is it actually something which requires discrete FETs and not buffer ICs or even (in select cases) do-able with a bare MCU GPIO? \$\endgroup\$ – Chris Stratton Mar 10 at 21:59
  • \$\begingroup\$ You might even be able to just use the BSS138's off your logic shifter (or whatever cheap unknown is actually there) as the switch. And if not, better SMD FETs have a decent chance of having the same pinout - for example the BSS138 and DMN2041L data sheets I'm looking at show drastically different capability, but the same package and pinout. \$\endgroup\$ – Chris Stratton Mar 10 at 22:03
2
\$\begingroup\$

You can indeed use a passive voltage divider to increase the voltage drive to a FET gate driven from a 3.3V GPIO pin. You just need to be careful, and understand the rules.

If you are using the 2n7000 then you expect the VGS(th) range:

enter image description here

Devices could have a VGS(th) across this whole range, but you know that the devices you have won't turn on to any usable extent with 3.3V drive. So the devices you have are probably very close to the 3V VGS(th).
In this case if you hold the gate below 3V they won't turn on, but you need to drive the device beyond 3.3V to get it to pass your desired LED current.

In the schematic below I have a restricted range for VGS, but can ensure it's below 2V (which should be well and truly off for your application) and drives to 3.9V (which should turn it on).

If you look at the typical VGS/ID curve, you can see that 3.9V drive should work fine for ID up to about 100mA with relatively low on voltage drop.

enter image description here

schematic

simulate this circuit – Schematic created using CircuitLab

In the schematic above, if NODE1 was open circuit, the voltage across R3 would be 3.3V. So when the MCU GPIO pin drive a high out, there is no (or very little) current flow from or into the pin.
When Node1 is driven low is shorts out R3 and sinks current from R2.

If you can accept the limitations (a lower range of VGS drive, and limited current sink) then this circuit may work for you. Just remember that if you get a batch of 2N700 with a much lower VGS(th) you'd have to alter the R ratios or even be able to drive them directly (just leave R1 out).

Since in most MCU power supplies the 5V supply is used to generate the 3.3V supply (via a regulator) the GPIO pin is protected from seeing a voltage higher than 3.3V.

Since you already have the level shifter boards from your first question, you could easily repurpose those and use the lower VGS(th) FET (the BSS138) to drive your load. There would be multiple ways your could use those boards:

  1. Use each FET providing that the LED current you have can be sunk by the MCU GPIO pin (probably limited to under 20mA depending on your MCU).

  2. If your current requirements are higher then you could drive the LV pin from the MCU and ground the LV1, LV2, LV3, LV4 pins. Now all the current flows directly to ground and the outputs can be joined together to provide up to 1A or so without problems.

\$\endgroup\$
  • \$\begingroup\$ Thanks for your answer, I don't understand all the implications, but makes some things more clear ... I think I better wait until my 3.3V mosfets arrive. \$\endgroup\$ – Michel Keijzers Mar 12 at 20:56

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.