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)
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 https://techiedoode.in/latest-budget-and-best-performance-webcam-in-india-2021/
Components Required
- Node MCU
- Male to Female jumper wire
- 3mm LED bulb
- Power Bank (optional)
Do check out the "Latest Power Banks" in our blog.
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.
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!
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
If your LED did not Glow:-
- Check if you have connected the LED to the correct pin in NODE MCU.
- Check for the Positive and negative pins Properly.
- Check if your LED is working or not.
If you Cannot connect to your phone:-
- Check if you have replaced the SSID and Password of Your phone in the marked area of the code.
- Check for speling errors and CAPS/Special Characters in your SSID and Password in the code.
- Check if you have turned ON your Mobile Hotspot.
- Turn OFF mobile Data if needed.
If you Still have a problem uploading to your Board.
Refer to this Instructable: