AT cmd - CIPSEND, no response after SEND OK

Hey guy Im trying to send AT cmd to a ESP8266, to connected to a API from school and then return the content.
I managede to get the ESP to connect to a AP (in this case my phone).
And I can get a TCP connection with the API (DNS not working, so using the IP instead).
But i want to get the data of the website.

When you go there you just get a HTML page with Json information. I want to get that JSON information.

I also read this post, but I unclear if i need to send the \r\n too.

IP of the website: 145.92.228.31

For testing Im using putty to send the info

AT+CIPSEND=4,57
GET /crypto/ADA HTTP/1.1\r\n Host: www.api.iot.hva-robots.nl\r\n\r\n

Are these 57 bytes too? or am I sending this wrong?

\r\n entered in putty is not converted to line ending characters

I copy the data in to putty, does this a problem too? Because when i past it the command is send intimately.

It will work since you specified the length in the CIPSEND command. The ESP8266 will accept the \r\n literally until you send the total bytes specified

So what will the correct data be??

AT+CIPSEND=4,55
GET /crypto/ADA HTTP/1.1\r\n Host: www.api.iot.hva-robots.nl\r\n

I thing I have a incorrect length specified.

As Juraj specified, typing \r\n in Putty does not result in \r\n being sent as it is interpreted literally by Putty. That is equivalent to 4 characters instead of the desired 2.

Oke but what will the command will be for Putty, im really missing the point here

I don't think its possible to "type" \r\n in Putty and send that as a newline and carriage return. You need a different terminal program. You can try CoolTerm

Change it to hex view and replace the \r\n into their corresponding hex code

eee

5C 72 (\r) just becomes 0D
5C 6E (\n) just becomes 0A

I just found this out, you can actually "type" a newline and CoolTerm will replace it for you. Indeed really cool...

fff

ggg

Knipsel

SoftwareSerial espSerial(RX_PIN, TX_PIN); // RX, TX'

void setup() {
  Serial.begin(9600);
  espSerial.begin(9600);
  espSerial.write("ATE0\r\n");
  espSerial.write("AT+CIPMUX=1\r\n"); 
}

void loop() {
    espSerial.write("AT\r\n");
    delay(1000);
    espSerial.write("AT+CIPSTART=4,\"TCP\",\"145.92.228.31\",80\r\n");  
    delay(1000);
    espSerial.write("AT+CIPSEND=4,59\r\n");
    delay(100);  
    espSerial.write("GET /crypto/ADA HTTP/1.1\r\nHost: api.iot.hva-robots.nl\r\n\r\n");
    delay(100);
    espSerial.write("AT+CIPCLOSE=4\r\n");  
    delay(500);
  
}

Some how i get this no ip response. So i cant test the next line

Now i got it working but i get this cookie thing?


This has something to do witht the HTTP GET request

It has something to do with using HTTP in general. You can't avoid it unless you want to use raw TCP and then you'll have total control of the bytes sent and received

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.