1

I'm successfully running AT commands via the Serial Monitor. But now I'm issuing AT commands via Arduino code and facing problems getting the correct response.

Goal: After issuing AT commands programatically, knowing whether these run successfully or not.

Microcontroller: Arduino Uno

#include<string.h>
#include<SoftwareSerial.h>

#define OK "OK"
#define SERVER_PORT 1234
#define RX_PIN 2
#define TX_PIN 3

SoftwareSerial ESP(RX_PIN, TX_PIN);

void setup() {
  Serial.begin(115200);
  Serial.println("First serial");
  while(!Serial);
  ESP.begin(115200);
  Serial.println("Second serial");
  while(!ESP);
  //Enabling multiple connections
  ESP.println("AT+CIPMUX=1\r\n");
  while (!ESP.available());
  String muxResponse = ESP.readString();
  Serial.print("muxR:");
  Serial.println(muxResponse);
}

void loop() {
  if (ESP.available()) {
    String val = ESP.readString();
    Serial.println(val);
  }
}

After running the above code I get the response in the Serial Monitor like:

muxR:AT+CIPMUX=1


busy p../

OK

I'm getting special characters too.

  • You could try lowering the baud rate to see if the problem goes away: ESP.begin(9600); then increase in increments. I guess you are using some sort of level shifting between the Uno and the ESP8266 device. – 6v6gt Feb 26 '17 at 9:34
  • Ok. I'm just using arduino uno R2, ESP8266 and breadboard, nothing else. – Rahul Rastogi Feb 26 '17 at 10:55
  • @6v6gt I changed the baud rate of ESP8266 to 9600 by AT+CIOBAUD=9600. Baud successfully changed but getting same response. Getting this busy p.. :( – Rahul Rastogi Feb 26 '17 at 11:09
  • busy p../ error not going even after factory reset (AT+RESTORE). – Rahul Rastogi Feb 26 '17 at 11:40
  • Maybe you find something here. I's a similar case: arduino.stackexchange.com/questions/18575/… – 6v6gt Feb 26 '17 at 11:44
1

change

AT+CIPMUX=1\r\n

to

AT+CIPMUX=1
  • Explain that, what was the mistake and how your answer correct it. As it, it solve the problem at hand without educating the OP. – user31481 Feb 17 '18 at 11:42

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.