ESP8266 NodeMCU – Blinking a LED

In this tutorial I am going to show you how to blink a LED using ESP8266 NodeMCU development board (version 1.0 in this case).

Parts Required

The ESP8266 NodeMCU v1.0 Pins

ESP8266 module is widely used in applications that need built-in Wifi, because of is lower size and price. Besides the Wifi capabilities this module also have a microcontroller Tensilica’s L106 Diamond of 32 bits. This module has lot of versions each one with different number of accessibles pins. The first version (ESP-01) had only 2 GPIOs and serial communication (TX and RX pins).
In this tutorial we will use NodeMCU v1.0 that is a development board to ESP8266 module (version 12-E).


Image available in <https://www.teachmemicro.com/nodemcu-pinout>, accessed in March 2019

Building the Circuit and Schematic

In case you have the LED, the resistor and breadboard you can connect all together following the schematic bellow. Here we are using “D1” pin from NodeMCU that in fact is connected internally to the “GPIO5” from the ESP8266-12E module. To complete this tutorial you can also use the built-in LED of the NodeMCU board, that in this case is connected internally to the “GPIO16” from the ESP8266-12E module.

Code

In this tutorial we will be using the Arduino IDE to program the ESP8266 NodeMCU. If you already used your Arduino IDE to program ESP8266 type boards you can skip to Step 4. If you want to know more details on how to do Step 1, Step 2 and Step 3 you can follow this tutorial of Arduino IDE.

Step 1: Start from open Arduino IDE. If you don´t have it istalled yet you can download the last version from here: https://www.arduino.cc/en/Main/Donate

Step 2: The first time you use ESP8266 based boards on Arduino IDE you need to add them to the boards manager. In “File -> Preferences” paste this link: http://arduino.esp8266.com/stable/package_esp8266com_index.json and click “OK”.

Step 3: Then you need to install them on “Tools -> Board -> Board Manager…”. Search by “esp8266” and install the last version of the boards.

Step 4: Select “NodeMCU 1.0 (ESP-12E Module)” board.

Step 5: Then copy the code bellow to your Arduino IDE project and save it. Connect your ESP8266 NodeMCU to your PC using micro-usb to usb cable and upload the code. In case you don´t have a LED you can use the built-in LED from the NodeMCU development board, just change the first line of the code bellow to “cons int led = 16;”

Video

André Martins

Author: André Martins

Born in Azores. Electrical Engineer interested in Automation, Robotics and Embedded Systems subjects. With a degree in Electrical and Computer Engineering in the field of Energy and Automation. Currently in Master's degree in Electrical Engineering.

1 thought on “ESP8266 NodeMCU – Blinking a LED

  1. Hello there, just became alert to your blog through Google, and found that it is truly informative. I am gonna watch out for brussels. I’ll be grateful if you continue this in future. Lots of people will be benefited from your writing. Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *