Sending a HTTP string to the ESP using a Public IP address
Posted: Sun Jan 22, 2017 6:07 am
Hello ESP Community,
I'm trying to send a HTTP string to the ESP8266 using it as a server AT+CIPSERVER=1,80.
I've opened the port 80 of my Technicolor Modem and assigned it to the ESP module.
If I send LED=0 to the ESP using the loacal IP address assigned it by the Modem it works correclty (http://192.168.1.210:80/led=0):
If instead I try to do the same thing sending the message with my public IP address (http://2.xxx.xx.xx:80/led=0) it doesn't answer at all.
To access the serial communication with the ESP8266 I first use the following simple sketch with Arduino due:
...then I send AT commands for debug using the Serial Monitor of the Arduino IDE. Hereafter the command that I use to setup the ESP8266 for the comunication:
Am I doing something wrong?
Shall I add/modify some piece of code to access from a public IP address?
Thanks in advance for you support.
I'm trying to send a HTTP string to the ESP8266 using it as a server AT+CIPSERVER=1,80.
I've opened the port 80 of my Technicolor Modem and assigned it to the ESP module.
If I send LED=0 to the ESP using the loacal IP address assigned it by the Modem it works correclty (http://192.168.1.210:80/led=0):
Code: Select all
+IPD,1,410:GET /led=0 HTTP/1.1
Host: 192.168.1.210
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
Accept: text/htmlnaxa;p tceq0
If instead I try to do the same thing sending the message with my public IP address (http://2.xxx.xx.xx:80/led=0) it doesn't answer at all.
To access the serial communication with the ESP8266 I first use the following simple sketch with Arduino due:
Code: Select all
int LED = 13;
boolean LEDst = false;
//always high
int CH_PD_8266 = 53;
void setup() {
Serial.begin(9600); //quello che imposto nel monitor seriale cioè la comunicazione tra Arduino e PC
Serial3.begin(115200);
pinMode(LED, OUTPUT);
digitalWrite(LED, LEDst);
pinMode(CH_PD_8266, OUTPUT);
digitalWrite(CH_PD_8266, HIGH);
}
void loop() {
while (Serial.available() > 0) {
char a = Serial.read();
Serial3.write(a);
}
}
void serialEvent3() {
while (Serial3.available() > 0) {
char a = Serial3.read();
Serial.write(a);
ToggleLED();
}
}
void ToggleLED(){
digitalWrite(LED, LEDst = !LEDst);
}
...then I send AT commands for debug using the Serial Monitor of the Arduino IDE. Hereafter the command that I use to setup the ESP8266 for the comunication:
Code: Select all
AT+RST
AT+CWQAP
AT+CWMODE=1
AT+CWLAP
AT+CWJAP="MyUserName","MyPassword"
AT+CIPMUX=1
AT+CIPSERVER=1,80
Am I doing something wrong?
Shall I add/modify some piece of code to access from a public IP address?
Thanks in advance for you support.