ESP2688 based weather station reporting only once, but not sending a followup

Hello, I have successfully put together a remote weather station using an ESP2688 (Huzzah) and a DHT22 and I have the station running. There is but one small issue. The code supplied does not allow for updating and the board goes to sleep and refuses to wake. I have tried tying the RST pin to pin 16 as per the instructions online suggest, but that seems not to work. I believe there is something missing in the code that might force an update. Manually hitting the reset button forces an update to wunderground. If anyone knows what might be going on here it’d be a great help if someone could pinpoint the issue. Thank you in advance.

I have posted the code below.

#include <ESP8266WiFi.h>
#include "DHT.h"    
#define DHTPIN          2   //Pin to attach the DHT
#define DHTTYPE DHT22       //type of DTH  
const char* ssid     = "Your SSID"; 
const char* password = "Your password";
const int sleepTimeS = 600; //18000 for Half hour, 300 for 5 minutes etc.
                               
///////////////Weather//////////////////////// 
char server [] = "weatherstation.wunderground.com";  
char WEBPAGE [] = "GET /weatherstation/updateweatherstation.php?";
char ID [] = "YourWeatherID";
char PASSWORD [] = "YourPasswordOfWunderground";


/////////////IFTTT///////////////////////
const char* host = "maker.ifttt.com";//dont change
const String IFTTT_Event = "YourEventName"; 
const int puertoHost = 80;
const String Maker_Key = "YourMakerKey";
String conexionIF = "POST /trigger/"+IFTTT_Event+"/with/key/"+Maker_Key +" HTTP/1.1\r\n" +
                    "Host: " + host + "\r\n" + 
                    "Content-Type: application/x-www-form-urlencoded\r\n\r\n";
//////////////////////////////////////////
DHT dht(DHTPIN, DHTTYPE);               
           


void setup()
{
  Serial.begin(115200);
  dht.begin();
  delay(1000);
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
}

void loop(){  
  //Check battery
  int level = analogRead(A0);
  level = map(level, 0, 1024, 0, 100);
  if(level<50)
  { 
   mandarNot(); //Send IFTT
   Serial.println("Low battery");
   delay(500);
  }
  //Get sensor data
  float tempc = dht.readTemperature(); 
  float tempf =  (tempc * 9.0)/ 5.0 + 32.0; 
  float humidity = dht.readHumidity(); 
  float dewptf = (dewPoint(tempf, dht.readHumidity())); 
  //check sensor data
  Serial.println("+++++++++++++++++++++++++");
  Serial.print("tempF= ");
  Serial.print(tempf);
  Serial.println(" *F");
  Serial.print("tempC= ");
  Serial.print(tempc);
  Serial.println(" *C");
  Serial.print("dew point= ");
  Serial.println(dewptf);
  Serial.print("humidity= ");
  Serial.println(humidity);
  
  //Send data to Weather Underground
  Serial.print("connecting to ");
  Serial.println(server);
  WiFiClient client;
  if (!client.connect(server, 80)) {
    Serial.println("Connection Fail");
    return;
  }
    client.print(WEBPAGE); 
    client.print("ID=");
    client.print(ID);
    client.print("&PASSWORD=");
    client.print(PASSWORD);
    client.print("&dateutc=");
    client.print("now");    
    client.print("&tempf=");
    client.print(tempf);
    client.print("&dewptf=");
    client.print(dewptf);
    client.print("&humidity=");
    client.print(humidity);
    client.print("&softwaretype=ESP%208266O%20version1&action=updateraw&realtime=1&rtfreq=2.5");
    client.println();
    delay(2500); 
    sleepMode();    

}


double dewPoint(double tempf, double humidity) //Calculate dew Point
{
  double A0= 373.15/(273.15 + tempf);
  double SUM = -7.90298 * (A0-1);
  SUM += 5.02808 * log10(A0);
  SUM += -1.3816e-7 * (pow(10, (11.344*(1-1/A0)))-1) ;
  SUM += 8.1328e-3 * (pow(10,(-3.49149*(A0-1)))-1) ;
  SUM += log10(1013.246);
  double VP = pow(10, SUM-3) * humidity;
  double T = log(VP/0.61078);   
  return (241.88 * T) / (17.558-T);
}

void mandarNot(){
  WiFiClient client;
  if (!client.connect(host, puertoHost)) //Check connection
  {
    Serial.println("Failed connection");
    return;
  }
  client.print(conexionIF);//Send information
  delay(10);
  while(client.available())
  {
    String line = client.readStringUntil('\r');
    Serial.print(line);
  }
}

void sleepMode(){
  Serial.print(F("Sleeping..."));
  ESP.deepSleep(sleepTimeS * 1000000);
}

ESP.deepSleep(sleepTimeS * 1000000);

Where you declared sleepTimeS as 600

So what does that get you in real time value? I make it 10 minutes.

Sorry I forgot it was micro not milli for this module. What happens if you make it 1 minute to help with checking?

And I'm sure you meant ESP8266 ?

Doh. Wrong maths with micros sorry.

Hmm posting playing up.

Move the loop code to setup and leave loop empty as it will rerun on wakeup reset.

tasmod: The RST pin is held at a HIGH signal while the ESP8266 is running. However, when the RST pin receives a LOW signal, it restarts the microcontroller. Once your device is in Deep-sleep, it will send a LOW signal to GPIO 16 when the sleep timer is up. You need to connect GPIO 16 to RST to wake up ( or reset ) the device when Deep-sleep is over.

