• DeepSleep Shield & LoPy

    LoPy lopy deepsleep
    5
    0 Votes
    5 Posts
    2k Views
    R
    Also measuring over 500 uA with a LoPy + deep sleep shield, which is a shocking amount of current. To continue using the LoPy, i have had to use a humungus sized battery (6600 mAh) and shorten the life-span of the device. Please fix this pycom guys. This has taken far too long! I like the LoPy, but if this is not fixed pretty soon i will be forced to switch to a low power arduino alternative.
  • DeepSleep and SHT31-D alarm

    LoPy lopy sht31-d alrm deepsleep
    7
    1 Votes
    7 Posts
    2k Views
    M
    @maamar sh31 lib from machine import I2C import time R_HIGH = const(1) R_MEDIUM = const(2) R_LOW = const(3) class SHT31(object): """ This class implements an interface to the SHT31 temprature and humidity sensor from Sensirion. """ # This static map helps keeping the heap and program logic cleaner _map_cs_r = { True: { R_HIGH : b'\x2c\x06', R_MEDIUM : b'\x2c\x0d', R_LOW: b'\x2c\x10' }, False: { R_HIGH : b'\x24\x00', R_MEDIUM : b'\x24\x0b', R_LOW: b'\x24\x16' } } def __init__(self, i2c, addr=0x44): """ Initialize a sensor object on the given I2C bus and accessed by the given address. """ if i2c == None or i2c.__class__ != I2C: raise ValueError('I2C object needed as argument!') self._i2c = i2c self._addr = addr def _send(self, buf): """ Sends the given buffer object over I2C to the sensor. """ self._i2c.writeto(self._addr, buf) def _recv(self, count): """ Read bytes from the sensor using I2C. The byte count can be specified as an argument. Returns a bytearray for the result. """ return self._i2c.readfrom(self._addr, count) def _raw_temp_humi(self, r=R_HIGH, cs=True): """ Read the raw temperature and humidity from the sensor and skips CRC checking. Returns a tuple for both values in that order. """ if r not in (R_HIGH, R_MEDIUM, R_LOW): raise ValueError('Wrong repeatabillity value given!') self._send(self._map_cs_r[cs][r]) time.sleep_ms(50) raw = self._recv(6) return (raw[0] << 8) + raw[1], (raw[3] << 8) + raw[4] def get_temp_humi(self, resolution=R_HIGH, clock_stretch=True, celsius=True): """ Read the temperature in degree celsius or fahrenheit and relative humidity. Resolution and clock stretching can be specified. Returns a tuple for both values in that order. """ t, h = self._raw_temp_humi(resolution, clock_stretch) if celsius: temp = -45 + (175 * (t / 65535)) else: temp = -49 + (315 * (t / 65535)) return temp, 100 * (h / 65535)
  • Deep Sleep Summary

    Discussion deep sleep pysense pytrack deepsleep
    34
    7 Votes
    34 Posts
    11k Views
    philwilkinsonP
    @tuftec, yes you are correct, the machine.deepsleep() machine.remaining_sleep_time() and pin_deepsleep_wakeup() functions all work fine. I have isolated my problem was with the LoRa publishing code. When I commented out the lora_publish in my code below everything worked fine. The bug must be something to do with nvram functions i am using in my lora_publish function. Perhaps this bug is best published in a new thread. Thanks for the comment. Code published to allow others a quick start! import machine import utime from machine import Pin import pycom import config #user defined #import LoRa_publish #user defined rst=machine.reset_cause() if rst != 3: # if not woken from deepsleep utime.sleep(10) #to allow ctrl+C pycom.nvs_set('counter', 0) #button = Pin('P23', mode = Pin.IN, pull = Pin.PULL_UP) machine.pin_deepsleep_wakeup(pins = ['P23'], mode = machine.WAKEUP_ALL_LOW, enable_pull = True) machine.deepsleep(60000) else: if (machine.wake_reason()[0])==1: #pin wakeup total_count = pycom.nvs_get('counter') +1 pycom.nvs_set('counter', total_count) print('remaining deepsleep time is {}'.format(machine.remaining_sleep_time())) machine.pin_deepsleep_wakeup(pins = ['P23'], mode = machine.WAKEUP_ALL_LOW, enable_pull = True) machine.deepsleep(machine.remaining_sleep_time()) elif (machine.wake_reason()[0])==2: #RTC timer complete print('timer completed') total_count = pycom.nvs_get('counter') print('counted {} button presses'.format(total_count)) #LoRa_publish.publish(total_count) #INT published to TTN pycom.nvs_set('counter', 0) machine.pin_deepsleep_wakeup(pins = ['P23'], mode = machine.WAKEUP_ALL_LOW, enable_pull = True) machine.deepsleep(60000) #this does not restart a new interval!!
  • 0 Votes
    3 Posts
    2k Views
    J
    @joeri How accurate does it need to be? You could store the time before entering deep sleep and then when the board comes back you'd know it's the stored value + your deep sleep time + small adjustment to account for boot-up (which on my tests is about 1.9s but you should check for yourself) That should quickly give you a good approximation. Of course on the Pytrack you can get then get the GPS time.
  • DeepSleep current without the promised shield?

    SiPy sipy deepsleep
    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • 0 Votes
    9 Posts
    1k Views
    S
    @livius I am using the official library taken from here https://github.com/pycom/pycom-libraries/blob/master/shields/lib/LTR329ALS01.py which indeed as you noticed does not contain the ALS_STATUS status register reading logic. According to the datasheet https://www.mouser.com/datasheet/2/239/Lite-On_LTR-329ALS-01 DS_ver1.1-348647.pdf Page 22 the Device operation flow chard shows indeed kind of a loop until that status register indicate a new data is available. on Page 24 it shows a pseudo code mentioning what you are suggesting (which is checking the data readiness before performing the actual read). Page 21 it describe how to perform the check of the validity of the read. I can try to patch the lib according to such information and push a PR to the official repo if this is solving the problem :-). Keep You posted and thanks for your help! Stef
  • 2 Votes
    24 Posts
    12k Views
    P
    @dbrgn Thanks for the notification, I can confirm that it works!
  • Deepsleep and Pin value

    LoPy deepsleep gpio lopy
    3
    0 Votes
    3 Posts
    1k Views
    B
    @robert-hh Perfect, I will have a look at it, thank you.
  • 1 Votes
    9 Posts
    4k Views
    J
    @chrisi if you are using the Deep Sleep shield, then you have the relevant functions in the library that goes with it. If you are using a Pysense (and I believe the same applies to the Pytrack), then it's a lot more complex. There's only one usable pin on the I/O header, you need to patch the Pysense firmware, isolate a pin between the module and the Pysense, and change a few things in the sleep process. But it does work. Refer to https://forum.pycom.io/topic/1673/pysense-pinout-wake-on-pin/16 for details.
  • 0 Votes
    3 Posts
    2k Views
    joeriJ
    Is there an update on the availability of the interrupts? I would like to use to it in my next project.
  • 0 Votes
    3 Posts
    1k Views
    J
    @jellium This is not possible yet, please see the existing topic: https://forum.pycom.io/topic/1350/strategy-for-lorawan-with-deepsleep-2
  • LoPy RTC loses time during deep-sleep

    Issues & Bugs lopy rtc deepsleep
    4
    0 Votes
    4 Posts
    2k Views
    L
    @cfaessler did yoy fix this issue?
  • Strategy for LoRaWAN with deepsleep 2

    LoPy deepsleep join wake up
    34
    0 Votes
    34 Posts
    13k Views
    J
    @jmarcelino Is there any example code that incorporates deepsleep and LoraWAN with these new functionalities to test it? thanks
  • Deep sleep mode reset the board?

    LoPy deepsleep lopy sleep
    12
    0 Votes
    12 Posts
    4k Views
    L
    Hi...i am a new user here. As per my knowledge Pin states can be remembered through deepsleep using pin.hold([hold]). Also you can do this in boot it start same as removing power ,you start from clear point. pcb assembly
  • OEM Modules (W01/L01/G01) Power Requirements

    Discussion oem deepsleep voltage
    3
    0 Votes
    3 Posts
    1k Views
    D
    @Eric24 we will update the data sheets with more detailed info about operating ranges soon, but in the meantime, from 2.7 to 3.6 V is the recommended range. Same during deep sleep.
  • Does deepsleep work at all

    Discussion deepsleep
    83
    0 Votes
    83 Posts
    53k Views
    B
    @johncaipa Hi, Im getting this same error - did you work out why this occurs?
  • WiPy / SiPy deep sleep interrupt wake

    MicroPython interrupt deepsleep
    2
    0 Votes
    2 Posts
    1k Views
    L
    @helloerror It is still not supported and also read here about power consumption in old modules new one are not affected https://forum.pycom.io/topic/1022/root-causes-of-high-deep-sleep-current/19
  • 11 Votes
    127 Posts
    113k Views
    M
    @mattliddle @Fred I discovered an important insight! When powering it through USB (I'm using the expansion board 2.1) there is an LED light that turns on and stays on even in deep sleep. I was measuring current draw and it was always at least 14 mA. I tried powering the device outside of the expansion board by a 3.7V source, and in deep sleep, sure enough it dropped into the microamp range. Even when it is on expansion board 2.1 and powered through battery instead of usb, the LED stays turned off, and therefore power consumption will drop into the micro amp range.
  • 0 Votes
    6 Posts
    2k Views
    L
    @jmarcelino created https://github.com/pycom/pycom-micropython-sigfox/issues/1 and also pull https://github.com/pycom/pycom-micropython-sigfox/pull/2
  • Deepsleep Testing

    Discussion lopy deepsleep
    6
    0 Votes
    6 Posts
    2k Views
    B
    Hi @jasonriedy There's nothing in the way of tooling at the moment but I'll have a chat with the team to see about putting out a benchmark script to verify power efficiency. Will let you know when I've heard back!