NodeMCU LED Blink in Proteus and on Breadboard

 Here is first hello program for NodeMCU which is blinking a LED on and off. NodeMCU is a WiFi connectivity microcontroller board which is normally used for IoT applications development. The NodeMCU uses the ESP8266 System on Chip(SoC). The ESP8266 based NodeMCU has 17 GPIO pins which can be used as normal input output pin or for I2C, I2S, UART, PWM and IR remote control. The GPIO can also be enabled with internal pull-up or pull-down, or set to high impedance. When a pin is used as an input, the pin can also be configured with edge-trigger or level-trigger with CPU interrupts. The NodeMCU has 4 pins which can generate Pulse Width Modulation (PWM) signal. The PWM signal can be used to drive LED and for driving DC motors. Here we will illustrate simple LED blink.

Before you can program the NodeMCU ESP8266 module you need to download and install the ESP8266 library in Arduino IDE. The LED Blink using ESP8266 & Arduino IDE explains how to install the ESP8266 library in Arduino IDE. That tutorial used generic ESP8266 module, here we will be using ESP8266 NodeMCU.

The following shows the circuit diagram and simulation of NodeMCU LED blink in proteus.

NodeMCU LED blink circuit diagram

The following shows NodeMCU LED blink on breadboard.

NodeMCU LED blink on breadboard

The following is LED Blink program code for NodeMCU.

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(D5, OUTPUT);

// the loop function runs over and over again forever
void loop() {
  digitalWrite(D5, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(300);                       // wait for 300ms
  digitalWrite(D5, LOW);    // turn the LED off by making the voltage LOW
  delay(300);                       // wait for 300ms

In the above code, we have used the digital pin 5(D5) for connecting and blinking the LED. In the setup() function we first make it as output and then in the main loop() function we send HIGH and LOW voltage level to the D5 pin with 300ms delay between the LOW and HIGH. In this way we can blink the LED.

The following video shows simulation of NodeMCU LED blink in Proteus Professional and on actual breadboard.


Previous Post Next Post