ESP8266 Tutorial problems.

I have been attempting the “ESP8266 Tutorial Part 2 – Connect to WiFi and Download from the Internet” from http://runtimeprojects.com/2016/10/esp8266-part-2-connect-to-wifi-and-download-from-the-internet/.

The hardware:
1 X FTD232
1 X ESP8266-01


The sketch is as follows:

//ESP8266 Tutorial Part 2 – Connect to WiFi and Download from the Internet



#include <ESP8266WiFi.h>

const char* ssid     = "Guest";
const char* password = "GuestNet";

const char* host = "feeds.reuters.com"; ///reuters/topNews

void setup() {
  Serial.begin(115200);
  delay(10);
  
  // We start by connecting to a WiFi network
  
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  
  WiFi.begin(ssid, password);
  
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");  
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
  delay(5000);

  Serial.print("connecting to ");
  Serial.println(host);
  
  // Use WiFiClient class to create TCP connections
  WiFiClient client;
  const int httpPort = 80;
  if (!client.connect(host, httpPort)) {
    Serial.println("connection failed");
    return;
  }
  // We now create a URI for the request
  String url = "/reuters/topNews";

  Serial.print("Requesting URL: ");
  Serial.println(url);

 // This will send the request to the server
  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" + 
               "Connection: close\r\n\r\n");
  unsigned long timeout = millis();
  while (client.available() == 0) {
    if (millis() - timeout > 5000) {
      Serial.println(">>> Client Timeout !");
      client.stop();
      return;
    }
  }
  // Read all the lines of the reply from server and print them to Serial

  while(client.available()){
    String line = client.readStringUntil('\r');
    Serial.print(line);
  }
  
  Serial.println();
  Serial.println("closing connection");
}

The Verbose output during upload:

Archiving built core (caching) in: C:\Users\***\AppData\Local\Temp\arduino_cache_798503\core\core_esp8266_esp8266_generic_CpuFrequency_80,ResetMethod_ck,CrystalFreq_26,FlashFreq_40,FlashMode_qio,FlashSize_512K0,led_2,LwIPVariant_v2mss536,Debug_Disabled,DebugLevel_None____,FlashErase_none,UploadSpeed_115200_5bf1b45ea7a7f392dc7124516af61bc9.a
Sketch uses 259000 bytes (51%) of program storage space. Maximum is 499696 bytes.
Global variables use 33276 bytes (40%) of dynamic memory, leaving 48644 bytes for local variables. Maximum is 81920 bytes.
C:\Users\*** \AppData\Local\Arduino15\packages\esp8266\tools\esptool\0.4.13/esptool.exe -vv -cd ck -cb 115200 -cp COM5 -ca 0x00000 -cf C:\Users\***\AppData\Local\Temp\arduino_build_701927/AP_Connect.ino.bin 
esptool v0.4.13 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
 setting board to ck
 setting baudrate from 115200 to 115200
 setting port from COM1 to COM5
 setting address from 0x00000000 to 0x00000000
 espcomm_upload_file
 espcomm_upload_mem
 setting serial port timeouts to 1000 ms
opening bootloader
resetting board
trying to connect
 flush start
 setting serial port timeouts to 1 ms
 setting serial port timeouts to 1000 ms
 flush complete
 espcomm_send_command: sending command header
 espcomm_send_command: sending command payload
 read 0, requested 1
trying to connect
 flush start
 setting serial port timeouts to 1 ms
 setting serial port timeouts to 1000 ms
 flush complete
 espcomm_send_command: sending command header
 espcomm_send_command: sending command payload
 espcomm_send_command: receiving 2 bytes of data
 espcomm_send_command: receiving 2 bytes of data
 espcomm_send_command: receiving 2 bytes of data
 espcomm_send_command: receiving 2 bytes of data
 espcomm_send_command: receiving 2 bytes of data
 espcomm_send_command: receiving 2 bytes of data
 espcomm_send_command: receiving 2 bytes of data
 espcomm_send_command: receiving 2 bytes of data
Uploading 263152 bytes from C:\Users\***\AppData\Local\Temp\arduino_build_701927/AP_Connect.ino.bin to flash at 0x00000000
 erasing flash
 size: 0403f0 address: 000000
 first_sector_index: 0
 total_sector_count: 65
 head_sector_count: 16
 adjusted_sector_count: 49
 erase_size: 031000
 espcomm_send_command: sending command header
 espcomm_send_command: sending command payload
 setting serial port timeouts to 15000 ms
 setting serial port timeouts to 1000 ms
 espcomm_send_command: receiving 2 bytes of data
 writing flash
................................................................................ [ 31% ]
................................................................................ [ 62% ]
................................................................................ [ 93% ]
.................                                                                [ 100% ]
starting app without reboot
 espcomm_send_command: sending command header
 espcomm_send_command: sending command payload
 espcomm_send_command: receiving 2 bytes of data
closing bootloader
 flush start
 setting serial port timeouts to 1 ms
 setting serial port timeouts to 1000 ms
 flush complete

It looks to me - the uninitiated - as if the device is sending a copy of the memory contents to the monitor instead of the intended output. I have passed this info to the producers of the tutorial but had no answer.

Regards John (I hope this is not too heavy. :slight_smile:

jd2117: It looks to me - the uninitiated - as if the device is sending a copy of the memory contents to the monitor instead of the intended output. I have passed this info to the producers of the tutorial but had no answer.

It is how it should be. The poitns show the progress. You have a little longer sync time (more "receiving 2 bytes of data") but it is not unusual.

The Flash upload worked but there are no messages from the sketch. This can happen if the ESP8266 does not receive enough power. Most USB to serial devices cannot supply more 100 mA @ 3.3V which is not enough for an ESP8266. Find a better tutorial that explains how to power an ESP8266.

The Flash upload works because the WiFi radio is turned off during this time. Once the upload is done, the ESP8266 turns on the WiFi radio and tries to run the sketch. If the ESP8266 does not receive enough power, it crashes before the sketch starts.

Thanks gdsports, I will try powering the device from a battery.

Regards John