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

User avatar
By Jeddiah
#47965
martinayotte wrote:Ah ! Ok !
Do you have proper communication between ESP and Arduino ?
Using the FTDI with RX only, you can sniff this communication just to make sure Arduino is sending the right thing.
(it can be as simple as all lines doesn't have CRLF)


Thanks for that idea, I just started doing that, and now I can see the traffic between the Arduino and ESP-01. I'll see if I can figure out what's wrong.
User avatar
By Jeddiah
#47967 Ok, I've solved the AT command problems, it was all related to timing of sending the commands. I added a couple of delays in between the AT's and now that's working. Just trying to figure out the problem with sending the data now. I keep getting a "busy s..." and a truncated string that I'm trying to send.

I did add a delay between the AT+CIPSEND and the GET line.
User avatar
By Jeddiah
#47970 I finally got it!

Code: Select all#include <SoftwareSerial.h>

// RX ESP -> TX Arduino
// TX ESP -> RX Arduino
SoftwareSerial ESPSerial(2,3); // RX, TX
int rstpin=12; // ESP8266 Reset Pin

void setup() {               

  // enable debug serial
  Serial.begin(115200);
  // enable software serial
  pinMode(rstpin,OUTPUT);

  // reset ESP8266
  digitalWrite(rstpin,LOW);
  delay(1000);
  digitalWrite(rstpin,HIGH);
  delay(1000);
  // Initialize and Reset ESP-01
  ESPSerial.begin(115200);
  ESPSerial.print("AT+RST\r\n");
  delay(2000);
  ESPSerial.print("AT+CIOBAUD=9600\r\n"); // Set Baud rate back to 9600
  ESPSerial.begin(9600);
  delay(500);
 
  //conect to network
  ESPSerial.print("AT+CWMODE=1\r\n"); // Set to Station Mode
  delay(2000);
  ESPSerial.println("AT+CWJAP=\"<SSID>\",\"<PASSWORD>""); // Connect to Network
  delay(4000);
  ESPSerial.println("AT+CIPSTA=\"<STATICIP>\""); // Set Static IP
  delay(2000);
}

void loop() {

  // TCP connection
  String start = "AT+CIPSTART=\"TCP\",\"<WEBSERVER>\",80"; // Set Mode and Server
  String getStr = "GET /test.php?data=999\r\n"; // Get String
  String cmd = "AT+CIPSEND=";
  cmd += String(getStr.length());

// Send Data 
  ESPSerial.println(start);
  if(ESPSerial.find("CONNECT")){
    delay(2000);
  ESPSerial.println(cmd);
  }
  if(ESPSerial.find("OK")){
    delay(2000);
    ESPSerial.print(getStr);
  }
  delay(5000); 

}


Thanks for the help!