Iam trying to set up the arduino uno with the wifi module ESP8266. I use this schematic setup:


I have followed this tutorial: Tutorial ESP8266

Thereby I removed the Mega328P Chip like it says above, I can communicate trough my terminal in the arduino IDE with the ESP-module but when I want to upload an simple test file like this:

#include <SoftwareSerial.h>

SoftwareSerial ESP8266(0, 1); // RX = 8 en TX = 9

boolean FAIL_8266 = false;

void setup() {
  // put your setup code here, to run once:
   do {
    ESP8266.begin(115200); // start communicatie met esp8266

    //Wait Serial Monitor to start
    while (!Serial);



    if (ESP8266.find("OK")){

   } while (FAIL_8266);

void loop() {
  // put your main code here, to run repeatedly:


Than it keeps throwing me this error: avrdude: stk500_getsync() attempt x of x: not in sync: resp=0x20 is it because I removed the Mega328P Chip?

Thereby I've tried the test code from the tutorial here is an link to the code: LINK.

There it keeps saying that Serial2 was not declared in scope

I'll hope someone can help me out on this one and run an simple test script to communicate with the ESP8266 WIFI Module

  • Why are you trying to upload code to a board without a chip? And where did that tutorial say to use software serial on hardware serial pins? It doesn't seem like you followed that tutorial at all.
    – gre_gor
    Nov 4, 2016 at 16:03
  • No I plugged it at digital pin 8 and 9 instead of rx and tx. And is it not nessecary to remove the chip?
    – Sireini
    Nov 4, 2016 at 16:18
  • You can't upload a program to a chip, if it's not there.
    – gre_gor
    Nov 4, 2016 at 16:19
  • 1
    @gre_gor - He doesn't want to upload a program into ATmega328 but is trying to upload the program into ESP8266 using the Arduino's onboard USB --> RS232 IC. In that case ATmega328 has to be either removed or held under reset and the connection between Arduino board and ESP8266 must be TX to TX and RX to RX. Se my detailed explanation here.
    – Chupo_cro
    Dec 5, 2016 at 21:22

2 Answers 2


You must have your microcontroller in place if you are uploading code to it.

You can talk to ESP8266 via serial monitor because you are connected directly to the pins of your USB-UART bridge.

Place your uC back, change this line of code:

SoftwareSerial ESP8266(0, 1);

to this one:

SoftwareSerial ESP8266(8, 9);

and change your wires accordingly(what was on pin 0, now connect to pin 8, pin 1 to pin 9). Now your Atmega can talk to ESP8266 after you upload the code.

btw. "Serial2" is Serial port for more advance Arduino boards, it won't work on Atmega328 based board.

  • I did put the chip back and switched the 0,1 pins to 8 and 9 but when I run the code it doesn't print ready..
    – Sireini
    Nov 4, 2016 at 17:15
  • @Beginnerprogrammer you are printing ready back to the ESP8266 not to the PC.
    – gre_gor
    Nov 4, 2016 at 20:06
  • No, ATmega328 has to be either removed or held under reset and TX to TX&RX to RX is OK. See my comment under the question.
    – Chupo_cro
    Dec 5, 2016 at 21:25

The first, most obvious issue (besides needing the MCU on the Arduino board!) is that you need to cross-connect the RX and TX lines between the two boards. You have both RXes connected together, and both TXes connected together. The ESP's RX has to listen to the Arduino's TX, and vice-versa.

An easy way to remember which ESP pins are RX and TX is that the pin nearest the free ends of the antenna is the RX pin; the TX pin is diagonally opposite it.

A second, potential problem, is that the ESP board may draw more power than the Arduino's 3.3v regulator can provide. If it is making brief and not too frequent transmissions, you may get away with it, but the ESP can easily out-draw the regulator and it's 3.3v supply will sag.

  • That is not the case, TX to TX&RX to RX in this case is OK. See my comment under the question.
    – Chupo_cro
    Dec 5, 2016 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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