All commands are shows as success but there is no response from the webpage to that data is posting.Please help me to post data from arduino uno to a webpage using wifi(ESP-01) module. I try with AT commands it didn't give the response from my webpage

#include <SoftwareSerial.h>
#include <ArduinoJson.h>
#define DEBUG true

#define RX 10
#define TX 11
String WIFI_SSID = "*****";       // Your WiFi ssid
String PASSWORD = "*****";         // Password
//String DEVICE_SECRET_KEY  = "**";

//String PATH = "/v1/events";
//String PORT = "8000";
//String HOST = "http://10.**.***.66:8000/data";

String HOST = "10.**.240.**";
String PATH = "/data";
String PORT = "8000";

String response;
int countTrueCommand;
int countTimeCommand;
boolean found = false;

SoftwareSerial esp8266(RX, TX);
StaticJsonBuffer<200> jsonBuffer;
JsonObject& root = jsonBuffer.createObject();

void setup()
  sendCommandToESP8266("AT", 5, "OK");
   sendCommandToESP8266("AT+CWMODE=3", 5, "OK");
  sendCommandToESP8266("AT+CWJAP=\"" + WIFI_SSID + "\",\"" + PASSWORD + "\"", 20, "OK");

void loop()
  root["key"] =  "sdfsdfsd";
  String key;
  String postRequest =   "POST " + PATH  + " HTTP/1.1\r\n" +
                         "Host: " + HOST + "\r\n" +
                         "Accept: *" + "/" + "*\r\n" +
                         "Content-Length: " + key.length() + "\r\n" +
                         "Content-Type: application/json\r\n"
                         "\r\n" + key;
  Serial.print("pst:" + postRequest);
  sendCommandToESP8266("AT+CIPMUX=1", 5, "OK");
  sendCommandToESP8266("AT+CIPSTART=0,\"TCP\",\"" + HOST + "\"," + PORT, 15, "OK");
  String cipSend = "AT+CIPSEND=0," + String(postRequest.length());//GET /test.php?Data=2\r\nHost:\r\n\r\n
  sendCommandToESP8266(cipSend, 4, ">");

  while (esp8266.available())
    if (esp8266.find("+IPD,"))
//      String msg;
//      msg = esp8266.readStringUntil(' ');
      response = esp8266.readStringUntil(' ');

  //  sendCommandToESP8266("AT+CIPCLOSE=0", 5, "OK");

void sendCommandToESP8266(String command, int maxTime, char readReplay[]) {
  Serial.print(". at command => ");
  Serial.print(" ");
  while (countTimeCommand < (maxTime * 1))
    if (esp8266.find(readReplay))
      found = true;


  if (found == true)
    countTimeCommand = 0;

  if (found == false)
    countTrueCommand = 0;
    countTimeCommand = 0;

  found = false;

void sendData(String postRequest) {

void printResponse() {
  while (esp8266.available()) {

Please help me to get the response from the webpage using this code.

  • SoftwareSerial doesn't work at 115200 baud. change the baud rate in AT firmware and for SoftwareSerial to 9600 baud. – Juraj Feb 5 at 6:45
  • @Juraj i try by changing the baud rate but still there is no response from my webpage – ASK Feb 5 at 10:58
  • @Juraj Or please let me know that if there is any another way to post data from arduino uno by using wifi.(ESP01 module). I see many programs that are using ethernet and anothehr wifi modules. – ASK Feb 5 at 11:20
  • if you want something like Ethernet library you can use my WiFiEspAT library. but it requires to change the AT firmware in esp-01 to version 1.7 github.com/jandrassy/WiFiEspAT/blob/master/README.md – Juraj Feb 5 at 12:50
  • @Juraj can i use the above mentioned library with arduino uno and esp01? Iam a beginner in arduino programming that's why asking about these questions. – ASK Feb 6 at 6:52

Step 1) Upload software serial from example and send AT, you should get reply as AT OK if your connections are correct. Step 2) Once your connections are correct and if you are uploading the given code then make sure you put your SSID, password, and Server IP which would be the three Strings: HOST, PATH and PORT.

You could alternatively check your server first by sending it a GET or POST using your browser or another software for testing API's(I personally use POSTMAN).

Proceed further once you perform these checks.

| improve this answer | |
  • I tried this and still not getting response from the webpage. Also API have no problems when i check it. – ASK Feb 5 at 11:06
  • Did you try the AT command check? Upload software serial and you can manually enter AT commands and check where you are going wrong. – Asim Merchant Feb 5 at 12:19
  • I have 2 esp-01 modules with me. I think one of my esp is corrupted. But other one is working when check by AT command. – ASK Feb 6 at 12:00
  • Now you can check each command that is being used via Software Serial. For example according to your code if u send "AT+CWMODE=3" u will get a reply OK. You can do a complete post request just using software serial by inputting commands one after the other. Its a good practice to do this as it will help you understand at what point your code is going wrong. – Asim Merchant Feb 7 at 13:01
  • I tried by sending all the AT commands and i stop where AT+CIPSTART=0,"TCP","xx.xxx.xxx.xx","port" from this command i got error message. what can i do to make it correct? – ASK Feb 10 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.