Programming ESP boards with Arduino IDE made easy – beginner’s guide

ESP modules are very popular among IoT project developers. There are different types of esp modules available in the market depending on the features. They are ESP-01, ESP-12E, ESP-12F, NodeMCU and ESP-32. When you buy any of these modules the first thing you have to do is, make it compatible with any IDE and upload a basic code to test it.  We are going to make the ESP-01 , NodeMCU and ESP-32 compatible with Arduino IDE and upload basic testing codes. So lets start.

Components required 

  1. ESP-01
  2. NodeMCU
  3. ESP-32
  4. CP2102 USB to UART bridge
  5. Push button
  6. Jumper wires (F to F) – 10pcs of different colors

All ESP boards use CP2102 UART bridge to send or receive data from computer. The ESP-32 and NodeMCU have inbuilt CP2102  whereas for ESP-01 we have to connect external CP2102 module.

The computer’s com port must also be able to detect the CP2102 , for that the CP210x driver must be installed. To install the CP210x driver click on this link

For esp-01 make the connections as per below given circuit diagram

Circuit diagram of CP2102 module interfacing with ESP-01Circuit diagram of CP2102 module interfacing with ESP-01

The RXD of ESP-01 is connected to TXD of CP2102 and the TXD of ESP-01 is connected to RXD of CP2102. 3.3V from CP2102 is given to chip enable (CH_PD) pin and VCC pin of ESP module. GND from CP2102 goes to GPIO-0 , GND pin and to RST (reset) pin of esp-01 module. There is a switch between reset and GND.

Making ESP boards compatible with Arduino IDE 

To download Arduino IDE click on this link. Go to download options and download as per OS of your device . After installing IDE, open it and follow the below given steps.

  1. Click on files >> preferences

Arduino IDE, files and then preferenceArduino IDE, files and then preference

  1. In “Additional Boards manager URL’s” copy and paste the below given links. There are two links separated by a comma. One is for esp8266 boards and other is for esp32 boards. Copy the whole text given below and paste it in “Additional Boards manager URL’s”.,

arduino IDE, aditional board manager URL's  arduino IDE, aditional board manager URL's

Click on “OK”

  1. Go to Tools >> board >> board manager

How to open board manager in arduino IDE?How to open board manager in arduino IDE?

  1. Search for “esp8266” and install the “esp8266 by ESP8266 Community” package

Install additional boards like esp8266 in arduino IDEInstall additional boards like esp8266 in arduino IDE

  1. Search for “esp32” and install the “esp32 by Espressif Systems” package.

Add additional boards like esp32 in arduino IDE Add additional boards like esp32 in arduino IDE

Now we have successfully added the esp boards to our Arduino library.


On board led blinking test for esp-01 and NodeMCU

The on board led pin of ESP-01 is GPIO 1 and that of NodeMCU is GPIO 2. Before writing the blinking code we have to select the board and com port. The COM port number can be known by “device manager”. Open device manager in windows.

How to open device manager?How to open device manager?

Expand the “ports” and see the com number of CP2102 UART bridge.

How to know COM port number of microcontroller?How to know COM port number of microcontroller?

This shows us that our ESP module is connected on COM8. Now we can open Arduino IDE and select the board and port. Board must be “Generic ESP8266 Module”.

Select board in arduino IDESelect board in arduino IDE

Port must be COM8 as we saw it in the device manager.

select the  COM port in  arduino IDEselect the  COM port in  arduino IDE

Now we can upload the on board led blinking code.


int led = 1;  // pin 1 is for esp-01 and pin 2 is for node mcu

void setup() {



void loop() {







After uploading, we have to disconnect the GND going to GPIO-0 (for the board to come out of programming mode) and press the reset button. The on-board led will start blinking this means the board is ok.

Now let’s test its WiFi connectivity. The on-board led will start blinking once the WiFi is connected. Enter your WiFi credentials in the code and upload it. 

WiFi testing code

#include <ESP8266WiFi.h>  // for ESP-32 remove ESP8266 and just keep it <WiFi.h>

const char* ssid = "Your WiFi ssid";

const char* password = "Your WiFi password";

int iled = 1;   // for nodemcu change it to 2.

void setup() {



  WiFi.begin(ssid, password);


  while(WiFi.status() != WL_CONNECTED) {






  Serial.print("Connected to WiFi network with IP Address: ");



void loop() {

  if(WiFi.status()== WL_CONNECTED){







     Serial.println("WiFi Disconnected");





If the on-board led starts blinking then the ESP-01 module is getting connected to WiFi and is working.

Testing of NodeMCU 

In similar way as we tested the ESP-01 we can test the NodeMCU. To program the NodeMCU, all you need is a micro USB cable for connecting it to the COM port. The reset button and CP2102 (USB to UART) is inbuilt.

After connecting the board to COM port. Select the same board type “Generic ESP8266 Module”. Select the port according to device manager.

Led blinking code for NodeMCU is almost same as that of ESP-01. Just change the on-board led pin in code from “1” to “2” since the on-board led on NodeMCU is connected to GPIO-2 of NodeMCU. After uploading the code the led should start blinking. No need to reset as in case of the ESP-01. If the led blinks the board is ok.

WiFi testing of NodeMCU 

Upload the same code as that for WiFi testing of esp-01. Just change the on-board led pin number from “1” to “2”. Turn on the WiFi and then upload the code the led will start blinking as soon as the WiFi is connected. This indicates that the board is in good condition and is ready to be used in project.

Testing of ESP-32 

There is no on board led on ESP-32. So we will directly do the Wifi test. Upload the same WiFi code as given above. Just change the library name from “ESP8266WiFi.h” to “WiFi.h”. Select the board “ESP-32 dev module”. Select the port as shown in device manager.

Once the code is uploaded open the serial monitor. If the WiFi is turned on then the WiFi connected message along with IP address is displayed this indicates that the ESP-32 board is working fine.


In this way we made ESP boards compatible with Arduino IDE and also tested them. If you have any doubt regarding any part of this blog you can comment it, our team will be there to assist you.

For more interesting projects check out our YouTube channel.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *