Hi,
I’m trying to use dweet.io trough an ESP8266 ESP-1 module connected to an Arduino Uno board.
The problem is that I’m able to make a connection trough AT+CIPSTART when using AT commands directly on the ESP8266, but i’m unable to do the same throughout an Arduino sketch via SoftwareSerial!
I used my own web server to see why it fails, and the direct AT commands that worked are these:
AT+CIPSTART=0,"TCP","homepages.myownsite.com",80
AT+CIPSEND=0,70
GET /docs/TestDocument.pdf HTTP/1.1
Host: homepages.myownsite.com
AT+CIPCLOSE=0
However, this sketch with the same AT commands fails:
#include <SoftwareSerial.h>
#include <stdlib.h>
// RX ESP -> TX Arduino
// TX ESP -> RX Arduino
SoftwareSerial ESPSerial(10, 11); // RX, TX
// this runs once
void setup() {
// enable debug serial
Serial.begin(9600);
// enable software serial
ESPSerial.begin(115200);
delay(2000);
Serial.println("AT+CIPMUX=1");
ESPSerial.println("AT+CIPMUX=1");
}
// the loop
void loop() {
delay(2000);
Serial.println("AT+CIPSTART=0,\"TCP\",\"homepages.myownsite.com\",80");
ESPSerial.println("AT+CIPSTART=0,\"TCP\",\"homepages.myownsite.com\",80");
delay(2000);
Serial.println("AT+CIPSEND=0,70");
ESPSerial.println("AT+CIPSEND=0,70");
delay(2000);
Serial.print("GET /docs/TestDocument.pdf HTTP/1.1\r\nHost: homepages.myownsite.com\r\n\r\n");
ESPSerial.print("GET /docs/TestDocument.pdf HTTP/1.1\r\nHost: homepages.myownsite.com\r\n\r\n");
delay(6000);
//Close connection
Serial.println("AT+CIPCLOSE=0");
ESPSerial.println("AT+CIPCLOSE=0");
}
To monitor the response of my Web server I used the command sudo tail -f /var/log/apache2/access.log
. I noticed that with the direct AT commands I always get a response, even when it was a 400
response. However, with the sketch there isn’t any response, and yes I also tried with a bigger sketch where all the connections are established, including AT+CWJAP
, and everything works just fine until the GET
command, it looks like the SoftwareSerial is unable to post HTML commands like GET
!
It would be helpful to see the Serial ESP8266 response to the sketch commands, but I don’t know how to do it, I’m only able to monitor the Arduino Serial (9600) when commanding the board trough a sketch!
Any suggestions?
Thanks