-->
Page 1 of 1

Wemos D1 mini stops after deepsleep

PostPosted: Sun Aug 25, 2019 5:22 pm
by perody
Dear all,


I have been struggling to get deepSleep working.

My plan is to read some data from a serial port and send to an OpenHAB installation with mqtt. However, to keep the power consumption at an acceptable level, deep sleep should be used most of the time.

I use the Wemos D1 mini and have loaded the script below with Arduino IDE version 2.4.0.

Code: Select all#include <ESP8266WiFi.h>

const char* ssid = "<my SSID>";
const char* password = "<my passwd>";
char* outputMessage[500] = {'\0'};


IPAddress ip(192, 168, 1, 217);      // desired IP address
IPAddress gateway(192, 168, 1, 1); // IP address of my router
IPAddress subnet(255, 255, 255, 0);


WiFiClient client;

void setup() {

  Serial.begin(74880);
  Serial.setDebugOutput(true);
  delay(100);

  WiFi.mode(WIFI_STA);
  if (WiFi.status() != WL_CONNECTED) {
    WiFi.begin(ssid, password);
    Serial.print(".");
  }
  WiFi.config(ip, gateway, subnet);

  IPAddress myip = WiFi.localIP();
  sprintf((char*)outputMessage, "Connected to %u.%u.%u.%u after %d ms. Will wait 10s before sleep.\r\n", myip[0], myip[1], myip[2], myip[3], millis());
  Serial.print((char*)outputMessage);

delay(10000);

  // GPIO16 (D0) connected to RST with 1k resistor
  Serial.println("Bedtime. Good night...");
  ESP.deepSleep(5000000);
}

void loop() {
}



Printout is as follows:

Code: Select allStart...
scandone
.STUB: dhcp_stop
Connected to 192.168.1.217 after 5045 ms. Will wait 10s before sleep.
Bedtime. Good night...
scandone
del if0
usl
enter deep sleep⸮
 ets Jan  8 2013,rst cause:5, boot mode:(1,6)

ets_main.c


I then need to push reset to run the script again, and get the following:
Code: Select allets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v4ceabea9
~ld

Start...
scandone
.STUB: dhcp_stop
Connected to 192.168.1.217 after 319 ms. Will wait 10s before sleep.
Bedtime. Good night...
scandone
del if0
usl
enter deep sleep⸮⸮
 ets Jan  8 2013,rst cause:5, boot mode:(3,6)

ets_main.c


How can I get the script repeating itself after deep sleep? It simply stops after writing the exit values and "ets_main.c"

Hope to get some ideas on what I am missing.

Best regards

Per

Re: Wemos D1 mini stops after deepsleep

PostPosted: Mon Aug 26, 2019 3:15 am
by Bonzo
First thing I would try is putting everything after setup into loop.

Re: Wemos D1 mini stops after deepsleep

PostPosted: Mon Aug 26, 2019 4:43 am
by schufti
the relevant thing you missed is doing a board search before posting ....

Re: Wemos D1 mini stops after deepsleep

PostPosted: Mon Aug 26, 2019 3:14 pm
by perody
Hello,

After performing some tests on the resistor between D0 and RST, I have found that 150 ohm allows new sketches to be uploaded, and also enables RST from D0 so that deepsleep executes properly.

With 1 kohm the deepsleep do not properly start, and with a wire between D0 and RST I was not able to upload new sketches without disconnecting the wire.

With 150 ohm, both functions seems to function as they should.

Thanks to you who have commented and tried to help in this.

Best regards

Per