Introduction: Get Started With NodeMCU (ESP8266)....
In this Instructable, I'm sharing how you can get started with NodeMCU(ESP8266) with Arduino IDE. This tutorial is for beginners who are just getting started. NodeMCU is just like Arduino with onboard Wifi, so you can take your projects online. To know more about NodeMCU visit its official website here.
I will be sharing more projects based on this so make sure to follow me if you are interested.
So let's get started.
Step 1: THINGS YOU NEED :-
- Arduino IDE.
- CP210X Driver.
- NodeMCU [ ESP8266 ] (Amazon IN / Amazon US / Amazon UK )
- LEDs (Amazon IN / Amazon US / Amazon UK)
- Breadboard. (Amazon IN / Amazon US / Amazon UK)
That's all you will need to refer to the best buy links if you don't already have the Board.
Once you have the required things. Move to the next step.
Step 2: SETTING UP THE IDE :-
- First Download and Install Arduino IDE.
- Goto >> Files >> Preferences and paste following Link in "Additional board manager URL's"
"http://arduino.esp8266.com/stable/package_esp8266com_index.json" (Without the quotes)
- Click ok, Now Goto >> Tools >> Board >> Board Manager.
- Scroll down to find ESP8266 and click on install.
This will add all the ESP boards to the IDE.
Now to recognize the Board on the computer you have to install CP210X Drivers. It is very simple. Just visit the link and download the version compatible with your device.
now you have to select the correct board, Here I have used NodeMCU 1.0 (ESP-12E Module).
After selecting the board follow the settings below:-
- Flash Size : "4M (3M SPIFFS)"
- Debug Port: "Disabled"
- Debug Level: "None"
- IWIP Variant: "V2 Lower Memory"
- CPU Frequency: "80Mhz"
- Upload Speed: "921600"
- Erase Flash: "Sketch On"
- Port: "COM port available" (where the device is connected should show up)
Now you can upload your sketch on the board.
(Refer to the pictures for details.)
Step 3: UPLOADING THE SKETCH :-
Now that the IDE is set up for NodeMCU you can test it by uploading an Example sketch as follows:-
- In IDE Goto >> Files >> Examples >> ESP8266
- Select the Blink Example and upload it.
The onboard LED should start to blink. That means you successfully programmed the board. The onboard LED is connected to pin D0 of NodeMCU. You can add an external LED to Pin D0.
Now for you to work with NodeMCU you have to know the pinouts and Arduino to ESP8266 Pin mapping.
Here I have listed the NodeMCU's pin and corresponding Arduino pins :
- D0 = 16
- D1 = 5
- D2 = 4
- D3 = 0
- D4 = 2
- D5 = 14
- D6 = 12
- D7 = 13
- D8 = 15
- D9 = 3
- D10 = 1
So to use pin D0 of NodeMCU you have to use Pin 16 in Arduino IDE.
If you have any doubts, you can ask in the comments.
In the next Instructable I will show you how you can control LEDs over the Internet from anywhere in the world. Check it out here.
Do check out our website and blog for more articles and projects.
9 Comments
Question 2 years ago on Introduction
How many PWM pins are on this board??
Reply 2 years ago
NodeMCU uses software PWM and all GPIO pins support that.
2 years ago on Step 3
Great tutorial. Thank you.
3 years ago
i need to move a project to a NodeMCU's from an arduino nano cause i need remote monitoring? i am using an IC2 display on pin A4 and A5 with a analog sensor on pin A2 and a DS18B20 on pin D2 . i cannot figure out the right input for it or how to set the code up to make GPIO 4 and 5 act as A4 (SDA), A5 (SCL). can you please help me ?
Reply 3 years ago
Here is a project that might interest you:
https://www.instructables.com/id/Indoor-Weather-Station-V20/
Reply 3 years ago
Pin D1 and D2 are SCL and SDA respectively on ESP8266. To use with the display just download the proper drivers compatible with NodeMCU. The example code will suearly help understand the working.
3 years ago
Hello, I need immediate help as I am trying to program this device for 2 days by now. All the settings were done in Arduino IDE.but it always shows a compiling error as"exit status - 1073741515, Error compiling for board NodeMCU 1.0 (ESP-12E Module)"
The module is well worked with MicroPython. Before going to Arduino, firmware update was also done.
Thanks.
Reply 3 years ago
That line alone doesn't specify any problem, copy the log and paste it here.
3 years ago
Depending on which version of the ESP you have the LED_BUILTIN might not work. It can just be acces by calling pin 2 (https://github.com/esp8266/Arduino/issues/2627)