lopy4 deep sleep
I want my lopy4 to wake up once a day at a pre-defined time and send the data to my LORAWAN network. the project needs to run on battery. what deep sleep modes can i use ? i want the lopy4 to only connect to LORAWAN over OTAA once and then just keep sending data once a day. Can i maintain the LORAWAN counters and session keys in sleep modes ? how to best achieve this kind of functionality.
robert-hh last edited by
@abhishek2101 Go to the profile of the person you want to chat with, and in the middel right there is a circle with some dots. If you open that, teh first topic is: start a chat.
@robert-hh that is what i was looking for, I tried to find how to initiate the chat, but could not see it. can you help ?
robert-hh last edited by
@abhishek2101 You can always use the chat for direct communication to specific board members for topics, which you do not want to ask in public.
@abhishek2101 the whole point of forums such as this one is that any help for you will be available for others having the same questions or issues.
If you have other questions, feel free to ask them in the forum. If you need dedicated help, I’m pretty sure there are people available to do that for a fee :-) (not me at this time).
@rcolistete thanks for all the info. Is there anyway I can contact you one-on-one for further help ?
@jcaron thanks for all the info. Is there anyway I can contact you one-on-one for further help ?
@abhishek2101 Waking up once a day should be not problem to last for 2 years, but a few things can quickly derail your plan.
Let's say your LoPy 4 stays awake for 10 seconds (that's a bit long already) and draws 200 mA average (that's quite a lot) during those 10 seconds, and 30 µA the rest of the time.
Then you draw an average of
(10 * 200 + (86400-10)* 0.03) / 86400= 0.053 mA (53 µA).
With a 2500 mAh battery, than means over 5 years in ideal conditions.
But remember to keep your active time as limited as possible. If you suddenly decide you want to wake up every hour instead of every day for instance, you suddenly jump to 585 µA average, over 10 times more, and your battery life drops to less than 6 months.
Don't forget to actually measure how much power your device draws in real conditions (running on battery, with all the sensors, no USB...), how long you stay awake, etc. The difference between theory and reality can cause big surprises!
@rcolistete I am not using wifi, Bluetooth Sd card. Also no expansion boards.
Battery should last for at least 2 years.
rcolistete last edited by rcolistete
Have you tried machine.deepsleep([time_ms]) ?
Just use 24 x 3600 x 1000 as sleep time. When awaking from deep sleep, is almost the same as rebooting (just "machine.wake_reason()" returns different values).
The "lora.join(...)" can be avoided after the first time by using "lora.nvram_restore()" (after creating the "lora" object) and "lora.nvram_save()" after sending the LoRaWan packet.
The LoRaWan counters are preserved.
To specify the battery, you need to know how many days battery shoud last, the operation duty cycle (time awake / (time awake + time sleeping), the power consumption in each cycle.
Are you going to use LoPy4 alone or with another board like Expansion Board v2/v3.0/v3.1, or PyTrack, or PySense, etc ? LoPy4 current in deep sleep is about 20 uA when alone, hundreds of uA with Expansion Board.
If WiFi and Bluetooth are not needed, just disable them :
Even the presence or not, and type of microSD card in Expansion Board/etc, changes the power consumption :
MicroSD power consumption on Expansion Board, PyTrack, PySense, etc.
Search for deep sleep in this forum to have more details.