Testing Lolin NodeMCU V3 esp8266

I’m testing Lolin NodeMCU V3 esp8266. This is a tiny microcontroller with embeded wifi. The model we are trying has 1MB of flash ram plus 8k of dynamic ram. These are quite a lot for many purposes.

I’m using Arduino just for ease. But it’s got a Lua framework, this is that you can make Lua scripts upload them to the NodeMCU, link it to the init.lua script and run. I’m not going to show the Lua example in this post, but the Arduino IDE example.

The Arduino IDE can be customized for several boards that are not equivalent or compatible with Arduino Framework. For this a crosscompiler, some scripts and definitions have to be built. And there is a way to tell Arduino IDE to include these into the IDE.

To make your Arduino IDE know how to work with Lolin NodeMCU we have to include the plugin.

Start your Arduino IDE and select File|Preferences. A Form opens up and in “Additional Boards Manager URLs:” TextBox we writehttp://arduino.esp8266.com/stable/package_esp8266com_index.json and click [OK].

Now we have to download plugin and libraries.

So we click on Tools|Board|NodeMCU 1.0 (ESP-12E Module). This selects our new board to work with.

Now we click on Tools|Board|Board Manager… and search for esp8266 Board. Select it and click on [Install]. It takes a while, but this installs the plugin and the necessary modules.

Now we can plug the NodeMCU with a micro usb cable to our computer. It should identify a serial communication device. In my case it connects to /dev/ttyUSB0. You can check your linux system with the command: dmesg | grep tty

Make sure that Tools|Board|NodeMCU 1.0 (ESP-12E Module). Also select Upload Speed to 115200. And make sure your user is in dialup group. For windows users you can find directions elsewhere.

Now we are ready to make our first program.

Lets make a web server that turns the blue LED on and off.

This program is modified from Quick-Start-to-Nodemcu-ESP8266-on-Arduino-IDE

That example does not use the onboard blue LED. Besides the onboard blue LED is inverted respect to the pin’s voltage level. A low voltage level turns On the LED, and a High voltage level turns the LED off.

You’ll have to insert your wifi name and password in ssid and password variables. This is needed for the NodeMCU to connect to your wifi network.

const char* ssid = "your_wifi_name";
const char* password = "your_wifi_password";
int ledPin = 2; // Arduino standard is GPIO13 but lolin nodeMCU is 2 http://www.esp8266.com/viewtopic.php?f=26&t=13410#p61332
WiFiServer server(80);
void setup() {
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
// Connect to WiFi network
 Serial.print("Connecting to ");

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
 Serial.println("WiFi connected");

// Start the server
 Serial.println("Server started");

// Print the IP address
 Serial.print("Use this URL to connect: ");


void loop() {
 // Check if a client has connected
 WiFiClient client = server.available();
 if (!client) {

// Wait until the client sends some data
 Serial.println("new client");

// Read the first line of the request
 String request = client.readStringUntil('r');

// Match the request
 //Lolin nodeMCU has inverted the LED.
 //Low level turns on the led
 //while High level turns it off

int value = HIGH; //initially off
 if (request.indexOf("/LED=OFF") != -1) {
 digitalWrite(ledPin, HIGH);
 value = HIGH;
 if (request.indexOf("/LED=ON") != -1) {
 digitalWrite(ledPin, LOW);
 value = LOW;

// Set ledPin according to the request
 //digitalWrite(ledPin, value);

// Return the response
 client.println("HTTP/1.1 200 OK");
 client.println("Content-Type: text/html");
 client.println("<!DOCTYPE HTML>");

client.print("Led pin is now: ");

if(value == HIGH) {
 } else {
 client.println("<a href=\"/LED=ON\"\"><button>Turn On </button></a>");
 client.println("<a href=\"/LED=OFF\"\"><button>Turn Off </button></a><br />");

 Serial.println("Client disonnected");

Compile and load the program into your NodeMCU. It will show a sequence of dots and a percentage until it gets to [100%]. Then the program is loaded and running. Activate the Tools|Serial Monitor. Make sure it is configured at 115200 baud. It will answer something like this:

load 0x4010f000, len 1384, room 16
 tail 8
 chksum 0x2d
 csum 0x2d

Connecting to your_wifi_name
 WiFi connected
 Server started
 Use this URL to connect:

This address (It can be different at your site) is the address where the web server is listening for http requests.

When you connect to this address with your web browser you get:

Web Page

Your LED is initially Off. At the Serial Monitor you can see that your browser has connected to the server.

new client
 GET / HTTP/1.1
 Client disonnected

new client
 GET /favicon.ico HTTP/1.1
 Client disonnected

It may be slightly different in your case. When you hit the Turn On Button you get a LED ON at the board and the serial monitor reads:

new client
 Client disonnected

new client
 GET /favicon.ico HTTP/1.1
 Client disonnected

NodeMCUWhen you click on the [Turn Off] Button in the browser you get a led off and the following answer in the serial monitor.

new client
Client disonnected

new client
GET /favicon.ico HTTP/1.1
Client disonnected

Now you have an http controlled LED.

Related posts

4 Thoughts to “Testing Lolin NodeMCU V3 esp8266”

  1. The only gripe I have of the V3, is the width. It occupies the entire height of a breadboard from the outer 5-pin sockets.. One hack someone suggested, getting a short Minimum 15-pin width (5X15) breadboard, and sawing it right down the center, so the 5-point rails could be placed further apart. (have done so already with an old Radioshack breadboard. 276-0003, and cut it right down the center of the chip area.)
    I’m still trying to figure out LUA on both the -01 & the -12 on the Lolin.. (had been running stock NodeMCU, recently updated to a custom from https://nodemcu-build.com/ (does the build from the V2.1.0 source, allowing you to pick which modules to add, then EMAILS You the Float & Integer firmwares.)

    1. enrique

      Sawing the breadboard is a clever idea, but will make it difficult for some other chips. In my case, I’ll adapt them for some geophysical data loggers, so most likely I’ll make a PCB with the adequate connectors in it.
      I did not have time to experiment with LUA yet. But I will.
      I had not tried custom builds from https://nodemcu-build.com/ but I will investigate about it…

      Stephen, Thank you very much for your comments and information.

    1. enrique

      Yes. It is similar to several others. Another is cited in the post. But this one you pointed to i sa little more interesting because gets more information on its web site like number of blinks, delay and pin to use… That one is already a modification from another…. https://www.esp8266basic.com/blink-example.html

Leave a Comment