loading

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

<p>I've been playing with an ESP12EV2 I got from Banggood and have struggled but been ultimately successful in creating a little web server that can turn the 2 LEDs on my board on and off and blink them. But success with the Arduino IDE had eluded me until I watched your video (so, Thanks!). I look at this little device as a bit of a treasure hunt. The actual developers are very stingy with information and the really detailed documents are in Chinese (which I do not read). So we hunt and peck and poke around and collaborate and try to make something work. I'm sure I can do cool things with one. There is only one thing that I cannot resolve: I cannot get my iPhone to reliably connect to the ESP when it is in SOFTAP mode. It will maybe connect once but then I have to erase the flash and re-load the code I have written. Then it will connect again, but only once. Eventually I will figure that one out too. Thanks again!</p>
<p>Thanks for the pinout &amp; schematic. I am using an ESP-12 V2 I got on <br>banggood.com and it has two LEDs and I don't know how many you ESP has <br>because your schematic shows only one. On my boards, the one in the <br>middle is D0 / GPIO16. There is another that blinks when the board is <br>being flashed and that one is D4 / GPIO2. The pin mapping is a little <br>confusing because what the pinout calls D0 is GPIO16 and 16 for the <br>Arduino IDE. Likewise, D4 on the pinout is GPIO2 and 2 for Arduino. <br>Live and learn.</p>
yes it is true...pinout differences between arduino and nodemcu and esp8266 gpio are all different. I too had lot of confusion in the beginning. <br>I have same board like yours and two leds onboard same like you. in sketch I just showed externally connected led because it is understood that there are two more leds onboard nodemcu, shown in video.<br>nevertheless, I always remain confused between pin mapping differences. so, as a quick guide I have given a table with pin mapping on my blog here... <br>http://theelectromania.blogspot.it/2016/02/how-to-program-esp8266-esp-12e-nodemcu.html?m=1<br><br>enjoy IoT...
your are absolutely right. I too believe this is like a intelligent black box... n probably it is much versatile n useful than what is generally mentioned on the suppliers website. documentation is scattered n confusing. <br>I think, not sure, your problem might be related to interfence from some other wifi devices...like router, mouse etc running at same channel as that of ur nodemcu. it took a month for me to realise that my newly purchased wireless mouse was interfering my all other wifi devices. <br>good luck...
<p>i have nodemcu. first i connected nodemcu to router.after that i disconnect that router. after some time i connect nodemcu to other router which is not have internet connection . so my nodemcu is not connect that router... </p><p>so please give me solution for that as soon as possible</p>
it should connect to otherone too... irrespective of whether it is connected to internet or not. please check your wifi ssid and password. <br>also try changing security type of router e.g. psk, tkip etc.
<p>now im not able to access the port option itself to select the port</p>
good to know... driver reinstalling worked. <br>you can skip connecting external led. just check if you Onboard led blinks.... if uploading is successful then it should work. are you putting correct pin no in your sketch?
check if you have drivers installed properly for usb to ttl converter you are using ...refer my latest instructable and youtube video where I have shown how to install drivers...<br>are you using nodemcu?
<p>i am using node mcu</p>
https://youtu.be/fZX9FQuNBdc<br><br>check this video for installing drivers...
<p>What if you only have the esp-12 board and not the nodeMCU board? Like the image below without the DHT sensor, I can program the other board (on the white breakout board) with no problem.</p><p>Thanks in advance if anyone has any input, I also have the resistor between GPIO15 and ground on both boards.</p>
<p>Sorry, I have not understood your question, you say that you can program white board. And both boards not nodemcu. you can program White board using Arduino IDE and Black board cannot ?</p><p>I think it is straight forward to program is using Arduino as long as you have USB to TTL converter and you have made necessary pin connections.</p>
<p>I guess that was confusing, but I can program the 8266 12, but when I wire up the 8266 12-E, I am unable to program it, and the one time I was successful, it knocked all my other wireless devices offline when it connected to my wireless network.</p>
sounds strange. did you try to reflash or reset your esp.
<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>
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>
<p>nodemcu board is the best on the market right now in my opinion. for price and what it can do, there is just nothing else out there to even compete. </p>
<p>great tutorial, really helpful thanks :)</p>
<p>Very informative...Thanks!</p>
thanks for this great tutorial! <br>got one of those controllers around, time to play with it :)
Thanks.... glad to know it is helpful.... thats joy of opensourcing.<br>Good luck.