Programming ESP8266 ESP-12E NodeMCU Using Arduino IDE - a Tutorial





Introduction: Programming ESP8266 ESP-12E NodeMCU Using Arduino IDE - a Tutorial

About: A Researcher, an Engineer and an electronics enthusiast

NodeMCU Dev Board is based on widely explored esp8266 System on Chip from Expressif. It combined features of WIFI accesspoint and station + microcontroller and uses simple LUA based programming language. ESP8266 NodeMCU offers-

--Arduino-like hardware IO

--Event-driven API for network applicaitons

--10 GPIOs D0-D10, PWM functionality, IIC and SPI communicaiton, 1-Wire and ADC A0 etc. all in one board

--Wifi networking (can be uses as access point and/or station, host a webserver), connect to internet to fetch or upload data.

--excellent few $ system on board for Internet of Things (IoT) projects.

Recently, there has been interest in programming ESP8266 systems using Arduino IDE. Programming, of ESP8266 using Arduino IDE is not very straight forward, until it is properly configured. Especially because, the Input and output pins have different mapping on NodeMCU than those on actual ESP8266 chip.

I had request about showing how to program ESP-12E NodeMCU using Arduino IDE. I struggled myself earlier in the beginning, so thought of making this Instructable for beginners. This is quick guide/tutorial for getting started with Arduino and ESP8266 NodeMCU V2 ESP-12Ewifi module. (I think, this method can be used for other NodeMCU boards too. (or only ESP8266 boards, but with necessary hardware modifications and using FTDI modules for programming- not covered in this tutorial because, this is only for NodeMCU dev boards).

This Instructable gives quick intro to-
1) Installing Arduino core for ESP8266 WiFi chip in Arduino IDE and Getting started with sketches written using Latest stable Arduino IDE 1.6.7

2) Run/modify basic LED blink sketch to blink onboard LED and/or externally connected LED at pin D0 or GPIO-16 as per the pin configuration mentioned here and here.

NOTE- To use NodeMCU V1 or V2 or V3 dev boards using Arduino IDE, we do not need to flash it with firmware using nodemcu flasher. It is required only if we intend to program NodeMCU using Lua script with esplorer etc.

I have other video published on getting started with NodeMCU and flashing NodeMCU firmware on following link

**Arduino logo and NodeMCU logo are their respective trademarks- logos shown in above image were taken from - and

Step 1: NodeMCU ESP-12E Pin Mapping

First and foremost word of - CAUTION !

* The ESP8266 chip requires 3.3V power supply voltage. It should not be powered with 5 volts like other arduino boards.

* NodeMCU ESP-12E dev board can be connected to 5Vusing micro USB connector or Vin pin available on board.

* The I/O pins of ESP8266 communicate or input/output max 3.3V only. i.e. the pins are NOT 5V tolerant inputs.

