I am building a battery-powered datalogger that will communicate using cellular signal, based on the ATSAMD21 microcontroller and the SIM5320 cellular modem. To save power, an outside timer periodically switches the microcontroller on/off (not shown) and the microcontroller should be able to switch power to the modem. When the microcontroller is off, the modem should also be off.

I implemented this as shown in the schematic below, using a microcontroller output to switch power to the modem through a P-MOSFET. This part works perfectly.

I also added a 100k pullup resistor to the gate, which I hoped would keep the P_MOSFET off when the microcontroller is off. This part does NOT work--when the microcontroller is off, the gate voltage drops to ~0.8V and power runs to the modem. I tried using different pullup resistors, but even at 100 ohm the gate voltage increases to ~3V and the P-MOSFET is still on.


  1. It looks to me like 'something' is driving the gate voltage toward GND, but what is it? Where did I go wrong?

  2. If the gate voltage is above ~2V, the microcontroller actually powers on. Is it actually drawing power through an analog input/output pin?

  3. It may be simpler to use an N-MOSFET instead, but I am unsure as to how it would work with the SIM5320 IC being connected to a 'GND' that is a few mV above real ground due to the mosfet resistance. Could an N-MOSFET work here? What are better ways to design this circuit?


simulate this circuit – Schematic created using CircuitLab

  • 1
    \$\begingroup\$ If you disconnect Dout from the gate, and leave the pullup resistor in place, does the MOSFET turn off? \$\endgroup\$ – Big6 Dec 21 '17 at 21:54
  • \$\begingroup\$ I cannot test that with the current circuit since it is a PCB with smd components. I would have to scratch out the trace. \$\endgroup\$ – Michael Santiago Dec 21 '17 at 21:58
  • 4
    \$\begingroup\$ You are powering the micro through the protection diode between that pin and its power pin. Might be better to keep the micro powered up and in its deepest sleep mode (some micros draw 1 uA or less, don't know about yours) \$\endgroup\$ – Brian Drummond Dec 21 '17 at 22:21
  • \$\begingroup\$ I looked into sleep mode, but decided against it because (1) I'm not familiar with the microcontroller commands, thus it's easier to just cut off power, and (2) there are many other components I need powered off, thus it's simpler to use one switch for all. Will keep it in mind for the future. \$\endgroup\$ – Michael Santiago Dec 21 '17 at 23:33
  • \$\begingroup\$ Are you sure it's safe to apply a voltage above the supply voltage to the ATSAMD21's DOUT poin? \$\endgroup\$ – David Schwartz Dec 22 '17 at 7:35

a better idea for this, if you want to use a PMOS high side switch, would be to have the ATSAMD21 switch a low-side NPN switch, which then switches the PMOS for the SIM530. Example:


simulate this circuit – Schematic created using CircuitLab

R2 (arbitrarily chosen to be 50x R1) pulls Q1 to ground (off) if D1 is in high impedance state, which it may be if the uC is off. This means M1 gate is definitely pulled up to 4.2 V.

The issue with your design is we don't know exactly what is inside the microcontroller output when it is off, so we shouldn't rely on it. Also, considering even when DOUT is a "1" it is 3.3 V, which is lower than the 4.2 V driving the Modem, so M1 may be partially on. While it seems to be working for your case, it is not great practice... If the load were running off 5 or 12 V, the V(GS) of M1 could become an issue.

| improve this answer | |
  • 1
    \$\begingroup\$ +1 for providing the exact solution for controlling a P-channel mosfet (or even a pnp transistor). You stated that the output of the uC is unknown when it has no power to control its pins, which may have internal pull-down resistors. \$\endgroup\$ – user105652 Dec 21 '17 at 22:47
  • \$\begingroup\$ Will this example work even if D1 is not in a "high impedance state"? I don't know what the usual state is for microcontroller outputs. \$\endgroup\$ – Michael Santiago Dec 21 '17 at 23:38
  • \$\begingroup\$ Also - will adding an NPN increase power use? \$\endgroup\$ – Michael Santiago Dec 21 '17 at 23:47
  • \$\begingroup\$ I'm probably going to go with this design, using the "MMBT3904" NPN switch (the 2N3904 isn't available on SMT) to avoid any potential issues with floating GND. \$\endgroup\$ – Michael Santiago Dec 22 '17 at 18:46

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.