Introduction: NODE MCU-LED Control (Simple Home Automation)

About: The lost creator

Hi Guys,

In this Instructable let us see how to control a LED bulb using your Smartphone.

We will be using Node-MCU for this project.

Refer to the below link to install Node MCU libraries (ESP libraries) in your Arduino IDE.


{ Follow Step 1 to Step 3 (Main steps) and

step 1 to step 3 (Sub-steps) in Step 4 from the above link }

Check out our blog

Step 1: Components Required

  1. Node MCU
  2. Male to Female jumper wire
  3. 3mm LED bulb
  4. Power Bank (optional)
    Do check out the "Latest Power Banks" in our blog.

Step 2: The Circuit Connection

Connect the LED + (The longer pin) to (GPIO-13) D7 Pin of Node MCU

Connect the LED - (The shorter pin) to GND Pin of Node MCU

(Don't connect LED TO WRONG PIN observe the Pin numbers on Node MCU carefully before connecting)

Nothing serious will happen if you connect to wrong pin😅😂 the led simply wont glow.

Step 3: THE CODE

Upload the below CODE to your NODE MCU


Replace your phone Wi-Fi Name and password in this part of the code before uploading.

const char* ssid = "********"; // Phone Wi-Fi name
const char* password = "********"; // Wi-Fi password

(Select the board and port properly from tools menu before uploading)

Step 4: Now It Works!

Switch ON the HOTSPOT Of Your phone

After uploading the code to the board do the following steps.

Detach the USB from your PC, and Plug it to your power bank.

open the serial monitor (Magnifier icon in the top right corner in Arduino IDE window)

You will be given an IP Address

open Google Chrome or any other browser in your phone and type that IP Address As it is in the Serial monitor.

You will get a page, Zoom to the top right corner of the page.

You will see ON OFF buttons.

Click on the buttons to control your LED.

You Can see the status of your LED in serial Monitor and also in your phone.

Now You have completed the very basic level of Home Automation Guys.

Keep learning and there is a Long Way to Go !

Step 5: Troubleshooting

If your LED did not Glow:-

  1. Check if you have connected the LED to the correct pin in NODE MCU.
  2. Check for the Positive and negative pins Properly.
  3. Check if your LED is working or not.

If you Cannot connect to your phone:-

  1. Check if you have replaced the SSID and Password of Your phone in the marked area of the code.
  2. Check for speling errors and CAPS/Special Characters in your SSID and Password in the code.
  3. Check if you have turned ON your Mobile Hotspot.
  4. Turn OFF mobile Data if needed.

If you Still have a problem uploading to your Board.

Refer to this Instructable: