AT Command questions
Posted: Tue Aug 03, 2021 10:05 pm
I'm trying to send data from my DIY weather station to a website using AT Commands. Whenever the GET statement's length exceeds about 270 characters the AT+CIPSEND fails. I'm not saying it is exactly 270 but around there. It varies from time to time. I'm wondering if anyone else has experienced this and could offer some advice. Thanks
Here is the function that is in question. I have also attached the complete sketch.
void sendStringWUnderground(float windSpeedMPH, float gustWindSpeedMPH){
String cmd1 = "AT+CIPSTART=\"TCP\",\"";
cmd1 += "rtupdate.wunderground.com"; // wunderground
cmd1 += "\",80";
Serial.println(cmd1);
esp8266Module.println(cmd1);
if (esp8266Module.find("Error")) {
Serial.println("AT+CIPSTART error");
return;
}
String cmd = "GET /weatherstation/updateweatherstation.php?;
cmd += ID;
cmd += "&PASSWORD=";
cmd += PASSWORD;
cmd += "&dateutc=now";
cmd += "&winddir=";
cmd += getCalulatedDirection();
//cmd += "&windspeedmph=";
//cmd += windSpeedMPH;
//cmd += "&windgustmph=";
//cmd += gustWindSpeedMPH;
cmd += "&tempf=";
cmd += getTemperatureValue();
cmd += "&dewptf=";
cmd += getDewPointValue();
cmd += "&humidity=";
cmd += getHumidityValue();
//cmd += "&baromin=";
//cmd += getBarPresValue();
//cmd += "&solarradiation=";
//cmd += solar;
//cmd += "&UV=";
//cmd += UVmax;
//cmd += "&rainin=";
//cmd += rain1h;
//cmd += "&dailyrainin=";
//cmd += rain24h;
cmd += "&softwaretype=Arduino-ESP8266&action=updateraw&realtime=1&rtfreq=30"; // &softwaretype=Arduino%20UNO%20version1
cmd += "/ HTTP/1.1\r\nHost: rtupdate.wunderground.com:80\r\nConnection: close\r\n\r\n";
cmd1 = "AT+CIPSEND=";
cmd1 += String(cmd.length());
Serial.println(cmd1);
esp8266Module.println(cmd1);
if (esp8266Module.find(">")) {
Serial.println(cmd);
esp8266Module.print(cmd);
Serial.println("Data send OK");
}
else {
esp8266Module.println("AT+CIPCLOSE");
Serial.println("Connection closed");
Serial.println(" ");
}
}
Here is the function that is in question. I have also attached the complete sketch.
void sendStringWUnderground(float windSpeedMPH, float gustWindSpeedMPH){
String cmd1 = "AT+CIPSTART=\"TCP\",\"";
cmd1 += "rtupdate.wunderground.com"; // wunderground
cmd1 += "\",80";
Serial.println(cmd1);
esp8266Module.println(cmd1);
if (esp8266Module.find("Error")) {
Serial.println("AT+CIPSTART error");
return;
}
String cmd = "GET /weatherstation/updateweatherstation.php?;
cmd += ID;
cmd += "&PASSWORD=";
cmd += PASSWORD;
cmd += "&dateutc=now";
cmd += "&winddir=";
cmd += getCalulatedDirection();
//cmd += "&windspeedmph=";
//cmd += windSpeedMPH;
//cmd += "&windgustmph=";
//cmd += gustWindSpeedMPH;
cmd += "&tempf=";
cmd += getTemperatureValue();
cmd += "&dewptf=";
cmd += getDewPointValue();
cmd += "&humidity=";
cmd += getHumidityValue();
//cmd += "&baromin=";
//cmd += getBarPresValue();
//cmd += "&solarradiation=";
//cmd += solar;
//cmd += "&UV=";
//cmd += UVmax;
//cmd += "&rainin=";
//cmd += rain1h;
//cmd += "&dailyrainin=";
//cmd += rain24h;
cmd += "&softwaretype=Arduino-ESP8266&action=updateraw&realtime=1&rtfreq=30"; // &softwaretype=Arduino%20UNO%20version1
cmd += "/ HTTP/1.1\r\nHost: rtupdate.wunderground.com:80\r\nConnection: close\r\n\r\n";
cmd1 = "AT+CIPSEND=";
cmd1 += String(cmd.length());
Serial.println(cmd1);
esp8266Module.println(cmd1);
if (esp8266Module.find(">")) {
Serial.println(cmd);
esp8266Module.print(cmd);
Serial.println("Data send OK");
}
else {
esp8266Module.println("AT+CIPCLOSE");
Serial.println("Connection closed");
Serial.println(" ");
}
}