NODE MCU-LED Control (Simple Home Automation)

by Santhana_krishnan in Circuits > Arduino

601 Views, 2 Favorites, 0 Comments

NODE MCU-LED Control (Simple Home Automation)

IoT-Security_Hitachi-Systems-Security-37kd0diyt2rr6x4h2e6adc.jpg

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.

NODE MCU-BASICS

{ 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 https://techiedoode.in/latest-budget-and-best-performance-webcam-in-india-2021/

Components Required

4a75924-2_bp_blogspot_com_-9-vKnWKXmg8_VYlTf9HWkEI_AAAAAAAAEe0_3th9OfSKb5k_s1600_NodeMCU-development-board-for-ESP-12E-from-ESP8266-esp-12E-Lua-IoT-programable-diy-rc-toy_jpg.png
81fafaaa-img_jumper_wire.jpg
led-rot-3mm-standard.jpg
  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.

The Circuit Connection

NodeMCU_V2_v2.png

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.

THE CODE

Upload the below CODE to your NODE MCU

IMPORTANT:

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)

Downloads

Now It Works!

serial mon 1.png
Screenshot_20200613-175456_Chrome.jpg
Screenshot_20200613-175439_Chrome.jpg
ser mon 2.png

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 !

Troubleshooting

bigstock--189739801.jpg

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:

NODE MCU-BASICS