Arduino Due + ESP8266 01 + CIPSEND (GET HTTP)

Hello Experts,

Firstly I would like to say thank you all of you you helped me a gave advices with my last issue (finally it was human error, I do not know what I did, but one day it started to work)

I am newbie I have to learn a lot... Before writing this post I did a lot of research, have tried many codes, many libraries, read a lot and finally here I am, totally desperate.

I have configuration mentioned above...

ESP is connected to Serial3 I am transfering the AT commands from Serial1 to Serial3. I can communicate with the module, everything is going fine, until I would like to send "message" (sorry for the laic term) to a server via GET (it is pre-prepared for storing and displaying temp and humidity, it is only needed to send - open specific link, which contains ID of the sensor and the value). Here is my set up via AT commands (I am going to re-write it, once I finish it).

HW Serial, baudrate 115200 bauds:

AT+GMR (View version info)
AT version:0.40.0.0(Aug 8 2015 14:45:58)
SDK version:1.3.0
Ai-Thinker Technology Co.,Ltd.
Build:1.3.0.2 Sep 11 2015 11:48:04

AT+CWMODE=3 ( Wifi mode - softAP + station mode)
OK

AT+CWJAP="ssid","password" (connect to wifi network)
WIFI CONNECTED
WIFI GOT IP
OK

AT+CIPMUX=1 (set multiply connections)
OK

AT+CIPSTART=0,"TCP","matuluka.tmep.cz",80 (connect to a server)
0,CONNECT
OK

AT+CIPSEND=0,39 (I will send message to connection 0 - above, 39 bytes)

Now I will send the message (it does not display in Serial monitor) : GET http://maluka.tmep.cz/?teplota=26.2

busy s... <<== this is probably the reason
Recv 39 bytes
SEND OK

+IPD (should return reply from server)
ERROR
CLOSED

Does anyone have any clue what am I doing wrong? :frowning: I saw also some opinions I am not able to send GET via Arduino Serial monitor, I found also I can not use more than 9600 bauds if I am using Software serial (which I don't use). I was able to send the GET request to the server, unfortunatelly there has to be one byte more... The server does not recognize it as a message, but as a text string and nothing has happened.

Thank you in advance for you advices, help and experience sharing!

Your +IPD (should return reply from server) is not a command.

It is issued by the ESP if there is an incomming request/data.

This is a communication of a GET (I found)

AT+CIPSTART=3,"TCP","api.weathermap.org",80
OK
Linked

AT+CIPSTATUS
STATUS:3
+CIPSTATUS:2,"TCP","188.226.224.148",80,0
OK

AT+CIPSEND=3,76

> GET /data/2.5/weather?q=Dortmund HTTP/1.0
Host: api.openweathermap.org

SEND OK

+IPD,3,536:HTTP/1.1 200 OK
Server: nginx
Date: Wed, 01 Oct 2014 19:51:22 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 433
Connection: close
X-Source: redis
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST

{"coord":{"lon":7.45,"lat":51.52},"sys":{"type":1,"id":4912,"message":0.0304,"country":"DE","sunrise":1412746992,"sunset":1412787122},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01n"}],"base":"cmc stations","main":{"tem
OK

+IPD,3,185:p":288.83,"pressure":1003,"humidity":77,"temp_min":287.77,"temp_max":289.85},"wind":{"speed":6.7,"deg":190},"clouds":{"all":0},"dt":1412796719,"id":2935517,"name":"Dortmund","cod":200}
OK

Unlink

Your request shouldn't have the server in it, just the page. like this. Put the server in the Host parameter.

GET /?teplota=26.2 HTTP/1.0
Host: maluka.tmep.cz

When you count the characters, you should include a double cr/lf to signify end of request.

Hello, thank you for your advices. I did not understand all you mentioned, i gave it a try yesterday and today...

Basically I am not sure how to proceed with the host paramater.

  1. Should I send it as one string or should I send it as one command, and the second line as new command (basically it will be merged, am I right). Or should should I send first command, end it with something like /r/n and then send second command with the same /r/n?

  2. Double cr/lf means r/n/r/n/? So I should count +8 or 9 characters (9 because of space).

  3. I see as possible failures two things:
    a) wrong GET definition
    b) this error message:
    AT+CIPSEND=0,48
    OK
    >
    busy s...
    Recv 48 bytes

For me it is strange, that no message was sent right behind ">" I send command: "GET /?teplota=26.2 HTTP/1.0 Host: maluka.tmep.cz" (before was AT+CIPSEND=0,48). Unfortunatelly I don't see any command in the serial monitor... Well I can be wrong.

I found a document which is describing the CIPSEND command... It looks like I am sending more characters than is expected:

Note: If the number of bytes sent is bigger than the size defined (n), will reply busy, and after sending n number of bytes, reply SEND OK.
Source (click here)

Here is an example:
AT+CIPSEND=4 // set date length which will be sent, such as 4 bytes

DGFY // enter the data, no CR
Response :SEND OK

What does mean no CR (carriage return)?

Thanks once again.

I got it...

Thank you very much for your wise advises which leads me towards succes...

If somebody else will be solving the same issue: busy s...

  • this means you are sending more characters than ESP can handle....

I solved this, that I increased number of characters by one. Once I am over and it is still waiting for additional comman I sent space " " and that's it.

In the end it is looking like that:

AT+GMR (View version info)
AT version:0.40.0.0(Aug 8 2015 14:45:58)
SDK version:1.3.0
Ai-Thinker Technology Co.,Ltd.
Build:1.3.0.2 Sep 11 2015 11:48:04

AT+CWMODE=3 ( Wifi mode - softAP + station mode)
OK

AT+CWJAP="ssid","password" (connect to wifi network)
WIFI CONNECTED
WIFI GOT IP
OK

AT+CIPMUX=1 (set multiply connections)
OK

AT+CIPSTART=0,"TCP","matuluka.tmep.cz",80 (connect to a server)
0,CONNECT
OK

AT+CIPSEND=0,54 (I will send message to connection 0 - above, 54 bytes) - message is lower

OK

Recv 54 bytes

Now I will send the message (it does not display in Serial monitor, excel count 48 bytes) :
GET /?teplota=26.2 HTTP/1.0
Host: maluka.tmep.cz
" " (space)

If you fail on this error then:
busy s... <<== message is longer then defined amount of bytes....
Recv 39 bytes
SEND OK