LoPy 4 + Expansion board 3.1 power consumption in deep sleep mode
I am developing a rain gage that's usually in deep sleep, unless it sends a life sign (every 24 h) or gets a pin interrupt from the rain sensor. Using a time series of the past 20 years I estimated 99.97 % of a years time it would be in deep sleep, so that's where my main consumption happens. On pin interrupt I send on LoRaWAN and write the RTC time to an SD card (hence the expansion board). It's battery powered and should last as long as possible before needing a recharge.
I went through the steps provieded by the thread mentioned above but am still stuck with 140 uA during deep sleep mode, which is way too much for any reasonable battery capacity.
Unfortunately I can't try a regulated power supply on the 3.3 V pin. However, so far I disabled WIFI and Bluetooth on boot, pulled out all jumpers on the exp board and went through the VIN-pin for power supply with a 3.7 V LiPo battery and there still seems to be something drawing power where it shouldn't. Are there any other options? I'd need to get down to 50 uA tops during deep sleep to at least get through the main rainfall season at my test catchment (18.5 uA as advertized would be the dream).
@loth4in At the LoPy4, the flash file system has a capacity of 4 MB. And you can always connect by WiFi. So even if you do not have it enabled all the time, you could use a switch (reed contact) or button to tell the unit to activate WiFi. Then you can use ftp to access the data.
Okay, I checked on how much data I'll produce over the time and it turns out with a little tweaking I'll be happy enough with the 512 KB onboard storage. So, I guess I won't need the expansion board after all except for programming. That makes it a little tideous to read the data but we will think of a solution for that when we build the casing. Thanks however for all your help.
@jcaron yeah, LoPy4 and Expansion board are both running the latest stable firmwares
@rcolistete From the offering of my local electronics shop I picked recently for this kind of tasks:
Vishay IRFD9024 and
The first one is worse in matters of RDSon and GS threshold, but is easier for soldering. But there should be plenty of other transistors available.
@robert-hh Any recommendation of good low power P-channel MOSFET ?
@rcolistete I do not like this sparkfun device for the purpose, because it uses a N-Channel MosFET to switch the -line (GND). Better use a P-Channel MosFET to switch Vcc.
@loth4in It's not that you must not have pull-up resistors. If the device driving the input has high level when sleeping, then there should be not substantial current flow. I just wanted to point out, that outputs driving even a higher impedance load may cause such an current drain. But, as @rcolistete said, most probable the SD is consuming that current. So you should consider switch off it's power when not used..
@robert-hh But the uSD card (on Expansion Board) can consume 0.12-0.24 mA from my tests (with Expansion Board v2.1), even when not mounted/being used !
@rcolistete You are right. I found that post just recently and saw the difference in power consumption when I tested it (goes down to ~60 uA). Is there no way to deactivate the SD module on boot and only reinit it, when it's needed?
This doesn't seem to work.
from machine import SD sd = SD() sd.deinit()
@robert-hh thanks for the heads-up, I'll leave the 3.3 Pin alone. But how would I register a pin interrupt without using the pullup resistor. Is there a way to get a decent reading from a floating pin?
@loth4in Another option is to not use Expansion Board at all, but an external :
- uSD powered by a low power MOSFET (so it's powered off during deep sleep);
- I2C EEPROM, I2C FRAM or SPI flash memories, if needed powered by a low power MOSFET.
Hint of a good low power MOSFET, SparkFun MOSFET Power Controller, consumes only about 1 uA (when turning off the load).
@rcolistete Yes, I've seen that. I just wanted to tell that he/she can get to low power consumption. It might require to abandon the expansion board, if that is the major current sink. But that does not seem to be the case, according to: https://forum.pycom.io/topic/4336/new-v3-1-expansion-board-firmware-v0-0-11
@robert-hh He/she is using LoPy4 + Expansion Board 3.1.
So even the inserted microSD, not being used, consumes power (depending on the size and model), etc :
MicroSD power consumption on Expansion Board, PyTrack, PySense, etc
robert-hh last edited by robert-hh
@loth4in I just made a quick check with a bare LoPy4 and 4V at Vin and GND. Nothing else connected. Calling machine.deepsleep(), the current consumption drops to 18µA.
machine.deepsleep() was activated through a telnet connection. So that is the baseline. Anything else comes from the environment. Hugh power sucker are often pull-up resistors. For instance, a 33k resistor at 3.3V will consume 100µA. So check all static voltages at you device, outputs which drive a load, and switch them to inputs, etc. There is a voltage divider on the Expansion board to an analog input pin, which can be disabled by pulling the BAT jumper. That one alone consumes 20µA.
P.S.: NEVER use the 3.3 Pin for supplying the device. It's an output.