Connect GPIO16 ( D0) and RST Pin for MCu to wakeup from deep sleep after specified Time.
After the Mqtt is sent , Put sleep in mqttPublishedCb ( callback ) .
system_deep_sleep(30000000) puts mcu to sleep for 30s.
If you want that system should not wakeup (no wakeup until rst pin to low )
system_deep_sleep(0)
=================================
load ...
WIFI_INIT
MQTT_InitConnection
MQTT_InitClient
mode : sta(18:fe:34:a1:c3:5f)
add if0
STATION_IDLE
scandone
STATION_IDLE
add 0
aid 6
pm open phy_2,type:2 0 0
cntconnected with SSID, channel 6
dhcp client start...
STATION_IDLE
ip:192.168.43.35,mask:255.255.255.0,gw:192.168.43.1MQTT Connecting.....
MQTT Connecting 2.....
TCP: Connect to ip 192.168.43.206:1883
espconn_connect = 0
MQTT: Connected to broker 192.168.43.206:1883
MQTT: Sending, type: 1, id: 0000
TCP: Sent
TCP: data received 4 bytes
MQTT: Connected to 192.168.43.206:1883
MQTT: Connected
MQTT: queuing publish, length: 23, queue size(0/2048)
MQTT: Sending, type: 3, id: 0000
TCP: Sent
MQTT: Published
rm match
pm close 7 0 0/1324668
del if0
usl
sul 0 0
TCP: Reconnect to 192.168.43.206:1883
deep sleep 30s=========================
Deep Sleep Option
- deep_sleep_set_option(0): Radio calibration after deep-sleep wake up depends
on init data byte 108. - deep_sleep_set_option(1): Radio calibration is done after deep-sleep wake
up; this increases the current consumption. - deep_sleep_set_option(2): No radio calibration after deep-sleep wake up;
this reduces the current consumption. - deep_sleep_set_option(4): Disable RF after deep-sleep wake up, just like
modem sleep; this has the least current consumption; the device is not able
to transmit or receive data after wake up.
I tried No RF calibration but it dosent work. Probably some bit has to be set in esp_data bin file….need to explore.
Hi Alok,
ReplyDeleteIs it possible to make that nodemcu stays alive all the time? I don't need that function deep sleep :) If yes let me know that info would be grateful! Thank you, Kes.