I need to reduce the power consumed by a circuit based on ESP8266 and extra circuitry (I2C sensors, light resistor based sensor, etc.). By now when I set ESP8266 in deep sleep I still have a relevant power consumption caused by extra components. Not all ICs have a 'deep sleep' mode that can be set to reduce power, so I tried to disconnect VCC line that power all extra components on the breadboard and the current drop enough to allow running the entire circuit by battery.

So my idea is to manage the sensors VCC line with a mosfet driven by the ESP8266, something like:

  • on ESP8266 power up (Arduino setup() method), as first thing I switch ON the mosfet to power all sensors
  • small pause to allow all ICs to init and stabilize
  • perform all operation (read sensor, calculation, etc.)
  • turn mosfet OFF
  • turn ESP8266 to deepsleep

So I would ask:

  1. is a feasible way or can led to any kind of issue?
  2. if I use an N-channel mosfet the result is a low-side-switch, that leave GND floating. This seems bad to me, correct?
  3. if I use a high-side-switch (P-channel mosfet) is a pull-up resistor enough to assure mosfet is full-close when micro going to deep sleep?

The entire circuit VCC is 3.3v

  • \$\begingroup\$ You will also need to ensure that the peripheral devices have any inputs that are driven by the ESP at low or you will have current draw and possibly electrical overstress. i.e. The ESP will need to have those outputs low prior to powering the peripherals down. \$\endgroup\$ Commented Dec 29, 2020 at 13:39

1 Answer 1


Removing power from the sensors is the best way to reduce power consumption when you don't need them. You can do a low-side switch because your sensors don't use a lot of current so that ground will be so close to real ground that it won't matter. The pins of the sensors however may be at VCC level so you have to watch where they connect, for example the I2C lines to your MCU, the inputs there have to be floating. On the other hand if you use the high-side switch then of course your I2C lines need to be low or otherwise the pull-up resistor on those will send power into your sensors (something to keep in mind if you are really trying to minimize power consumption). When you talk about a mosfet and you say "full-close" that means it is "ON" because you have to think of it as a switch in a circuit, for example think of a knife switch. It's not a valve in a water line so that can be confusing, but to answer your question a pull-up on the p-channel is enough to keep it completely off (aka open) (not accounting for leakage, check datasheet when in doubt).

  • \$\begingroup\$ so due to I have I2C as far as I understand from your answer a low-side switch is better due to with GND disconnected no current flow even via I2C lines? \$\endgroup\$
    – Noisemaker
    Commented Dec 29, 2020 at 14:09
  • \$\begingroup\$ the i2c lines get pulled high by resistors, which may be internal to your microcontroller, in which case you can turn them off and let the lines float completely. if they are external you can feed those from your micro so you can also turn them off. if you can't turn them off then low-side switch would be the best and let all your sensors completely rise to VCC. \$\endgroup\$
    – pgibbons
    Commented Dec 29, 2020 at 14:19

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.