In case you have to interface with 5V I/O pins, you need to use level conversion system (either built yourself using resistor voltage divider or using ready to use level converters (e.g. these ones adafruit or aliexpress etc.).


The pin mapping of NodeMCU dev board are different from those of ESP8266 GPIOs. Attached images gives mapping of pins, source of images.

More information about pins is available on following links:

* Github - NodeMCU

* Github-esp8266/Arduino

Step 2: Installing Arduino Core for NodeMCU ESP-12E Using Arduino Boards Manager

As shown in the image, Copy the .json link with latest stable release of NodeMCU package from Github page here.

The link should look something like this-

Step 3: Insert Link for .json NodeMCU Package Files Into Arduino IDE

Paste the copied link and insert it in Arduino IDE using following sequence-

File menu - Preferences-

Paste copied link into the area shown in black box in above image. Close and restart the Arduino IDE.

Step 4: Tools - Boards Manager

Tools - Boards managerand search for ESP8266 and install the libraries/files given under heading ESP8266 by ESP community.

Restart the Arduino IDE once again.

Step 5: Selecting NodeMCU Board in Arduino IDE

Go to Tools - Boards (scroll down the list of boards) - Select NodeMCU 1.0 ( ESP-12EModule).

Select the Port number at which you have connected nodeMCU. Rest of the settings can be left to default values.

Step 6: LED Blink - Connections for External LED

We will be connecting external LED directly to GPIO16 or D0 pin of NodeMCU (no need of external current limiting resistor). This is the pin number for onboard LED or BUILTIN_LED (in my case it is blue LED - some boards might have green or red LED).

Step 7: LED Blink - Example Sketch

Go to File - Examples - ESP8266 - Blink

In my video, I have modified the sketch to blink LED faster, but you can leave as it is and just upload the sketch to ESP and there you go... the On-board LED blue and external LED red starts blinking alternately at every second.

Congratulations for successful configuration of Arduino IDE for ESP8266 NodeMCU dev boards.

Note- In case, if Arduino IDE version 1.6.7 fails to work for you, try to go back to arduino 1.6.5 or backwards. (I have heard, some NodeMCU boards have issues with latest versions of Arduino IDEs and going to earlier versions of Arduino IDE solves the problems).

Good luck for fun with this amazing system on board.....

Helpful links-

My Doit NodeMcu Lua ESP8266 ESP-12E WIFI Development Board was from

10 People Made This Project!


  • Water Contest

    Water Contest
  • Oil Contest

    Oil Contest
  • Clocks Contest

    Clocks Contest

116 Discussions

What if we want to connect multiple sensors who needs 5V supply? and also want to ask how we are supposed to power the nodemcu without connecting it with computer with a data cable?

4 replies

Once you upload your code with the IDE it's in memory. So it becomes plug and play! You can take any 5v phone charger with the micro usb plug and boom! Just like plugging in an Alexa or a Roku to power. As for knowing your code is running you can do some start up process like blinking the led 3 times in sequence on start up to show you your code is running (Or even blinking 3 times every minute ect). As for connecting 5v sensors you are going to need to do some calcs and drop the voltage down to 3.3v (It's not about dropping the sensors power voltage, it's about dropping the sensors output voltage) my guess is for analog input you will need to account for that change to the input in your code, but for digital logic my amateur mind is telling me you should be fine (on off on off vs 1 2 3 4 5 4 3 2 4) Clearly I am no expert, but hopefully that helps a little.

Just put your mobile phone charger it's output is same 5v easy to take anywhere simple

about connecting to external supply you can use battery power pack and connect via microusb (5v) or using Vin pin (3.3v). applying more than 3.3v directly to any gpio pins will damage esp8266.

you cannot apply more than 3.3v on any Gpio. if you want to use 5v sensors then use voltage divider for level conversion Or get level converter modules from ebay etc.

warning: espcomm_sync failed

error: espcomm_open failed

error: espcomm_upload_mem failed

showing these errors while uploading programs.

can somebody help me to reslove this?

I am using nodemcu esp8266 v3 module

1 reply

Below method fixed similar issue on NodeMCU 1.0 (ESP-12E Module) board, so I think it may fix your issue too:

Reset Method: clk -> nodemcu



5 months ago

i can't compiling every time i get this error: Arduino: 1.6.13 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)" Board nodemcuv2 (platform esp8266, package esp8266) is unknown Error compiling for board NodeMCU 1.0 (ESP-12E Module). This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences. can you help me


I would like to turn on 2 GPIO with one command. Could you suggest how I might do that please (for motor controls)

Thank s

1 reply

Hi after uploading the sketch can i plug the board to an electrical output with an adapter and the sketch will run as with the pc?

1 reply

yes you can connect to external power supply through micro usb port (5v) or through Vin pin (3.3v).

Can I upload code to NODEMCU by connecting USB cable from Arduino IDE, or do I need to provide a power supply and then connect the code? I have searched a lot but did not find anything relevant. Found this and I hope this helps, Thanking you in advance.

2 replies

Yes you can. Connect USB, select correct board and COM port and upload like any Arduino board.


Thanks for this tuto.
With the miniUSB, ok, my led blink. Unfortunately, when unplugging miniUSB and plugging Vin to 5V and GND to GND, it doesn't work. Something wrong ?

3 replies

Nodemcu can't handle a 5V input. The article stressed on that

ESP8266 needs 3.3V

NodeMCU can be fed 5V


11 months ago

If I change the blink rate on my

ESP8266 ESP-12E NodeMCU board, Will it delete my Tank car software thats installed on it?