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
- ESP8266 NodeMCU v1.0
- Micro-USB to USB cable
- Breadboard (optional)
- LED (optional)
- 330 ohm resistor (optional)
- Male to male jumper wires (optional)
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).
Building the Circuit and Schematic
In case you have the LED, the resistor and breadboard you can connect all together following the schematic below. 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, which 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 installed 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”.
Note: If you prefer using ESP32 module, just use the following link instead: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
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;”
const int led = 5; //GPIO5
void setup() {
pinMode(led, OUTPUT);
}
void loop() {
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);
delay(1000);
}
I do agree with all of the concepts you have presented in your post. They’re very convincing and will certainly work. Still, the posts are very brief for starters. May you please lengthen them a little from subsequent time? Thank you for the post.