I am trying to use an ESP8266 and an Arduino to access the Arduino from the network. I tried to do something but I'm facing some challenges. I hope I am using the correct board "Generic ESP8266 Module".

enter image description here

enter image description here

#include <SoftwareSerial.h>

const byte rxPin = 2; // Wire this to Tx Pin of ESP8266
const byte txPin = 3; // Wire this to Rx Pin of ESP8266

// We'll use a software serial interface to connect to ESP8266
SoftwareSerial esp8266(rxPin,txPin);

void setup() {

void loop() {
  Serial.println("Sending an AT commands");
  while(esp8266.available()) {
    String data = esp8266.readStringUntil('\n');
    Serial.println("Got response from esp8266: " + data);


Archiving built core (caching) in: C:\Users\XYZ~1\AppData\Local\Temp\arduino_cache_322251\core\core_esp8266_esp8266_generic_CpuFrequency_80,FlashFreq_40,FlashMode_dio,UploadSpeed_115200,FlashSize_512K64,ResetMethod_ck,Debug_Disabled,DebugLevel_None_____feb0d75f3cf4e05271af4f91549cd009.a
Sketch uses 226657 bytes (52%) of program storage space. Maximum is 434160 bytes.
Global variables use 32464 bytes (39%) of dynamic memory, leaving 49456 bytes for local variables. Maximum is 81920 bytes.
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

enter image description here

  • Select the Arduino/Genuino Uno in the Arduino IDE Board menu and try again. You are simply using the wrong configuration. – Mikael Patel Apr 30 '17 at 11:13

First off you have the wrong board selected. It's the Arduino Uno that you are programming, not the ESP8266. Just because you have connected an ESP8266 to the Arduino doesnt't magically change what the Uno is.

Secondly you cannot have anything connected to pins 0 and 1 of the Arduino while programming. Those pins are used for communication with the PC. As a general rule it is best to never use ghem for anything.

To communicate between the Arduino and the ESP8266 you should either pick two other pins and use SoftwareSerial or invest in a board that has at least one independent UART (such as the Mega2560 or the Leonardo).

  • I changed Board to Arduino Uno and using pins 2 and 3 of the Arduino i.stack.imgur.com/PK7K9.jpg . I am unable to upload pastebin.com/AyUWvDxf – N Sharma Apr 30 '17 at 9:21
  • @Williams You have the right port selected in the IDE? – Majenko Apr 30 '17 at 10:08
  • It is COM3(Arduino/Genuino Uno and I updated question – N Sharma Apr 30 '17 at 10:08
  • Try pressing the reset button on the Arduino just as the upload is starting. – Majenko Apr 30 '17 at 10:10
  • I tried, but didn't work :( – N Sharma Apr 30 '17 at 10:17

Uploading programs to the Arduino requires the RX and TX lines. The ESP8266 module is probably interfering. You will need to disconnect the ESP8266 module, or at least, don't power the module while uploading.

Connecting the ESP8266 to RX/TX pins will probably also prevent you from using the serial terminal to output debugging information.

An alternative would be to use the (not so great, but it works) SoftwareSerial library.

  • I am using pins 2 and 3 of the Arduino Uno i.stack.imgur.com/PK7K9.jpg and if you see snippet of code in question, there you will find I am using SoftwareSerial – N Sharma Apr 30 '17 at 9:24

I believe you are trying to directly program the ESP8266 and you're simply using the Arduino Uno as a USB to serial interface for your computer. There are many tutorials on the web on how to do this. First thing I see wrong with your setup is you've left the Arduino Uno MCU attached to the board. The first thing you'll want to do is remove this chip carefully (the pins can bend easily so apply force evenly). Right now when the Arduino IDE tries to talk to the ESP8266 the communication is going to both the ESP8266 and the Arduino. Physically removing the Arduino MCU chip will ensure any communication is directly with the ESP8266.

Also make sure you are connecting the correct voltage. ESP8266 can only handle 3.3V max, while the Arduino runs at 5V mostly. I believe the Uno board provides a 3.3V output but I'm not 100% sure.

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.