PySense + FiPy deepsleep high current
I'm a little bit lost, as deepsleep doesn't look to be working correctly with my setup, as I always get around 5 mA while in deepsleep. The setup is:
- FiPy (tried versions 1.80 -> 1.20)
- PySense 0.0.8 (did at least 5 times the update, to make sure its done)
- Power-Source USB or JST
I use the following code ...
# main.py -- put your code here! from pysense import Pysense from LIS2HH12 import LIS2HH12 from SI7006A20 import SI7006A20 from LTR329ALS01 import LTR329ALS01 from MPL3115A2 import MPL3115A2,ALTITUDE,PRESSURE import pycom import time import machine # if not pycom.lte_modem_en_on_boot(): # pycom.lte_modem_en_on_boot(True) # machine.reset() # if not pycom.wifi_on_boot(): # pycom.wifi_on_boot(True) # machine.reset() #py = Pytrack() py = Pysense() # display the reset reason code and the sleep remaining in seconds # possible values of wakeup reason are: # WAKE_REASON_ACCELEROMETER = 1 # WAKE_REASON_PUSH_BUTTON = 2 # WAKE_REASON_TIMER = 4 # WAKE_REASON_INT_PIN = 8 print("Wakeup reason: " + str(py.get_wake_reason())) print("Approximate sleep remaining: " + str(py.get_sleep_remaining()) + " sec") time.sleep(2) # enable wakeup source from INT pin py.setup_int_pin_wake_up(False) acc = LIS2HH12() # enable activity and also inactivity interrupts, using the default callback handler py.setup_int_wake_up(True, True) # set the acceleration threshold to 2000mG (2G) and the min duration to 200ms acc.enable_activity_interrupt(2000, 200) # go to sleep for 5 minutes maximum if no accelerometer interrupt happens py.setup_sleep(300) # Finally go to sleep py.go_to_sleep()
If I use the JST-Connector for powering the pysense (still with 5V) current drops by 0.5mA to something around 4.5mA but its still far away from what I would expect.
Anybody has a hint for me, what I'm doing wrong or what I might try?
Thanks in advance!
@jcaron well I need the accel, because it's a "wake on shake" use-case. Everything you mentioned is already tested. Of course I tested by powering the device via the JST and not the USB port. Same results. Also I tried exchanging the FiPy by a LoPy4. Also the same. But then I switched the Pysense by another and all of a sudden it worked. Looks like a hardware fault.
Nevertheless thanks for your suggestions!
@sebastian-muesch in my experience accelerometer wake up will use over 300 uA. If you want the lowest possible power draw you need to turn that off.
Other possible culprits:
the LTE chip. It seems to be nightmare to turn it off, especially if there’s no SIM or you haven’t actually used it then turned off.
an SD card if you use one
you may try adding
falseas argument to
you will definitely get bad results powering via USB