in Arduino

How to Program ESP8266 using Arduino IDE

It’s been a while since the ESP8266 community has announced the Arduino IDE support to the WiFi module. This means that you can now directly write codes and program the ESP8266 using the Arduino language and IDE.

You can use the basic functions of the IDE like: pinMode , digitalRead , digitalWrite , and analogRead  in writing your code.

But before you get started with writing codes, you first need to have an Arduino IDE with ESP8266 support. You can achieve that by downloading the custom build of the Arduino IDE from GitHub. But I don’t recommend using that, having a whole separate environment installed is quite manageable since I also have different version installed – the 1.0.x and 1.6.x. I recommend to download the latest version of the IDE on the Arduino website (at the time of writing it’s version 1.6.5). The 1.6.x build comes with a simplified support on adding and managing other boards like the ESP8266.

Once you have downloaded the latest version, start the Arduino and open Perferences window and enter this address:  updated address:  into Additional Board Manager URLs field.

Now open the Board Manager from Tools and install the ESP8266 platform.

Once installed, don’t forget to select the “Generic ESP8266 module” or other board variant you have from Tools > Board.

The ESP8266 package also comes with the necessary libraries and example codes for the module. So you don’t have to worry about anything else.

In able to upload your codes, you need to set the ESP8266 into “Programming mode” by building this breadboard setup. You need a FTDI cable or any USB to Serial converter available.

The red LED connected to GPIO-2 will light up upon plugging the circuit to your computer, this means that the module is now on “Programming mode”. The blue LED on the ESP8266 module will begin to blink like crazy once you have initiated the upload button. After that, you must also got a similar message like this on the status window of the Arduino IDE. (You can also try the Blink sketch on the examples for testing. Just change the 13 into 2.)

After the uploading is done, you need to rebuild the circuit in able to run the code properly. You must remove the connection between the GPIO-0 and ground, and build a reset button.

If you use the function Serial.println();  , open the Serial Monitor and press the reset button to start debugging your code.