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 https://www.youtube.com/watch?v=x7GzK7zHKOk

**Arduino logo and NodeMCU logo are their respective trademarks- logos shown in above image were taken from -https://github.com/nodemcu and https://www.arduino.cc/en/Main/Software

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 Banggood.com

<p>Very good intro to the ESP2866 - thanks!</p><p>One question:</p><p>Why do the onboard led and the external led alternate flashing? I understand that D0 is the pin for the onboard led, but when the sketch says &quot;off&quot;, why does one still light up?</p>
<p>InBuilt LED on the ESP module is lighting up when the input is LOW. It has a name, like pull-up or something, I can't remember.</p>
<p>The name is LED_BUILTIN which can be made high or low in the following way-</p><p>digitalWrite(LED_BUILTIN,HIGH);</p>
it is because onboard led is Active Low i.e. it is connected to same pin but with internal pull up or down, i am not sure though.
<p>I have my breadboard used at the moment for a different project. But i was able to make the internal red LED blink with this same project.</p>
<p>Hi...</p><p>(LED_BUILTIN) is the proper word for in built led</p><p>digitalWrite(LED_BUILTIN,HIGH) will work </p>
<p>I made this project once, then change my esp8266 to a arducam esp8266, and started getting the USB not found message, but after some good trial and error, I was able to download an esp8266 driver for Win10 and get things running again on my NodMCU 12-E</p>
<p>Thanks for the thorough walk-through</p>
<p>is it IoT? </p>
<p>Thank's for this short and complete introduction !</p>
<p>I have problem send wrong direction. Also AT+GMR result is and AT+RST result is error.</p>
i have not understood your problem.
ESP8266 ESP-12E CH340G WIFI Network Development Board Module For NodeMcu Lua ,, I have this board which i recently buy can i program it with arduino IDE and is it able to connect to blynk application ?
yes you can do all of that.
<p>But probably you will need CH340 serial drivers which are hard to find once I had detection problem with cheap Chinese Arduino nano boards which had CH340 chip on it. </p>
<p>absolutely yes</p>
<p>Works for me :)</p>
<p>hello, please how can i do to generate a pwm signal with esp-12s using arduino IDE ?</p>
<p>Hey, can I use the PWM pin to dim a light bulb?</p>
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. <br>good luck
<p>Thanks alot for the response! :)</p>
<p>I need code for esp nodemcu to connect it with arduino on internet</p><p>plzzzzzz</p>
i haven't done that yet but will do soon.
<p>hi im using nodemcu v3(lolin) i installed ch340G driver but the device is connecting and disconnecting continuously plz help to solve this issue and what baud rate i need to use 9600 or 115200 , in board they mention 9600</p>
i had this issue mostly when i use bad or low quality usb cable. try changing cable.
<p>Hello. <br>I didn't have any error, but nothing happened! I mean that the external LED didn't blink.......<br>What can I do?</p>
<p>Hello Jessteleco,</p><p>I have the same problem with both two boards which I have. Please, have you solved it finally? If yes, please, can you share the solution with me/us? Thanks</p>
<p>Can you go through it and let me know if it helped ?https://arduinonovice.wordpress.com/2017/01/09/how-to-use-nodemcu-module-having-esp826-with-arduino-software/</p>
<p>Can you go through it and let me know if it helped ?https://arduinonovice.wordpress.com/2017/01/09/how-to-use-nodemcu-module-having-esp826-with-arduino-software/</p>
just check if right pin no is selected in sketch and led is connected properly
<p>Try installing the driver listed on this page that matches your operating system.</p><p>https://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx#mac</p>
<p>Can the esp8266 only upload and download from websites or can I give it an IP address and port number to get info from a C++ app I wrote?</p>
<p>Of course. You can start from Examples -&gt; ESP8266WiFi -&gt; WiFiClient. That's simple base for TCP client/server. You might want to change the httpPort and printed string to something else.</p><p>Currently I have managed to build couple of LoLin temperature/CO measuring clients and RPi as a server.</p>
sounds interesting. ..i haven't tried hooking up to internet. if you manage to do that please share...
<p>Great Tutorial. Thanks a lot. </p><p>As an additional comment, in my case the &quot;Blink example&quot; did not appear inside esp8266 library. But as tip for others, where the same happen, the sketch is the same as included in &quot;Examples/Basics/Blink&quot;. Only change the pin 13 for D0 or 16:</p><p>/**********************************************</p><p> Blink</p><p> Connected to pin D0 (GPIO16) ESP8266 NODEMCU</p><p> **********************************************/</p><p>void setup() </p><p>{</p><p> pinMode(D0, OUTPUT);</p><p>}</p><p>void loop() </p><p>{</p><p> digitalWrite(D0, HIGH); </p><p> delay(1000); </p><p> digitalWrite(D0, LOW); </p><p> delay(1000); </p><p>}</p>
thanks for sharing
the only way I can upload Arduino sketches with these boards is to press the reset and flash let simultaneously for a second and then let go of the reset key first, then it is able to upload the sketch.
that is weird because if you are using nodemcu it should work without any additional steps.
<p>good i'ble.Now after passing through everything ,</p><p>during uploading, i get this</p><p>warning: espcomm_sync failed</p><p>error: espcomm_open failed</p><p>error: espcomm_upload_mem failed.</p><p>what might be the reason , i am sure with the correctness of the serial port .</p>
<p>Hello dude i had the same problem, I solved by connecting gp0 and gp15 to ground, the before uploading the sketch disconnect and connect the usb thing</p><p>Tell me your results</p>
<p>I have the same exact problem and changing the baud rate didn't work.</p><p>Moreover, when I try to connect to the flasher program it doesn'find the board!<br>Anyone solved this?</p>
MatteoG2! Hello.!!<br>Install CH340G driver.Installing the driver solves ur prob.
<p>Hi Manoj! Thank you for answering! I just followed your suggest but still didn't worked. Actually because the chip mounted on my node MCU is the CP2102, and my PC actually recognize it on the serial port! <br>When compiling a sketch in the Arduino IDE, the antenna led blinks three times then the IDE tells me:</p><p>warning: espcomm_sync failed</p><p>error: espcomm_open failed</p><p>error: espcomm_upload_mem failed</p><p>error: espcomm_upload_mem failed</p>
<p>Hi Manoj. </p><p>I had the same error and the only way that my NODEMCU worked was setting up the speed to 115.200 and not 9.600 as specified at back of the board. Worked fine since after. </p>
<p>HI,</p><p>Very likely you have two (or more) Arduino-IDE/Serial monitor windows open.</p><p>Dave</p>
I remember having this error at some point but cannot recall correctly what I did to resolve it..<br>do you have anything connected to io pins of ur esp? especially D0 , if so just remove it for a while during programming. secondly, esp are power hungry devices... my esp shows errors when several sensors/peripherals are powered directly through nodemcu. just as a test, first try upload sketch on a bare board.<br>I hope this helps a bit. good luck
check your com port number and settings.
<p>if someone in the community could solve this,i would be grateful to them</p>

About This Instructable




Bio: A Researcher, an Engineer and an electronics enthusiast
More by TheElectromania:Quick Digital thermometer using cheap USB to TTL converter and  DS18B20 - WITHOUT Arduino or Raspberry Pi Digital thermometer on OLED display using ESP8266 ESP-12E NodeMCU and DS18B20 temperature sensor PIR Motion Detector With Arduino: Operated at Lowest Power Consumption Mode 
Add instructable to: