Learn NODEMCU low-power sleep

Source: Internet
Author: User

most IOT application is battery-powered, in the case of a certain amount of battery power (volume, environment, etc.), the consumption of electricity determines the life of the product, determines whether the product is practical. The main purpose of this paper is to learn about The dormancy mechanism of NODEMCU.

Nodemcuof theApi


Https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en#nodedsleep


Node.dsleep () Description

Enter deep sleep mode, and wake up is timed out.

Syntax

node.dsleep(us, option)

Note: This function can is only being used in thecondition that esp8266 PIN32 (RST) and PIN8 (XPD_DCDC aka GPIO16) areconnected together . Using Sleep (0) would set no wake up timer, connecta GPIO to pin RST, the chip would wake up by a falling-edge on Pinrst.
option=0, init data byte 108 is valuable;
Option>0,init Data byte 108 is valueless.
More details as follows:
0,rf_cal or not after deep-sleep wake up, depends on init data byte108.
1, rf_cal after Deep-sleep wake up, there would belargecurrent.
2, no rf_cal after Deep-sleep wake up, there would only besmall current.
4, disable RF after Deep-sleep wake up, just likemodem sleep, there would be the smallest current.

Parameters
    • us: Number (Integer) or nil,sleep time in micro second. If US = 0, it'll sleep forever. If us= Nil, would not set sleep time.

    • option: Number (Integer) or nil. If option = nil, it would use the last alive setting as Default option.

Returns
    • nil

Example
    --do nothing    node.dsleep ()    --sleepμs    node.dsleep (1000000)    --set sleep option, then sleepμs    Node.dsleep (1000000, 4)    --set sleep option only    node.dsleep (nil,4)


NodemcuSource Code

Https://github.com/nodemcu/nodemcu-firmware/blob/fa7cf87832fc9905df98f9435c149d40f314dee8/app/modules/node.c


static int node_deepsleep (lua_state* L)

{

S32 us, option;

US = Lual_checkinteger (L, 1);

Set deleep option, skip if nil

if (Lua_isnumber (L, 2))

{

option = Lua_tointeger (L, 2);

if (Option < 0 | | option >4)

Return Lual_error (L, "Wrongarg range");

Else

deep_sleep_set_option (option);

}

Set deleep time, skip if nil

if (Lua_isnumber (L, 1))

{

US = Lua_tointeger (L, 1);

if (US <= 0)

if (US < 0)

Return Lual_error (L, "Wrongarg range");

Else

System_deep_sleep (US);

}

return 0;

}


Https://github.com/nodemcu/nodemcu-firmware/blob/84a9ab35a8eb9b4ae2229bba7b2626c2a285818d/include/user_interface.h


BOOL System_deep_sleep_set_option (uint8option);

void System_deep_sleep (uint32time_in_us);


ESP8266 Specifications

Http://www.seeedstudio.com/document/pdf/ESP8266%20Specifications%28Chinese%29.pdf

Ten Power Management


the chip can be tuned into the following States :


  • Close (OFF): The CHIP_PD pin is in a low power state. RTC fails. All registers are emptied.

  • deep sleep (deep_sleep): Rtc open , rtc Internal recovery memory Wifi connection information.

  • sleep (sleep): Rtc running. Crystal oscillator stopped. Wake on any part (mac, host, rtc timer, external Sleep broken ) will make the entire chip wake up 。

  • Wake up (WAKEUP): in this state , the system moves from sleep to start (PWR) state. Both the crystal oscillator and the PLL are turned to the enable state.

  • Open State(ON):high-speed clock can be run,the modules that are sent to each clock control register enable. Each module,includeCpuinside,performs a low-level clock gating. When the system is operating,can be done byWaitiCommand CloseCpuinternal clock.



The following data is based on a 3.3V power supply, ambienttemperature 25C and use the internal regulator measured. [1] allmeasurements is made in the absence of the SAW filter, the Antennainterface is completed. [2] All transmit data based on 90% dutycycle, continuous transmission mode in the measured.

Mode

Min

Typical

Max

Units

802.11B, CCK 1Mbps, pout=+19.5dbm

215

MA

802.11B, CCK 11Mbps, pout=+18.5dbm

197

MA

802.11g, OFDM 54Mbps, pout=+16dbm

145

MA

802.11n, MCS7, POUT =+14dbm

135

MA

802.11B, packet size of bytes, -80dbm

60

MA

802.11B, packet size of bytes, -70dbm

60

MA

802.11B, packet size of bytes, -65dbm

62

MA

Standby

0.9

Ua

Deep sleep

10

MA

Saving Mode DTIM 1

1.2

MA

Saving Mode DTIM 3

0.86

MA

Shutdown

0.5

Ua


Https://nurdspace.nl/ESP8266#Technical_Overview


Other Resources

Low Power esp8266–sleeping at + micro Amps

http://blog.csdn.net/coolwaterld/article/details/45365749

ESP8266 in deep sleep

http://blog.csdn.net/coolwaterld/article/details/45365841

Building a battery powered WiFi IoT Sensor with ESP8266, MS-5611 (GY-63), NODEMCU and MQTT

http://blog.csdn.net/coolwaterld/article/details/45366003

Designing an Ultra low Power Sensor solution with ESP8266

Https://github.com/EspressifSystems/low_power_voltage_measurement/wiki

Https://github.com/EspressifSystems/low_power_voltage_measurement

This was a project for ESP8266 for the low power sensor applications. The chip powers on once every 1 minute to measure it's own powersupply, and sends the data to the server, once every MI Nutes. Ofcourse, you can configure the chip to does other things such asmeasuring temperature or humidity, etc. The project is now based Onespressif ' s SDK version 1.0.1b. More details on the project can befound in the Wiki.

Learn NODEMCU low-power sleep

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.