ESP8266 and Using the Arduino IDE

I noted a while back that the ESP8266 can be directly programmed now using the Arduino IDE. I’ve played with direct access (AT commands) and Lua in the past. While interesting, I found both methods a bit clumsy to use. Being able to write my own code on the ESP8266 sounds intriguing.

My first step, and the topic of this post, is to simply get the IDE running to the point where I can blink an LED with the ESP8266. I’ve got a handful of ESP-01’s laying around so that’s what I’ll work with.

Before starting, my main reference was the Adafruit post

Using Arduino IDE

and to a lesser extent, the Sparkfun post

ESP8266 Thing Hookup Guide

Setting Up the Hardware

I used my own post, Basic ESP8266 Setup and Operation, to get the basic ESP-01 connected to the breadboard as I’m still using the same breadboard adapter.

Installing the Arduino IDE

You need at least version 1.6.4 of the IDE to make use of the ESP8266 Board Add-on. You can download it from here.

Note to self: I do NOT download the Windows installer, but download the Windows ZIP file instead. I keep multiple versions of the IDE installed and the Windows Installer wants to overwrite files. The ZIP file contains a directory that I just copy straight to C: to make use of.

Once the IDE is installed, start it, and from the menu select Files | Preferences and enter “” into Additional Boards Manager URLs:” field:


Now, from the menu, select Tools | Board | Boards Manager and scroll down to the Esp8266 board:


Click anywhere on this entry and it will give you the option to install and the version to install:


Select the version (probably the most recent), and click on install.

Now you can select an ESP8266 board in the Arduino IDE:


At this point, I had to restart the IDE to get it to allow me to change the port:


Note that I am using upload speed of 115200 Baud. Though others have set it much faster, I cannot get anything faster than 115200 to work.

Wiring Up Blinky Circuit

There are two GPIO pins on the ESP-01, GPIO0 and GPIO2. Both are also used during bootup to determine the run mode. The operation of the GPIO pins are explained here:

ESP8266 Using GPIO0/GPIO2/GPIO15 pins

Using that post as a basis for my own blinky circuit, I ended up with this schematic:


The Program, er, Sketch

GPIO0 and GPIO2 are pins 0 and 2 on the Arduino. I have successfully run this sketch on both pins. Here, it is set to use pin/GPIO 2:

const int           ledPin              = 2;

// ---------------------------------------------------------------------------
void setup() {

pinMode(ledPin, OUTPUT);

} // setup

// ---------------------------------------------------------------------------
void loop() {

digitalWrite(ledPin, HIGH);
digitalWrite(ledPin, LOW);

Compiling and Uploading

You can do just a Control-R to verify syntax. When you are ready to compile and upload, first you must put the ESP8266 into upload mode. Press and hold Program button (S1, connected to GPIO 0). Press and release RESET button. Then release the program button. On my ESP-01, there is no indication it is in program mode.

Now compile and upload using control-U. When the program starts uploading, the blue LED (tied to the UART TX pin) will begin flashing.

Once the upload is complete, your LED should begin flashing.


This entry was posted in c-esp8266 and tagged . Bookmark the permalink.

4 Responses to ESP8266 and Using the Arduino IDE

  1. Pingback: ESP8266/Arduino IDE: Connecting to a Network with WIFI | Big Dan the Blogging Man

  2. Pingback: ESP8266/Arduino IDE: Communicating with TCP | Big Dan the Blogging Man

  3. Ambro says:

    looking at your hand drawn schematics it seems to me that you are shorting Vcc to ground….when S1 is activated !
    Thanks for any correction .

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s