Installing ESP8266 Board in Arduino IDE (Windows, Mac OS X, Linux)

The ESP8266 community created an add-on for the Arduino IDE that allows you to program the ESP8266 using the Arduino IDE and its programming language.

This tutorial shows how to install the ESP8266 board in Arduino IDE whether you’re using Windows, Mac OS X or Linux.

Watch the Video Tutorial

This tutorial is available in video format (watch below) and in written format (continue reading this page). 

If you like the ESP8266 and want to build more projects, you can get my eBook: Home Automation using ESP8266.

Prerequisites: Arduino IDE Installed

Before starting this installation procedure, make sure you have the latest version of the Arduino IDE installed in your computer. If you don’t, uninstall it and install it again. Otherwise, it may not work.

Having the latest Arduino IDE software installed from arduino.cc/en/Main/Software, continue with this tutorial.

Do you need an ESP8266 board? You can buy it here.

Install ESP8266 Add-on in Arduino IDE

To install the ESP8266 board in your Arduino IDE, follow these next instructions:

  1. In your Arduino IDE, go to File> Preferences

    Install ESP8266 Board add-on in Arduino IDE open preferences
  2. Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into the “Additional Boards Manager URLs” field as shown in the figure below. Then, click the “OK” button:

    Install ESP8266 Board add-on in Arduino IDE enter URL

    Note: if you already have the ESP32 boards URL, you can separate the URLs with a comma as follows:

    https://dl.espressif.com/dl/package_esp32_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json
  3. Open the Boards Manager. Go to Tools > Board > Boards Manager…

    Install ESP8266 Board add-on in Arduino IDE Open boards manager
  4. Search for ESP8266 and press install button for the “ESP8266 by ESP8266 Community“:

    Install ESP8266 Board add-on in Arduino IDE search ESP8266
  5. That’s it. It should be installed after a few seconds.

    ESP8266 Board add-on in Arduino IDE installed

Testing the Installation

To test the ESP8266 add-on installation, let’s see if we can blink an LED with the ESP8266 using the Arduino programming language.

Parts Required

Here’s the hardware that you need to complete this project:

If you’re using an ESP8266-01, you also need an FTDI programmer to upload code.

You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!

Uploading the Sketch

Uploading the Sketch to the ESP-12E

If you’re using an ESP-12E NodeMCU Kit, uploading the sketch is very simple, since it has built-in programmer. Plug your board to your computer. Make sure you have the right board selected:

Install ESP8266 Board add-on in Arduino IDE select board

You also need to select the Port:

Install ESP8266 Board add-on in Arduino IDE select COM port

Then, copy the code provided:

/*********
  Rui Santos
  Complete project details at https://randomnerdtutorials.com  
*********/

int pin = 2;