First of all add a yield(); before the delay(2500); and the deepSleep(); we want to make sure that all wifi background processes are completed before, second are you still connected to you wifi network straight after wake up ? so how about straight after that do

 while (WiFi.status() != WL_CONNECTED) {
    yield();
    delay(500);
    Serial.print(".");
  }

and shouldn't the sleep setting be like this

ESP.deepSleep(sleepTimeS * 1000000UL);

tasmod: ESP.deepSleep(sleepTimeS * 1000000);

Where you declared sleepTimeS as 600

So what does that get you in real time value? I make it 10 minutes.

Sorry I forgot it was micro not milli for this module. What happens if you make it 1 minute to help with checking?

And I'm sure you meant ESP8266 ?

Yes, right... I was typing this in the dark. -- big storm .. .thanks for the help.

8266 it is.

Problem solved. I saw the code and examined it in further detail
In the area of the sketch that controls the sleep mode I added a void in front of the sleep mode.
I also added the UL at the end of the sketch…
Now the weather station transmits without stopping. I had it powered on a 2500mAh LiPo cell today for 10hrs… It was 99% charged when I took the station offline.

#include <ESP8266WiFi.h>
#include "DHT.h"    
#define DHTPIN          2   //Pin to attach the DHT
#define DHTTYPE DHT22       //type of DTH  
const char* ssid     = "Your SSID"; 
const char* password = "Your password";
const int sleepTimeS = 600; //18000 for Half hour, 300 for 5 minutes etc.
                               
///////////////Weather//////////////////////// 
char server [] = "weatherstation.wunderground.com";  
char WEBPAGE [] = "GET /weatherstation/updateweatherstation.php?";
char ID [] = "YourWeatherID";
char PASSWORD [] = "YourPasswordOfWunderground";


/////////////IFTTT///////////////////////
const char* host = "maker.ifttt.com";//dont change
const String IFTTT_Event = "YourEventName"; 
const int puertoHost = 80;
const String Maker_Key = "YourMakerKey";
String conexionIF = "POST /trigger/"+IFTTT_Event+"/with/key/"+Maker_Key +" HTTP/1.1\r\n" +
                    "Host: " + host + "\r\n" + 
                    "Content-Type: application/x-www-form-urlencoded\r\n\r\n";
//////////////////////////////////////////
DHT dht(DHTPIN, DHTTYPE);               
           


void setup()
{
  Serial.begin(115200);
  dht.begin();
  delay(1000);
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
}

void loop(){  
  //Check battery
  int level = analogRead(A0);
  level = map(level, 0, 1024, 0, 100);
  if(level<50)
  { 
   mandarNot(); //Send IFTT
   Serial.println("Check battery");
   delay(500);
  }
  //Get sensor data
  float tempc = dht.readTemperature(); 
  float tempf =  (tempc * 9.0)/ 5.0 + 32.0; 
  float humidity = dht.readHumidity(); 
  float dewptf = (dewPoint(tempf, dht.readHumidity())); 
  //check sensor data
  Serial.println("+++++++++++++++++++++++++");
  Serial.print("tempF= ");
  Serial.print(tempf);
  Serial.println(" *F");
  Serial.print("tempC= ");
  Serial.print(tempc);
  Serial.println(" *C");
  Serial.print("dew point= ");
  Serial.println(dewptf);
  Serial.print("humidity= ");
  Serial.println(humidity);
  
  //Send data to Weather Underground
  Serial.print("connecting to ");
  Serial.println(server);
  WiFiClient client;
  if (!client.connect(server, 80)) {
    Serial.println("Connection Fail");
    return;
  }
    client.print(WEBPAGE); 
    client.print("ID=");
    client.print(ID);
    client.print("&PASSWORD=");
    client.print(PASSWORD);
    client.print("&dateutc=");
    client.print("now");    
    client.print("&tempf=");
    client.print(tempf);
    client.print("&dewptf=");
    client.print(dewptf);
    client.print("&humidity=");
    client.print(humidity);
    client.print("&softwaretype=ESP%208266O%20version1&action=updateraw&realtime=1&rtfreq=2.5");
    client.println();
    delay(2500); 
    [color=yellow]void sleepMode();   [/color] 

}


double dewPoint(double tempf, double humidity) //Calculate dew Point
{
  double A0= 373.15/(273.15 + tempf);
  double SUM = -7.90298 * (A0-1);
  SUM += 5.02808 * log10(A0);
  SUM += -1.3816e-7 * (pow(10, (11.344*(1-1/A0)))-1) ;
  SUM += 8.1328e-3 * (pow(10,(-3.49149*(A0-1)))-1) ;
  SUM += log10(1013.246);
  double VP = pow(10, SUM-3) * humidity;
  double T = log(VP/0.61078);   
  return (241.88 * T) / (17.558-T);
}

void mandarNot(){
  WiFiClient client;
  if (!client.connect(host, puertoHost)) //Check connection
  {
    Serial.println("Failed connection");
    return;
  }
  client.print(conexionIF);//Send information
  delay(10);
  while(client.available())
  {
    String line = client.readStringUntil('\r');
    Serial.print(line);
  }
}

void sleepMode(){
  Serial.print(F("Sleeping..."));
[color=yellow]  ESP.deepSleep(sleepTimeS * 1000000UL);[/color]
}