ESP8266 ESP-12E NodeMCU V3 Lua – First steps

Introduction

In this tutorial we gona make the NodeMCU devboard to work and create a simple led blinking example.

Let’s see what components do we need:

nodemcu_all_component

1 x NodeMCU V3 Lua devboard ~3-4 USD (ebay link)
1 x Breadboard ~2 USD (ebay link)
2 x breadboard jumper wires (f-m) ~2-4 USD 3 x 40pcs (ebay link)
1 x micro USB cabel (most phone data cabel is ok for it) ~1 USD (ebay link)
1 x 10K resistor ~1 USD 50 pcs (ebay link)
1 x LED ~1 USD 100 pcs (ebay link)

I only bought 3 pcs NodeMCU V3 because I already own the other components from other arduino projects.

nodemcu_board

Install drivers

Before we start, you need to install the proper CH340 driver for your system.

Windows 8, 8.1, 10 link

Windows 7 link

At the first time when I connected to my PC nothing happened, because the USB cable what I used was an only charger cable, and can’t be used as a data sync cable… spent some time till I found the problem. Switched the cable to another one and after that everything was ok.

Flash firmware and connecting IDE

Download the Esplorer IDE (link) (Arduino IDE also can be used, but I didn’t tried yet, maybe in a later post) and the NodeMCU Flasher (link).

I needed to flash firmware for all three device because they wasn’t boot properly.

nodemcu_firmware_issue

Flashing the firmware is really simple just start the NodeMCUFlasher. select the proper COM port and click on flash. If the progress bar reach the end a green symbol will show up on the left-bottom corner of the window, indicating it’s done.nodemcu_firmware_flashed

It’s worked fine for me with the default settings, but many people suggest to reduce the baudrate to 9600 it will be a bit slower but more secure. I think if there were no error during the flash and the board boot up no need to reduce it.

nodemcu_firmware_flasher_config

Start ESPlorer and select the proper COM port, then click open. Sometimes the connection is hang with this screen and nothing happen:nodemcu_waiting_for_deviceJust hit the reset button on the NodeMCU and it will connect nicely.nodemcu_proper_boot

Put the things together

Connect D2 to the breadboard + and the ground to the -, put the resistor between the + and any inside line then put the LED longer pin to the same line as the resistor and the shorter pin to the -.

nodemcu_wireing

Create the program

Here is our code:

pin=2
gpio.mode(pin,gpio.OUTPUT)
aux=0
function blink ()
  if aux==0 then
   gpio.write(pin,gpio.HIGH)
   aux=1
  else
   gpio.write(pin,gpio.LOW)
   aux=0
  end
end
tmr.alarm(0, 500, 1, blink)

Save it as init.lua and then click on the save to ESP button, if it’s finished the program start to run immediately, if not you need to reset.

nodemcu_upload_file

I hope it’s helped you to getting started with NodeMCU, I will create additional posts with more stuff as I have time.

Záby