Deep Sleep Shield with LoPy wake timing is inconsistent
-
I am using deep sleep shield to put my LoPy in deep sleep mode with current consumption of 500 uA.
Everything is working fine, however the wake timing is not consistent. E.g. my nodes are set to sleep for every 15 minutes and then wake for 10 seconds and then go back to sleep. However, sometimes the nodes wake up early, e.g. 10 minutes or 8 minutes. And there is no pattern to this inconsistency.
What could be the reason? Has anybody else encountered this issue?
-
You can get the wake reason using
ds.get_wake_status()
.I think the default is that there are no other wake-up sources configured, but you may try to
disable_wake_on_fall(['P10','P17', 'P18'])
anddisable_wake_on_raise(['P10','P17', 'P18'])
just to be sure.Full details here: https://docs.pycom.io/chapter/datasheets/boards/deepsleep/api.html
-
@jcaron Thanks for replying. Here are the answers to your queries:
how are you connecting your power source to the deep sleep shield? Directly to VDD, or going through some other circuit?
Directly to VDD.
are there any other circuits connected (sensors...)?
No sensors or additional circuits connected.
what's the actual measured voltage? 3 x 1.5 V batteries can deliver anywhere from 1.8 V to 5 V.
Around 4.3 to 4.6V.
what wake-up sources do you configure/use?
No external wake-up source configured. The internal timer wakes it up.
is there anything connected to the wake-up pins?
No.
what is the reported wake-up reason?
How do I know this? Kindly give me the command/code for this.
can you share the relevant parts of your code?
Sure. Here's the main.py:
from network import LoRa import socket import binascii import struct import time import config from machine import Pin from machine import UART from network import WLAN from deepsleep import DeepSleep import gc ds = DeepSleep() # initialize LoRa in LORAWAN mode. #LoRa initialization code was here # create a LoRa socket s = socket.socket(socket.AF_LORA, socket.SOCK_RAW) # set the LoRaWAN data rate s.setsockopt(socket.SOL_LORA, socket.SO_DR, config.LORA_NODE_DR) # make the socket blocking s.setblocking(False) while 1: temp = "somestring" s.send(temp) print("Gonna sleep for a while") time.sleep(6) print("Gonna go into deep sleep") print(time.mktime(time.gmtime())) #Printing epoch seconds ds.go_to_sleep(900) print("Back from deep sleep")
-
This post is deleted!
-
The following info might be useful to try to pinpoint the source of the issue:
- how are you connecting your power source to the deep sleep shield? Directly to VDD, or going through some other circuit?
- are there any other circuits connected (sensors...)?
- what's the actual measured voltage? 3 x 1.5 V batteries can deliver anywhere from 1.8 V to 5 V.
- what wake-up sources do you configure/use?
- is there anything connected to the wake-up pins?
- what is the reported wake-up reason?
- can you share the relevant parts of your code?
-
Similar issue has been reported for SiPy here: https://forum.pycom.io/topic/2270/deepsleep-still-randomly-ending/6. The OP says that he's solved it by doing the following:
- Rolled back firmware to 1.7.9.b3
- Used version 1.0.0 of the deepsleep.py file from github.
However, this doesn't solve the issue for LoPy.
Admins please respond to this issue. This issue has rendered our lot of 100 LoPy devices useless and an utter waste of money.
-
I think I am closing in on the issue, with some good leads. If someone can help me towards a solution using these clues, it would be great.
I tried 6 LoPy with deep sleep shields running the same program for sleep interval of 15 minutes.
3 of them were powered using DC power supply with constant 4.5V. The other 3 were powered using 3 "1.5V" Alkaline batteries in series (hence producing 4.5V).
The modules powered from DC power supply were very consistent in their sleep cycle. They'd wake up exactly after 15 minutes most of the time. Their average sleep time came out to be 14.5 minutes over a period of 2 days.
The modules powered from batteries were very inconsistent. They'd wake up early quite often. Their average sleep time came out to be 7-8 minutes over the same period.
This is strange. Could someone guide me as to what could be the issue?