Chat freely about anything...

User avatar
By CaymanEss
#7712 Hi,

I'm using the ESP8266 wireless transceiver module with an Arduino UNO. The module is working as expected (I've tested my configuration with several sample projects I found on the net).

For ease of testing I've set things up so that I can communicate directly with the ESP8266 via the Serial Monitor window. Here are the commands I use to get things going:

Code: Select all// What firmware version is installed?
AT+GMR
0018000902-AI03

// Reset the device
AT+RST
OK
L(CÇäÿZNÿbc@ˆþD@JSÀ€àà
[Vendor:www.ai-thinker.com Version:0.9.2.4]
ready

// Set the data transmission mode (1 is "data mode")
AT+CWMODE=1
no change

// Connect the ESP8266 to my access point
AT+CWJAP="XXXX","XXXX"
OK

// What is the ESP8266's ip address?
AT+CIFSR
192.168.161.27

// Start a TCP connection with google
AT+CIPSTART="TCP","www.google.com",80
OK
Linked


At this point I know I have to perform an
Code: Select allAT+CIPSEND=X
where X is the length, in bytes, of the message. I thought the message would look like this:

Code: Select allAT+CIPSEND=37
> GET / HTTP/1.1\r\NHnost: google.com
SEND OK


I get back a "SEND OK" but I never get the expected html data. Does anyone see what I am doing wrong here?

Thank you in advance!
User avatar
By martinayotte
#7720
GET / HTTP/1.1\r\NHnost: google.com


First, there is a typo error in "Hnost", it should be "Host".
You also need to add \r\n twice at the end.

So, it should be :

Code: Select all"GET / HTTP/1.1\r\nHost: google.com\r\n\r\n"


The length is also important, it should match the len of the string. Here it is 36 not 37.
User avatar
By CaymanEss
#7723 Thank you for your reply martin! I fixed the typo and the size but I still get wrong syntax when I attempt to get the html:

Code: Select allAT+CIPSEND=36
> GET / HTTP/1.1\r\nHost: google.com\r\n\r\n
wrong syntax


Do you have a module you could use to test my simple scenario? Thanks in advance!
User avatar
By sfyffe
#7727 Using utilities like this one will let you test syntax before using AT commands to send GET requests:

http://www.rexswain.com/httpview.html



A normal GET request and return response from ThingSpeak looks like this: (I changed the key so if you test it will not work..) Setup an account there to test against.

<<<<<Normal CWJAP stuff>>>>>>>>>>>>

OK
AT+CIPSTART="TCP","184.106.153.149",80

OK
Linked
AT+CIPSEND=46

> GET /update?key=8C7E863VKHU5XPEG&field1=32.0

SEND OK

+IPD,4:9489
OK

OK
Unlink



Stephen