# Micro:bit Deep Sleep Function 

**URL:** <https://forum.makecode.com/t/micro-bit-deep-sleep-function/36365>\
**Category:** micro:bit\
**Created:** [May 4, 2025, 7:34pm UTC](https://forum.makecode.com/t/micro-bit-deep-sleep-function/36365 "2025-05-04T19:34:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PaulGeorge321](https://avatars.discourse-cdn.com/v4/letter/p/e95f7d/32.png) [@PaulGeorge321](https://forum.makecode.com/u/PaulGeorge321)\
**Post date:** [May 4, 2025, 7:34pm UTC](https://forum.makecode.com/t/micro-bit-deep-sleep-function/36365/1 "2025-05-04T19:34:17Z")

</div>

Hey there! I am coding a project using the blocks (pictures attached below) editor that uses the Sparkfun Weatherbit, soil moisture sensor, and a soil temperature sensor. My plan is to use the Microbit data logger function to log data from the Weatherbit and its extensions every 30 minutes. However, the Microbit and the Weatherbit will be powered on for a long period of time and the soil moisture sensor that I am planning to use will corrode quickly as power is continuously flowing through the sensor. So, I asked the Sparkfun community forum and they told me to use the deep sleep functions in the link below:

> **[Power Management V2 — BBC micro:bit MicroPython 2 documentation](https://microbit-micropython.readthedocs.io/en/v2-docs/power.html#power.deep_sleep)**

I am planning to use the **power.deep\_sleep()** function so that the microbit can wake up every 30 minutes.  
This website only states how to use these functions in the Python editor, and I have no experience using Python. Because of this, I do not know which part of my code I should modify and where in the Python editor I should put the **power.deep\_sleep()** function.

Here are the pictures of my code in the blocks editor:

 ![Code Image 3](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/f/0/f04a46e9a1318f343907310d608bc1de04de36d0.png)

Can you help me with this?
