Blink external LED on NodeMCU is very easy with this NodeMCU ESP8266 board as its self sufficient with everything on it. Detailed initial setup steps can be found here.

Led in itself has two terminals, anode (+ve) and a cathode (-ve). Do pay attention to it while installing it on the breadboard. You can check polarity with multimeter also. For visual understanding, the longer leg is the anode.

LED Terminals

Also, note that every LED has different specifications and voltage requirements. You can always check its datasheet to get those and then calculate the resistance requirement accordingly.

Resistance required
= (Power source voltage – LED voltage) / Current rating of LED (amp)

So in my case its, (5-1.8)*1000/25 = 128 Ω (approx). I am using a 100 Ω resistor. Higher the resistor value, lower the brightness. At around 128 Ω it will have max supported brightness. Lower resistance value may burn it in the long run.

REQUIREMENTS

  • NodeMCU ESP8266 Board
  • Micro USB Cable
  • LED’s
  • Resistance (as per LED, use formula described below) or 100 – 200 Ω in general.
  • Arduino IDE with ESP8266 board definitions & drivers installed

GETTING READY TO BLINK EXTERNAL LED

1. Install the NodeMCU board on the breadboard’s one side.
2. Install two LEDs on the breadboard with the anode (+) on D1 & D5 pin of NodeMCU while cathode (-) on the power rail.
3. Ground the same rail with resistance in series using any of the ground pins of NodeMCU.

Blink External LED Using NodeMCU ESp8266

4. Connect micro USB cable’s one end to Laptop and other to board’s USB port.
5. Open Arduino IDE and choose board NodeMCU 1.0 from Tools → Boards.
6. Set baud rate to 115200 and choose the port to which it is connected.
7. Copy the code below to IDE.
8. Go to Sketch → Upload
9. Wait for the code to get uploaded. Other blue LED near WiFi chip blinks continuously while the board is being programmed. Don’t confuse it for LED you code will blink.
10. Upon successful completion of the task, IDE will display 100% on the bottom zone and LED will start blinking.

CODE TO BLINK EXTERNAL LED

#define LED1 D1 //Led in NodeMCU at pin D1
#define LED2 D5 //Led in NodeMCU at pin D2 

void setup() 
{
 pinMode(LED1, OUTPUT);   //LED1 D1 pin as output 
 pinMode(LED2, OUTPUT);   //LED2 D5 pin as output 
}
 void loop() // runs/loops below code infinitely
{
 digitalWrite(LED1, HIGH); //turn on LED
 delay(300); 
 digitalWrite(LED1, LOW); //turn off LED
 delay(300);
 digitalWrite(LED2, HIGH); //turn on LED
 delay(300);            
 digitalWrite(LED2, LOW); //turn off LED
 delay(300); 
//delay defines duration in ms for which LED is on/off or in actual way, its //the duration for which program waits here on this line of code 
}
Arduino IDE Setup Plus Blink Onboard & External LEDs
Here the first blue LED on left blinks while the board is being programmed. After upload, you will see the external LEDs blinking.

Some Basic Things with NodeMCU ESP8266

Setup Arduino for NodeMCU programming

Blink Onboard Blue Colour LED

Interface With Relay (for controlling AC/DC devices)

Home Automation using NodeMCU and Blynk- Control device from anywhere

Get NodeMCU ESP8266 from Amazon India

0 0 votes
Article Rating
Subscribe
Notify of
59 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Luk
3 years ago

You can draw max. 12mA from the GPIOs. But they are also 3.3V. So you actually need (3.3V-1.5V)/0,025A = 60 Ohms. But that would kill the ESP8266 Chip, because it can’t handle more than 12mA per PIN. So 100Ohms is probably 10-15mA, which is fine again. But the LEDs arent that bright

1 year ago

social signals service

dlmpfkdno iujnk kepwldq cbwv fndmtumvrqrreje

1 year ago

… [Trackback]

[…] Info on that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] There you will find 92024 additional Info on that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Info on that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Read More Information here on that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Info to that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Here you can find 51657 more Info on that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Read More on to that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Find More on to that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Information to that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Find More here on that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] There you will find 82594 additional Information on that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Read More Information here on that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Info on that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Read More on on that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Find More to that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Read More to that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Info on that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Read More Information here to that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Information to that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Read More to that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Info to that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Here you will find 33762 additional Info on that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Info to that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Information on that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Read More here on that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Read More on that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Here you will find 58654 additional Info on that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

relaxing night jazz

1 year ago

Jazz

1 year ago

… [Trackback]

[…] Here you will find 8905 additional Information to that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

… [Trackback]

[…] Here you will find 76026 more Information to that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

jazz music

1 year ago

soft music

1 year ago

… [Trackback]

[…] Find More Information here on that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

bass type beat

1 year ago

bossa music

1 year ago

trap workout music

1 year ago

soothing piano

1 year ago

work jazz

1 year ago

… [Trackback]

[…] There you can find 73006 more Information on that Topic: abstractotech.com/blink-external-led-with-nodemcu-esp8266/ […]

1 year ago

sleeping music

1 year ago

stress relief

1 year ago

yoga music

1 year ago

relax music

1 year ago

coffee shop music

1 year ago

healing music

1 year ago

deep sleep

1 year ago

piano music

59
0
Would love your thoughts, please comment.x
()
x