Arduino icon indicating copy to clipboard operation
Arduino copied to clipboard

GET or POST from esp8266

Open e8miliano opened this issue 11 years ago • 32 comments

Hi guys, I have a question. Do I have to create a socket connection to send info to a url? Or there is a function like get or post that simply does that? Thanks

e8miliano avatar Oct 02 '15 18:10 e8miliano

Hey I have been facing a problem about sending GET and POST request using AT command, I am using Arduino IDE, I am trying to send GET request from serial monitor (Arduino IDE) using AT command. But the problem is I failed to send GET/POST request from serial monitor (of Arduino IDE).

AT+RST

AT+CWJAP="ssid","password"

AT+CIPSTART="TCP","shotlu.usrs0.com",80

AT+CIPSEND=75

GET /receiver.php?apples=56&oranges=23 HTTP/1.0\r\nHost: shotlu.usrs0.com\r\n\r\n Those are my command pattern for sending a GET request;

Now the problem is AT+CIPSEND dose not working on Arduino IDE, When I am sending GET request it shows me this message;

AT+CIPSEND=75

GET /receiver.php?apples=56&oranges=23 HTTP/1.1\r\nHost: shotlu.usrs0.com\r\n\r\nbusy s...

SEND OK

+IPD,168:

400 Bad Request

400 Bad Request


hosting

OK CLOSED

OK"

(By those command I am trying to hit a php file which is called receiver.php; )

But I have checked those command in different ide which is calle RealTerm. Where I have successfully sent GET request.But Don't know why I am getting those message from Arduino IDE. Please guys help me, if you know something about this problem.

asadujjamandm avatar Oct 03 '15 20:10 asadujjamandm

@asadujjamandm this Project is a Port of the arduino code base the the ESP8266 SoC. its a complete replacement for the AT firmware. to run it you not need an atmega ship all code runes on the ESP chip itself. see: https://github.com/esp8266/Arduino/blob/esp8266/README.md

Links2004 avatar Oct 03 '15 20:10 Links2004

@Links2004 sorry I didn't get it, can you please tell me more about it? :o

asadujjamandm avatar Oct 03 '15 20:10 asadujjamandm

basically you can run any Arduino code direct on the ESP chip itself.

first steps: https://github.com/esp8266/Arduino/blob/esp8266/README.md#installing-with-boards-manager

supported boards: https://github.com/esp8266/Arduino/blob/esp8266/hardware/esp8266com/esp8266/doc/boards.md

Links2004 avatar Oct 03 '15 20:10 Links2004

@Links2004 hey man thnx!!! for your reply, basically I am new at this platform, so I have no clear idea about this. In my project there is a sensor which can take data from environment, now I need to send those data to a web server, for that I saw some video tutorials in youtube where got to know about AT command. Can you please tell me is that possible to send data to a web server using those AT command from serial monitor (of Arduino IDE).

asadujjamandm avatar Oct 03 '15 21:10 asadujjamandm

no AT commands, no atmega chip, only the ESP + Serial adapter. https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout/using-arduino-ide http://iot-playground.com/2-uncategorised/38-esp8266-and-arduino-ide-blink-example https://learn.sparkfun.com/tutorials/esp8266-thing-hookup-guide/installing-the-esp8266-arduino-addon

Links2004 avatar Oct 03 '15 21:10 Links2004

But I am using atmega chip (arduino uno) for the sensor, if i use ESP+serial adapter how can i connect them?

asadujjamandm avatar Oct 03 '15 22:10 asadujjamandm

There are GPIOs, SPI and I2C available on the ESP8266.

It is not 5v tolerant. If your sensors can run at 3v3 then great. If they need 5v you will need a level shifter

penfold42 avatar Oct 03 '15 22:10 penfold42

@asadujjamandm
You might like to look at http://www.forward.com.au/pfod/CheapWifiShield/ESP2866_01_WiFi_Shield/index.html which provides a UART to WiFi connection.

Actually as presented there it runs as a Server, where as I think you are looking for a client to connect to a web server and then issue Post and Get messages from your UNO to the serial port (D0,D1) and have the ESP send them via WiFi to the web server.

I am in the process of helping another user set up a client connection, but not finished yet.

If the above is what you want to do then can I suggest you start by getting http://www.forward.com.au/pfod/CheapWifiShield/ESP2866_01_WiFi_Shield/index.html up and running and then drop me an email at support via pfod.com.au and we can look at doing the client version.

drmpf avatar Oct 04 '15 02:10 drmpf

also check out https://github.com/jeelabs/esp-link/tree/v1.0.1

drmpf avatar Oct 04 '15 03:10 drmpf

@penfold42 @drmpf I have successfully connect ESP8266 module with my arduino uno, with the help of level shifter and 10microF capacitor. As I told I am new at this platform and I saw some tutorial in youtube, so I taught that I can send my data to a web server through AT command. At this time I am little bit confused about the whole thing, cause I can connect this wifi module with internet via wifi network, and for that I used AT command which is AT+CWJAP="ssid","pasword", and I got "OK" message from the serial monitor, and also able connect with the web server using AT+CIPSTART="TCP","www.google.com",80 this command. Now the question is why I can not send GET or POST request using AT+CIPSEND ?

This is my connection for arduino uno to esp8266 esp8266_arduino_bb

asadujjamandm avatar Oct 04 '15 05:10 asadujjamandm

I gave up on the 'AT' command set. I wrote a library to support it, but found the async msgs coming from the ESP made to too difficult to get a bullet proof version. So now I program the ESP directly from the Arduino IDE using this excellent board support.

drmpf avatar Oct 04 '15 08:10 drmpf

@drmpf i have wasted too much time behind this At command :( . In my project I just wanted to send my data to a web server. I used a sensor in my project and this sensor is connected with arduino uno, as I said I have wasted too much time, so need some easy idea for sending my data to a web server, and at this time I am totally blank, so guys please help me :'( .

asadujjamandm avatar Oct 04 '15 18:10 asadujjamandm

connect the sensor direct to the ESP use the Arduino IDE for ESP8266 to Program the ESP direct to send the data and you are done.

Links2004 avatar Oct 04 '15 19:10 Links2004

@asadujjamandm see my suggestions above

drmpf avatar Oct 04 '15 23:10 drmpf

Works well for me in server mode (client connects to ESP8266 TCP server or Web server for config) see http://www.forward.com.au/pfod/CheapWifiShield/ESP2866_01_WiFi_Shield/index.html

drmpf avatar Dec 28 '15 03:12 drmpf

By "existing arduino project" do you mean a separate arduino board with something like an atmel avr chip on it ?

If so, this is not the repository for you.

penfold42 avatar Dec 28 '15 06:12 penfold42

This is not the repository for you.

This is a port of the arduino framework to run NATIVELY on the 8266 boards.

penfold42 avatar Dec 28 '15 06:12 penfold42

If you want to add a simple wifi interface to an existing arduino avr/arm board project that was designed around a serial interface, it works great.

If you want anything more than a simple TCP connection, you've picked the wrong architecture with your approach. Doing it natively on the 8266 will always be 2-10 times easier.

If you feel you've been misled, complain to espressif or dozens of bloggers making claims you've misunderstood - please don't hijack an old closed issue on a repository that has nothing to do with your chosen architecture.

penfold42 avatar Dec 28 '15 07:12 penfold42

https://github.com/itead/ITEADLIB_Arduino_WeeESP8266

penfold42 avatar Dec 28 '15 08:12 penfold42