I have been trying to create a temperature/humidity logger using one of these ESP8266-based dev-kits. I wrote a simple sketch that sends a request to a (working) web server, using GET for simplicity.

Below is the sketch:

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <DHTesp.h>

#define ssid "ssid"
#define password "password"

  #define DEVICE_ID 1

DHTesp dht;

void setup() {

void loop() {

  WiFi.begin(ssid, password);

  HTTPClient http;

  float temperature = dht.getTemperature();
  float humidity = dht.getHumidity();


  while (WiFi.status() != WL_CONNECTED) {delay(10);}


  char str_temp[10] = {'-'};
  char str_temp2[10] = {'-'};

  dtostrf(temperature, 2, 2, str_temp);
  dtostrf(humidity, 2, 0, str_temp2);

  char query[400];

  sprintf(query, "", DEVICE_ID, str_temp, str_temp2);

  int httpCode = http.GET();

  if (httpCode > 0) {
    Serial.printf("[HTTP] GET... code: %d\n", httpCode);

    if (httpCode == HTTP_CODE_OK) {
      String payload = http.getString();
  } else {
    Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());


Here is a brief explanation:

When the module powers up, it gets the data from a DHT22 sensor, and sends it to the server. It then goes to sleep for 10 minutes and resets. (D0 and RST are connected)

For some reason, nothing seems to work correctly, I don't even get the first Debug print. BAUD rate is 115200, and this is the Serial output:

1384, room 16
tail 8
chksum sd$⸮⸮|⸮l⸮| ⸮ $⸮c<ǃ⸮⸮{⸮c⸮ #⸮⸮no⸮$g'⸮⸮⸮cp⸮⸮dsd;lx⸮o⸮ ⸮ d ⸮⸮ co⸮|l⸮ ⸮c⸮⸮gn⸮dćd⸮ogl n{⸮⸮⸮g ⸮⸮ s⸮⸮' ⸮⸮sۓnl⸮|⸮⸮ ⸮{⸮o⸮#⸮o#x⸮sd$⸮⸮|⸮l⸮| ⸮$⸮c|ǃ⸮⸮{⸮c⸮ b⸮⸮ng⸮$gn⸮⸮⸮cp⸮⸮dsdrd8⸮o⸮ ⸮ $ ⸮⸮ #g⸮|l⸮ ⸮c⸮⸮'o⸮d⸮⸮d⸮g'lo;⸮⸮⸮g ⸮⸮s⸮⸮' ⸮⸮{ۓol⸮|⸮⸮⸮{⸮⸮o⸮#⸮g#x⸮sdlܟ<⸮l⸮< ⸮l⸮c|⸮⸮⸮⸮{⸮c⸮ b⸮⸮og⸮lgn⸮⸮⸮cp⸮⸮dsdsd8⸮g⸮ ⸮$ ⸮⸮ #g⸮|d⸮ ⸮c⸮⸮'o⸮d⸮⸮$⸮g' lo;Ǜ⸮' ⸮⸮s⸮⸮n ⸮⸮{⸮⸮ol⸮|⸮⸮⸮;⸮⸮g⸮b⸮gbx⸮{ll⸮⸮|⸮d⸮| ⸮l⸮ c|⸮⸮⸮⸮r⸮c⸮c⸮⸮g'⸮lno⸮⸮⸮ b8x⸮⸮l{l{${ll⸮⸮|⸮d⸮| ⸮ l⸮ #|⸮⸮⸮⸮r⸮#⸮c⸮⸮gn⸮log⸮⸮⸮ bx⸮⸮l;l{$p⸮'⸮ ⸮l⸮⸮ c n⸮|$⸮ ⸮b⸮⸮og⸮l⸮⸮l ⸮no $gs⸮ۓo ⸮⸮;⸮⸮o⸮⸮⸮r⸮⸮gd⸮|⸮⸮⸮s⸮⸮'⸮c⸮ncp⸮

Where the random code inserts are just characters and nothing special.

  • Is your serial monitor set to 115200 baud? – jose can u c Apr 12 '18 at 19:27
  • @josecanuc it is. – DaniFoldi Apr 12 '18 at 19:28
  • 1
    I have a Wemos D1 mini, which uses the ESP8266. I ran your code and it works fine. The ESP outputs some debug information (that is, the 1384, room 16, tail 8, etc.) before it starts executing the user code. For my hardware, the ESP's native debug output is at 74880 baud, and looks like gibberish at 115200, but the user code (printing of Debug is fine.) What devkit are you using? – jose can u c Apr 12 '18 at 19:49
  • It's one that has no well-known mark (Wemos, LoLin, etc.), just an ESP8266 IC with the flash next to it. The bottom silkscreen says WiFi-ESP8266 USB-TTLCH340 (I will find a LoLin and try on that) – DaniFoldi Apr 12 '18 at 19:58
  • 1
    For troubleshooting, I would a) set baud in the sketch to 74880, so you can see both the native boot info and your debug, and b) try a simple sketch first ... i.e. blink, and then try your code without WiFi requirement, i.e. print results to serial – Jaromanda X Apr 12 '18 at 23:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.