Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Jeddiah
#47930 I'm not sure if I'm missing something completely obvious or not, I decided to go with just regular ESP-01's that I just got in yesterday.

Here's my flash configuration.
Image

I know, hard to see how it's wired, but I'm able to flash it properly using this:

Image

The path's to the files aren't complete because I wanted to show which files are being used. I got the flasher program and the BIN files this morning.

This is it wired into the UNO.
Image

It's going through a level shifter on the TX/RX pins.

This is the sketch I'm using. Yes, I did remove the SSID, Pass and Webserver IP, but they're correct in my version here.
Code: Select all#include <SoftwareSerial.h>
#include <stdlib.h>

// RX ESP -> TX Arduino
// TX ESP -> RX Arduino
SoftwareSerial ESPSerial(2,3); // RX, TX

// this runs once
void setup() {               

  // enable debug serial
  Serial.begin(9600);
  // enable software serial
  ESPSerial.begin(9600);
 while(!ESPSerial){
  ;
  }
  // reset ESP8266
  ESPSerial.println("AT+RST");
 
  //conect to network
  ESPSerial.println("AT+CWMODE=1");
  ESPSerial.println("AT+CWJAP=\"<ssid>\",\"<pass>\"");

  delay(8000);
}


// the loop
void loop() {
 
  // TCP connection
  String cmd = "AT+CIPSTART=\"TCP,\"<webserverIP>\",\"80\"";
  Serial.println(cmd);
  ESPSerial.println(cmd);
   
  if(ESPSerial.find("Error")){
    Serial.println("AT+CIPSTART error");
    return;
  }
 
  // prepare GET string to send - page to get - val.php
  String getStr = "GET /test.php?string=";
  // String to display
  getStr += "fromESPv4";
  getStr += "\r\n\r\n";

Serial.println(getStr);

  // send data length
  cmd = "AT+CIPSEND=";
  cmd += String(getStr.length());
  ESPSerial.println(cmd);

Serial.println(cmd);

  if(ESPSerial.find(">")){
    ESPSerial.println(getStr);
  }
  else{
    ESPSerial.println("AT+CIPCLOSE");
    // alert user
    Serial.println("AT+CIPCLOSE");
  }
   
  delay(1000); 
}


I don't think this is part of the problem, but here's the PHP script using just to test things out. My script does work just doing it manually, so it's definitely something in the communication aspect, not the PHP script.
Code: Select all<?php
   $val = $_GET['string'];
   $bf = fopen("test.txt","w+");
   fwrite ($bf,$val);
   fclose($bf);
?>


Suggestions on what I"m doing wrong? Right now I'm not seeing any kind of serial activity (via the blinky blue LED) on the ESP8266
User avatar
By Jeddiah
#47945 More progress. I successfully wrote this version of firmware: v0.9.5.2 AT Firmware.bin and after that I was able to communicate with it in Putty and send all the commands I have in my Sketch manually. But for some reason, the ESP doesn't seem to be accepting them from the sketch. I'm closer, any ideas based upon the previously posted code what I could be doing wrong?

thanks!
User avatar
By martinayotte
#47949 Glad to hear that you figured out that some of the problem was power supply related ...

For the PHP script, what kind of server are you using ?
Because if it is only accepting HTTP/1.1 request and refuse to respond to HTTP/1.0, then your request will require the addition of "Host: <webserverIP>" before the "\r\n\r\n".
(you can verify if this is the issue by trying the current request in a telnet)