This project uses an ESP8266 microcontroller to create a web server for remotely managing a computer's power state. It includes features like a login page, failed login handling, and a control panel for turning on the computer.
- Login Page: Secure access to the control panel.
- Failed Login Handling: Informative messages for incorrect login attempts.
- Control Panel: Simple interface to remotely turn on the computer.
- ESP8266 Microcontroller: Used as the main controller for the web server. I used "Wemos D1 Mini".
- Relay switch: Relay swich is used as a switch (who would have guessed). i used "JQC-3FF-S-Z Module KY-019 5V One 1 Channel Relay"
- You can purchase the required ESP8266 microcontroller, such as the "Wemos D1 Mini," from this link.
- You'll need a relay switch like this one.
To enable communication between the ESP8266 and the relay switch, follow these wiring instructions:
- Connect the ESP8266 5V pin to the Relay Switch 5V pin.
- Connect the ESP8266 GND (Ground) pin to the Relay Switch GND (Ground) pin.
- Connect the Relay Switch IN pin to the ESP8266 D1 pin.
You have the flexibility to power the ESP8266 through various methods:
-
Motherboard Connection:
- Connect the ESP8266 Ground (GND) pin to the Motherboard Ground pin.
- Connect the ESP8266 5V pin to the Motherboard 5V pin.
- Note: Refer to your motherboard manual for an appropriate port; I connected mine to an available port providing USB power to the computer's front panel.
-
USB Port:
- Use the ESP8266 USB port.
- Connect it to a power source like a phone charger or a computer's USB port.
- Note:If you choice computer's USB port, this option may depend on your motherboard's settings.
Ensure secure connections based on your preferred power option for reliable functionality.
- Connect the ESP8266 and relay switch to your computer.
- Update Wi-Fi credentials and login details in the code.
- Upload the code to the ESP8266.
To enhance the security of your ESP8266 Computer Control, consider changing the default login credentials. Follow these steps:
-
Open the Arduino sketch file.
-
Locate line 211, which contains the following code:
if (username.equals("admin") && password.equals("admin")) {
Update the values within the parentheses to your preferred username and password. For example:
if (username.equals("your_name") && password.equals("your_password")) {
To enhance security, consider modifying the URL paths in the code. Follow these steps:
-
Open the Arduino sketch file.
-
Locate line 32 for the control panel path and line 33 for the turn-on path. Change them to unique identifiers, for example.
server.on("/controlpanel", HTTP_GET, handlePower); server.on("/turnon", HTTP_GET, handleTurnOn);
To somesting like:
server.on("/rianKziYiCgMkdeMQkTDptmEPBPhtJqjMtRQStHx", HTTP_GET, handlePower);
server.on("/fhHeBfgTeeTTspNBnCtXFAdnRggEDMjXQjTzGXjn", HTTP_GET, handleTurnOn);
And also change line 213 and line 285 in the code to match what you modified on lines 32 and 33.
server.sendHeader("Location", "/controlpanel", true);
html += " fetch('/turnon');";
To
server.sendHeader("Location", "/rianKziYiCgMkdeMQkTDptmEPBPhtJqjMtRQStHx", true);
html += " fetch('/fhHeBfgTeeTTspNBnCtXFAdnRggEDMjXQjTzGXjn');";
- Power on the ESP8266 and ensure the relay switch is connected.
- Connect to the Wi-Fi network.
- Open a web browser and navigate to the ESP8266's IP address.
- Log in using specified credentials.