Getting Started With ESP8266(LiLon NodeMCU V3) Complete Guide for IoT Startup With Example(as Server)





Introduction: Getting Started With ESP8266(LiLon NodeMCU V3) Complete Guide for IoT Startup With Example(as Server)

Things You Need:

  • NodeMCU Flasher Master (Flasher)
  • NodeMCU Firmware (Firmware)
  • Latest Arduino IDE (Arduino)
  • NodeMCU V3
  • Micro USB Cable
  • LED


  • Open-source, Interactive, Programmable, Low cost, Simple, Smart, WI-FI enabled
  • Arduino-like hardware IO
  • Lowest cost WI-FI

Step 1: Installing the Firmware

In NodeMCU Boards the first thing you need is to install the Firmware to the board

the following method works for all NodeMCU Boards

  1. Open the NodeMCU flasher master folder than open the win32/win64 folder as your computer. now open the folder Release than double click ESP8266Flasher.
  2. Select the COM Port.
  3. Goto config tab
  4. click on the small gear and open up the firmware which you have downloaded
  5. go to the advenced tab and select the desired Baudrate
  6. Goto the Operation tab and click on Flash Button.

Step 2: Preparing the Arduino IDE

After Installing the firmware you are ready to do the programming with the ESP8266

  1. Install the Arduino IDE
  2. open the Arduino IDE from the desktop icon
  3. Click on File tab and than open preferences
  4. In the additional Boards Manager URLs add the following link ( and click OK
  5. Goto Tools>Borads>Boards Manager
  6. In the search field type esp8266 click the esp8266 by ESP8266 Community option and click Install

Step 3: Code...

Now you can do whatever you want with your NodeMCU board
Following is an example for led blinking with NodeMCU board via webserver

  • In arduino IDE goto tools>Boards>select NODEMCU 1.0 (ESP - 12E Module)
  • again goto tools and select port.
  • Change the Wifi name and password from the following code.
  • Now click on Upload button to upload the following code.
  • Connect the led's positive leg on D9 pin of board and negative to the ground of the code.
  • Power up the board and open the serial monitor from arduino IDE
  • after connecting to the wifi it will show you the IP address.
  • type that IP address on the web browser(Edge, Chrome, Firefox etc..)
  • A webpage will open you can change the status of LED by turning it ON or OFF.

const char* ssid = "Tenda"; //your WiFi Name
const char* password = "12345678";  //Your Wifi Password
int ledPin = 03; 
WiFiServer server(80);
void setup() {
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW); 
  Serial.print("Connecting to ");
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
  Serial.println("WiFi connected"); 
  Serial.println("Server started");
  Serial.print("Use this URL to connect: ");

void loop() {
  WiFiClient client = server.available();
  if (!client) {
  Serial.println("new client");
  String request = client.readStringUntil('\r');
  int value = LOW;
  if (request.indexOf("/LED=ON") != -1)  {
    digitalWrite(ledPin, HIGH);
    value = HIGH;
  if (request.indexOf("/LED=OFF") != -1)  {
    digitalWrite(ledPin, LOW);
    value = LOW;
  client.println("HTTP/1.1 200 OK");
  client.println("Content-Type: text/html");
  client.print("Led is : "); 
  if(value == HIGH) {
  } else {
  }  client.println("");  
client.println(" On ");
   client.println(" Off ");  
  client.println(" ");
   Serial.println("Client disonnected");
  Serial.println("");   }
//code copied from link

If you encounter any problem comment it down



  • Clocks Contest

    Clocks Contest
  • Oil Contest

    Oil Contest
  • Water Contest

    Water Contest

22 Discussions


Question 6 weeks ago

NodeMCU connects successfully into the Wifi via an address.

When I paste the address into the browser, it's OK.

Next time, when I reset the board, another IP address is assigned it.

When I paste this new address into the browser it fail to open.


Hi. I folllowed your tutorial.
My board doesn't say "AI-THINKER" on the soc.
I followed your tutorial thoroughly and I get this error while uploading Blink:


error: failed sending 1097 bytes

.error: failed sending 1097 bytes

warning: espcomm_send_command: didn't receive command response

warning: espcomm_send_command(FLASH_DOWNLOAD_DATA) failed

warning: espcomm_send_command: wrong direction/command: 0x01 0x03, expected 0x01 0x04

the selected serial port warning: espcomm_send_command: wrong direction/command: 0x01 0x03, expected 0x01 0x04

does not exist or your board is not connected

Is it a fake dud board? The firmware flashware flashed without any problems.

Aprettiate your help.

All the best.

1 reply

Hi rcoelho3

warning: espcomm_send_command(FLASH_DOWNLOAD_DATA) failed

When Arduino IDE was programming the board, I opened the serial monitor, then I met above error.

I tried again by opening the serial monitor beforehand, and then I start downloading the sketch onto the board -> the error was gone.


I need to connect my weighing scale with nodemcu . The idea is to connect serial out of data from the scale to be connected to the board which should be connected to the wifi network and the weighing scale data could be fetched by a web socket application by putting board's I.P. address .

Please suggest code for the above . Thanks

So I have tried 5 different NodeMCU boards now. I have correctly added esp8266 library to board manager and downloaded the USB software to upload sketches.

I am able to upload sketches onto these boards. However, it appears that void setup is not running properly. Here is the basic test code I am running that leads me to this conclusion:

void setup() {
// put your setup code here, to run once:


Serial.println("Test void setup");

void loop() {
// put your main code here, to run repeatedly:

Serial.println("Test loop");

The result is shown in the pictures attached.

Essentially, the void loop runs fine but the serial.println is skipped. When I hit the reset button (file 2 attached), the "Test void setup" line is printed next to some gibberish. I thought maybe I could work around this for my project that will utilize and ultrasonic sensor to upload data to a Blynk app.

But, when I tried running that code nothing printed at all on the serial monitor (including loop print statements). That is a bad sign because I tested this on the Arduino Uno and it works fine. I do not think these boards are defective because this problem has repeated 4 times. Note I did not purchase 4 consecutive boards, I ordered the first two as a pair and thought maybe that brand had a bad batch. Then they sent me a replacement, after I had ordered another one from a different brand. Each has the exact same problem.

1 reply

i see even more garbage in mine, but at last it works

Arduino: 1.8.5 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Serial, 115200, 4M (3M SPIFFS)"

In file included from C:\Users\M4600.local\Documents\Arduino\jammerwifi\jammerwifi.ino:3:0:

C:\Users\M4600.local\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.0.0/tools/sdk/include/ESP8266WiFi.h:28:38: fatal error: include/wl_definitions.h: No such file or directory

#include "include/wl_definitions.h"


compilation terminated.

exit status 1

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.

what should i do? please help me

You should add the Driver link from the CH341SER

After 4-5-6 requests the program hangs on the loop:

while( ! client.available())

so, better to make exit by counter...

hello, I have same board LiLon NodeMCU V3, but I follow this article but not work....after upload firmware ai-thinker- anf then upload skertch not my wifi list there is faryLink:0B68C2 ssdi always present...


1 reply

serial.begin(9600); // 115200 can be too much

Hi, my firmware update does not work. Blue led is blinking when I press FLASH in the programmer but nothing is happening. Waiting MAC... please help me. I'm going crazy:))

1 reply


I did not have to press the FLASH button, just programmed out of the Arduino IDE

Hi, I have a problem on Arduino sketch at "#include"<ESP8266WiFi>, i dunno why it can't be uploaded

5 replies


The line should read : #include <ESP8266WiFi.h>


its because you might have not installed esp8266 library in arduino IDE. Try step 2

i've installed the library, maybe i should write "#include<ESP8266WiFi.h> adding ".h" ???

yes FajarR1 you are right. i did too and could upload the sketch