Home Automation over Online Server using NodeMCU is an IoT project to control our home appliances like light, fan, cooler, etc. from a website. In this project, we use NodeMCU and Relay Module.
We also develop a PHP website to command the NodeMCU for controlling our home appliances. We use a hosting server to online our website for controlling our home appliances from everywhere.
How it works
Setup the Website
First, we have to make a website and host it from an online server. We have developed a basic PHP website with an MYSQL database.
You have to perform following steps:
- Download the following PHP codes files which is in zip format.
- Now go to your PHPMyAdmin in your CPanel and create a database. Here we named our database as “autodb“.
- Now upload the PHP Scripting file to public_html in your CPanel’s File Manager.
- Extract the zip file and edit the connection.php file.
- Now change the “DB USERNAME“, “DB USERPASS”, and “DATABASE NAME” in the connection.php file.
- Now download the below SQL database file. Extract the Zip File.
- Import the SQL file to the “autodb” database in your PHPMyAdmin.
- Now browse the desired file location on the website in the web browser. For example – www.domain.com/automation. Here automation is the folder where we have saved our PHP files.
- The login credentials are Email: [email protected] and Password: 12345.
Circuit Diagram of NodeMCU with Relay Module
Code For NodeMCU
Now open the Arduino IDE and change the Board from tools.
Must See: How to program NodeMCU with Arduino IDE.
Now copy the below code and paste it in Arduino IDE. Change the WiFi SSID, Password, and Domain Name from “www.domain.com” in the below code.
Some More Articles For You: