0
\$\begingroup\$

I would like to turn a SIM800L modem on/off (to save battery), controlled with GPIO 16 on an ESP32-CAM, without a relay.

It was working OK with an electromagnetic relay, but I'd like to avoid the noisy clicking sound, so I'm trying to use some kind of BJT transistor or MOSFET based approach.

It might be relevant that pin 16 has a 10k pull up resistor.

(This is part of a more complex setup, and I only have pin 16 left.)

There is 5v on the breadboard power rail, and 3.3v appears on the output pin when turned on HIGH.

Maybe could work

I tried using and NPN transistor (2N2222A) as a switch, but that didn't turn on the SIM800L.

I was following this kind of setup and maybe that wasn't suitable?

Approaches that didn't work

IRF530N MOSFET

As @vir explains: The 3.3V from the module is not enough to turn on the IRF530, which has a threshold voltage of 2-4V.

I wired it up like below, but HIGH on GPIO 16 doesn't turn on the SIM800L.

Can this possibly work?

There was another question where someone got a similar mosfet to work, and I saw a breakout-board with this on/off function which used an IRF520.

This guide also indicates some techniques but honestly it's over my head how the pieces might have to fit together to make it work.

esp32 with mosfet

I was following this tutorial where he includes this diagram:

enter image description here

\$\endgroup\$
4
  • \$\begingroup\$ What voltage does your ESP32 output on that pin? Probably not high enough to turn on an IRF530; that FET isn't rated for less than 10 V drive. \$\endgroup\$
    – Hearth
    May 12 at 20:05
  • \$\begingroup\$ The SIM800L seems to be powered by 3.8V to 4.2V, is this correct? What is the power supply connected to the breadboard? Do you have higher voltage available with the same reference? \$\endgroup\$
    – devnull
    May 12 at 20:11
  • \$\begingroup\$ Thanks, I extended the description \$\endgroup\$
    – Gambhiro
    May 12 at 20:20
  • \$\begingroup\$ So, I'm assuming neither a higher voltage (e.g. 12V) is available with the same reference nor the power supply specs for the SIM800L module are known. \$\endgroup\$
    – devnull
    May 12 at 20:34

2 Answers 2

1
\$\begingroup\$

The 3.3V from the module is not enough to turn on the IRF530, which has a threshold voltage of 2-4V. 5V should be enough, which gives you options. You could change the IRF530 for another device (BJT, 3.3V logic level MOSFET) that will work directly from a 3.3V signal or add in a cheap gate driver chip that will apply 5V to the gate of the IRF530. It might not be a great idea to low-side switch the SIM800L so a small SSR or PMOS with appropriate gate driver could be indicated here.

\$\endgroup\$
9
  • \$\begingroup\$ 5 V is not going to be anywhere near enough to fully enhance an IRF530. You generally want two or three times the threshold voltage to turn it on. \$\endgroup\$
    – Hearth
    May 12 at 21:38
  • \$\begingroup\$ Agreed. The datasheet shows a 4.5V Vgs curve that looks not-great but might be able to control a low current load. A gate driver with integrated charge pump would guarantee good channel enhancement but that's becoming more trouble than it's worth. \$\endgroup\$
    – vir
    May 12 at 21:45
  • 1
    \$\begingroup\$ @vir even if that modem spikes to 2A? Because yes, that's how high GPRS modems do sometimes. I unfortunately don't remember the pulse width. \$\endgroup\$
    – jaskij
    May 12 at 22:33
  • \$\begingroup\$ @JanDorniak The same figures I've found. Not to mention the incompatible voltage. \$\endgroup\$
    – devnull
    May 12 at 22:35
  • \$\begingroup\$ Possible, but I recommend high side switching over trying to make the IRF530 work. \$\endgroup\$
    – vir
    May 12 at 23:14
0
\$\begingroup\$

The problem with the IRF530N was that its gate voltage is too high (~4v) for the ESP32 pin signal (3.3v) to open it.

I replaced it with an IRLZ24NPBF, the datasheet says Vgs 2v.

This FET did open with the lower voltage, but when drain and source was connected to the power rail (5v), some voltage was lost in the FET and only 4v appeared on the SIM800L, which is not quite enough.

Connecting the FET to a 9v battery worked.

The FET however stays open even with LOW signal from the ESP32 pin. It only turns off when the ESP32 goes into deep sleep.

  • ESP32 on: 6-7v on the SIM800L
  • ESP32 in deep sleep: 3v and 60µA on the SIM800L

(This is acceptable for my use case, as I wanted the SIM800L not to draw battery power while the ESP32 is sleeping.)

I tried to control the FET gate with a BJT transistor, using the ESP32 pin to open/close the BJT, but then again the FET doesn't open enough to drive the SIM800L (or it doesn't get enough current?).

So this works to the extent that ESP32 on normal power turns the SIM800L on, and deep sleep turns it off:

circuit

\$\endgroup\$

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.