void setup() {
  // initialize GPIO 2 as an output.
  pinMode(pin, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(pin, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(pin, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

View raw code

Click the “Upload” button in the Arduino IDE and wait a few seconds until you see the message “Done uploading.” in the bottom left corner.

Done uploading sketch to ESP8266 using Arduino IDE

Uploading the Sketch to the ESP-01

Uploading code to the ESP-01 requires establishing a serial communication between your ESP8266 and a FTDI Programmer as shown in the schematic diagram below.

ESP8266 ESP-01 Uploading sketch with FTDI programmer Arduino IDE

The following table shows the connections you need to make between the ESP8266 and the FTDI programmer.

ESP8266FTDI programmer
RXTX
TX RX
CH_PD3.3V
GPIO 0GND
VCC3.3V
GND GND

If you have a brand new FTDI Programmer and you need to install your FTDI drivers on Windows PC, visit this website for the official drivers: http://www.ftdichip.com/Drivers/VCP.htm.

Then, you just need to connect the FTDI programmer to your computer, and upload the sketch to your ESP8266 board. You should see the “Done Uploading” message after a few seconds.

Schematic

If you’re using an ESP8266-12E

Connect an LED to your ESP8266, as shown in the following schematic diagram. The LED should be connected to GPIO 2 (D4).

ESP8266 NodeMCU board Blinking an LED with Arduino IDE

If you’re using an ESP8266-01

If you’re using the ESP8266-01 assemble the following circuit.

ESP8266 ESP-01 Blinking an LED with Arduino IDE

If everything went well, your LED should be blinking every 1 second.

Troubleshooting

If you try to upload a new sketch to your ESP8266 and you get this error message “esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header“. It means that your ESP8266 is not in flashing/uploading mode.

esptool.FatalError Failed to connect to ESP8266: Timed out waiting for packet header

Having the right board name and COM port selected, follow these steps:

  • Hold-down the “BOOT/FLASH” button in your ESP8266 development board
  • Press the “Upload” button in the Arduino IDE to upload your sketch:
Arduino IDE uploading new sketch to ESP32
  • When you see the  “Connecting….” message in your Arduino IDE, release the finger from the “BOOT/FLASH” button
  • After that, you should see the “Done uploading” message

Your ESP8266 should have the new sketch running. Press the “ENABLE/RESET” button to restart the ESP8266 and run the new uploaded sketch.

Wrapping Up

This is a quick guide that illustrates how to prepare your Arduino IDE for the ESP8266 on a Windows PC, Mac OS X, or Linux computer.

Next, you might want to read: Getting started with ESP8266.

That’s it, you’re ready to start building your own IoT projects with the ESP8266!

Do you have any questions? Leave a comment below!

Thanks for reading. If you like this post probably you might like my next ones, so subscribe to my newsletter.


Learn how to program and build projects with the ESP32 and ESP8266 using MicroPython firmware DOWNLOAD »

Learn how to program and build projects with the ESP32 and ESP8266 using MicroPython firmware DOWNLOAD »


Enjoyed this project? Stay updated by subscribing our weekly newsletter!

35 thoughts on “Installing ESP8266 Board in Arduino IDE (Windows, Mac OS X, Linux)”

  1. Hi
    I need some help…!
    I want o using esp8266 esp-07 standalone and program it with the arduino ids but i can’t even compile the examples with the ide and I fallow all the instructions in the github website and also your website and the error is compile error please help me how can i fix this problem.
    thankes alot

    Reply
  2. Hi
    I need some help…!
    I want o using esp8266 esp-07 standalone and program it with the arduino ids but i can’t even compile the examples with the ide and I fallow all the instructions in the github website and also your website and the error is compile error please help me how can i fix this problem.
    thankes alot

    Reply
  3. Hi Rui

    When I try to upload the code, the compilation give me some errors

    warning: espcomm_sync failed
    error: espcomm_open failed
    error: espcomm_upload_mem failed

    Do you know because this?

    Reply
  4. One note, as someone who just tried this, and…. bombed… This will require one of the 1.6.x or newer versions of the Arduino IDE.. I’m running a UBUNTU desktop, and it’s version for the IDE is 1.0.5… Not going to work! (and for some reason, they install the IDE in an odd fashion, making it tougher to install the newer version.)

    Reply
  5. Hello MR. Rui Santos
    I am a novice at Arduino projects.
    Install ESP8266 according to your instructions and uplaud to get the following information:
    I am a novice at Arduino projects.
    Install ESP8266 according to your instructions and uplaud to get the following information:
    I am a novice at Arduino projects.
    Install ESP8266 according to your instructions and uplaud to get the following information:
    warning: espcomm_sync failed
    error: espcomm_open failed
    error: espcomm_upload_mem failed
    error: espcomm_upload_mem failed

    Please help.

    Best Regaeds

    Blagoja Andonoski

    Reply
  6. Sketch uses 222,241 bytes (44%) of program storage space. Maximum is 499,696 bytes.
    Global variables use 31,576 bytes (38%) of dynamic memory, leaving 50,344 bytes for local variables. Maximum is 81,920 bytes.
    warning: espcomm_sync failed
    error: espcomm_open failed
    error: espcomm_upload_mem failed
    error: espcomm_upload_mem failed

    Reply
  7. Hi Rui!

    I have NodeMCU installed on my ESP-01.
    Can’t I use Arduino IDE with it? If I can then how? if I can’t than what shall I do to be able to use Arduino IDE?

    Greeings,
    Prithul

    Reply
  8. Thank you Mr.Rui. I followed your instructions in this tutorial, but I have this error message:

    “/bin/xtensa-1×106-elf-g++ ” not found
    Error compiling for board Generic ESP6266 module
    Build options changed, rebuilding all
    exec: “/bin/xtensa-lx106-elf-g++”: file does not exist
    Error compiling for board Generic ESP8266 Module.

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

    Reply
  9. Hi

    I want to use 2 esp s and two arduino one of them will act as a server and the other is client to control my combi using a relay. One of them will get the temperature of my room by means of dht22 and send it to other when it’s below the temperature I want the other esp will take the information and trigger the relay. How can I do this?

    Reply
  10. Found your site. And have an Adafruit ESP8266 board (https://www.adafruit.com/product/2821).
    Loaded your code and it works straight away!
    Don’t need any external LEDs, your code will turn the red & blue LEDs off and on. Just need to reverse the HIGH / LOW in the socket On / Off calls.
    Thanks for the excellent post!

    Mike

    Reply
  11. I’m using the Arduino IDE version 1.8.5 with a Windows computer, Arduino UNO, and an ESP8266-01. I tried uploading the blink_led_8266 sketch. The IDE keeps reporting that it “can not compile”. I can’t figure out what is going on. When I go back to an old version IDE I can upload sketches without any problem. Any ideas?

    Reply
    • Hi Robert.
      Have you installed the ESP8266 board in the new version of Arduino IDE 1.8.5?
      Having two versions of Arduino IDE may cause conflicts, because you may think you’re running one version instead of the other.
      You need to install the ESP8266 board in both versions, if you want to keep them both installed.

      Reply
      • Hi Sara,
        I installed the Arduino IDE 1.8.5 on another computer with Windows 10.
        The error message that I’m getting is as follows:
        Warning: espcomm_send_command: wrong direction/command:
        0x00 0x8, expected 0x01 0x08
        Warning: espcomm_sync failed
        Error: espcomm_open failed
        Error: espcomm_upload_mem failed

        I get the Arduino and the ESP8266 to respond to the uploading of the sketch by seeing the Arduino led flash and also the blue led on the ESP8266 flash.

        Where do I go from here? I’m going to order an FTDI programmer to see if that makes a difference rather then using the Arduino UNO.
        Let me know what you think.
        Thank you.

        Reply
        • I would recommend using an FTDI, and that should solve your problem, but an Arduino Uno should also work.
          That error means that your computer is not making a serial connection with your ESP8266.
          You need to double check the TX and RX connections.
          You might also need to reboot your ESP while GPIO 0 is connected to GND, to ensure that your ESP boots in uploading mode.
          I hope this helps.

          Reply
  12. Great! Thank you very much!
    The thing is my laptop said it was downloading something the first time I plugged the board, but I didn’t check what the result was. Thanks again!

    Mihai

    Reply

Leave a Reply to Mihai Tache Cancel reply

Download our Free eBooks and Resources

Get instant access to our FREE eBooks, Resources, and Exclusive Electronics Projects by entering your email address below.