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

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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

15 People Made This Project!


  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

125 Discussions


2 years ago

Thanks for sharing this. I could test my new esp_12E with builtin LED. Success in first attempt. Bingo !!!

1 reply
sadam al - haagfirosekhan

Reply 10 days ago

Hi can you help me with my new esp8266 nodemcu
it doesn't work .........


4 months ago

Thanks for detailed guide


5 months ago

Pursuing and learning technology always makes us smart and takes less time


7 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
Regards, mobdro


2 years ago

hello, please how can i do to generate a pwm signal with esp-12s using arduino IDE ?

1 reply

Reply 2 years ago

yes you should be able to do that as far as i understand. but you need to check which pin no has pwm function and also modify code accordingly.
good luck


Question 10 months ago

I have installed Arduin0 1.8.7 and followed the instructions. But when I goto Step 6 to selct Port, it shows grey and not selectable. My board is NodMcu V3, LoLin with CH340G chip.
Any help, please?



11 months ago

When Flashing NodeMCU development board, it is good. But when I unplug and plug the module again, it seem to go back to its empty state... why?????


1 year ago

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

Reply 1 year ago

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.


Reply 1 year ago

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


Reply 1 year ago

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.


Reply 1 year ago

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.

Gokuldas V R

1 year ago

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