Here's the code:

#include <SoftwareSerial.h>
#define RX 6
#define TX 5

String AP = "...";
String PASS = "...";

SoftwareSerial esp8266(RX,TX); 

void setup() {
  Serial.println("Setup started");

  esp8266.begin(115200); // Change this to the factory baudrate used by ESP8266

  Serial.println("Setting BAUDRATE to 9600");
  Serial.println("Setup finished");


//reset the esp8266 module
void reset() {

  if (esp8266.find("OK"))
    Serial.println("Module Reset");
    Serial.println("Module Reset Failed!!!");

//connect to your wifi network
void connectWifi() {
  Serial.println("Connecting to Wifi...");
  String cmd = String("AT+CWJAP=\"") + AP + "\",\"" + PASS + "\"";
  Serial.println("Checking Wifi...");
  int ctr=0;
  while(!(esp8266.find("OK"))) {
    if(esp8266.find("ERROR")) {
      Serial.println("Cannot connect to wifi...");
      Serial.println("Cannot connect to wifi...");
  Serial.println("ConnectWifi finished");

The ESP8266-01S wires are as follows:

  1. GND to arduino ground
  2. 3v3 to arduino 3v3
  3. RX to arduino pin 5
  4. TX to arduino pin 6
  5. EN to arduino 3v3

The thing worked for one time, and when I re-compiled and sent it again without any changes or even button presses, it stopped working. Furthermore, if I connect ESP module directly through arduino rx and tx and connect arduino reset to ground, I still don't get anything. The led on the esp is blinking during data transfers, but everything else doesn't change and I get no response at all.

You need to re-flash your AI Thinker firmware. AT+IPR kills certain versions of the firmware.

Install the latest version of the firmware and use AT+UART_DEF=9600,8,1,0,0 and AT+UART=9600,8,1,0,0. (The former sets the default baud rate, the latter the current baud rate).

You can read more here.

  • After resetting everything works through direct connection to PC, but when using a SoftwareSerial I get: Setting BAUDRATE to 9600 Response Received: Q⸮⸮E}⸮ʂb⸮b⸮,F⸮⸮⸮P%U⸮IT=N⸮⸮⸮L0 Qi⸮C!⸮CC⸮ ============ Command Sent: AT Response Received: ⸮⸮⸮⸮ – mcmikecreations Oct 9 at 23:46
  • Here's my setup: void setup() { Serial.begin(9600); ESP8266.begin(115200); delay(1000); Serial.println("Setting BAUDRATE to 9600"); ESP8266.println("AT+UART_DEF=9600,8,1,0,0"); ESP8266.println("AT+UART=9600,8,1,0,0"); ESP8266.begin(9600); } ` – mcmikecreations Oct 9 at 23:47
  • Welcome to the wonderful world of dodgy at firmware. I would suggest you program the esp8266 to perform the task you require of it and not rely on the awful at firmware. – Majenko Oct 10 at 0:56

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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