Have you ever wished you could control your home lights or appliances remotely, using just your smartphone, without needing any intermediate device like a dedicated hub or a computer always running? The IoT Remote Control Switch project does exactly that!
By leveraging a NodeMCU (ESP8266) board and a relay module, you can easily transform any 220V electrical appliance into a smart device, controllable via a simple web page in your phone's browser. This project operates completely autonomously — once programmed, it requires no further connection to a laptop or PC.
This project is perfect for beginners in IoT and home automation, offering a practical and rewarding experience.
- Wireless Control: Turn your electrical appliances ON/OFF over Wi-Fi.
- Standalone Operation: No need for a laptop or intermediary server after initial programming.
- Simple Web Interface: Minimalist and user-friendly interface accessible via any smartphone browser.
- Cost-Effective: Utilizes affordable and readily available electronic components.
- Scalable: Provides a solid foundation for more complex IoT projects.
- Basic Security: Avoids exposing sensitive Wi-Fi credentials in public code.
- Cross-Platform Access: Control from any device (phone, tablet, PC) on the same Wi-Fi network.
This project uses a NodeMCU ESP8266 board configured as a mini web server:
- Wi-Fi Connection: On power-up, the NodeMCU connects to your home Wi-Fi network using stored credentials.
- Internal Web Server: The board runs a small embedded HTTP server.
- Control Page: When you enter the NodeMCU's IP in your browser, it serves a control page.
- HTTP Commands: ON/OFF buttons send HTTP GET requests to the board.
- GPIO Control: The board sets the designated GPIO pin to HIGH or LOW based on request.
- Relay Activation: Relay switches the connected 220V appliance accordingly.
💻 Bit-Zone
📺 IoT Remote Control Switch(Video)
- Assembled NodeMCU + Relay Module
- Relay + Appliance Setup
- Final Installation in Enclosure
| Component | Quantity |
|---|---|
| NodeMCU ESP8266 Board (ESP-12E Module) | 1 |
| Single-Channel Relay Module (5V) | 1 |
| Micro-USB Cable | 1 |
| 5V Power Adapter (1A–2A recommended) | 1 |
| Jumper Wires (Male-Female) | as needed |
| 220V Light Bulb / Appliance | 1 |
| Plastic Electrical Enclosure (crucial) | 1 |
Low Voltage: NodeMCU → Relay Module
VIN→DC+GND→DC-D8 (GPIO15)→IN(RELAY_PIN)
High Voltage: Relay Module → 220V Appliance
- Cut the Live (L) wire from the wall outlet.
- One end →
COMon Relay - Other end →
NOon Relay
- One end →
- Neutral (N) goes directly from wall to appliance.
⚠️ Safety First: Always disconnect power before wiring. If unsure, ask an electrician!
Install the ESP8266 Board Support:
- Open Arduino IDE → File → Preferences
- In Additional Board URLs paste:
http://arduino.esp8266.com/stable/package_esp8266com_index.json
- Go to Tools → Board → Boards Manager → Search "
esp8266" → Install ESP8266 by ESP8266 Community
Required Libraries (auto-installed with board package):
ESP8266WiFi.hESP8266WebServer.h
- Open your
.inofile in Arduino IDE. - Replace Wi-Fi credentials:
const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASSWORD";- Check GPIO Relay Pin:
const int RELAY_PIN = D8;If relay logic is reversed, flip HIGH/LOW values in
digitalWrite().
- Select the board and port:
- Board: NodeMCU 1.0 (ESP-12E Module)
- Port: COMx (whichever matches your device)
- Upload the sketch using the
▶️ Upload button.
- Open Serial Monitor (baud: 115200) after upload.
- Wait for this message:
Connected! IP address: 192.168.X.X
- Unplug USB from your laptop.
- Power NodeMCU using a 5V phone charger.
- On your phone (connected to the same Wi-Fi), open:
http://192.168.X.X
- Use the web interface to turn your appliance ON/OFF.
- 220V is dangerous! Always disconnect power before wiring.
- Use a plastic electrical enclosure to avoid electric shock.
- Double-check wiring against the relay module’s datasheet.
- Never touch the relay or wires when the system is powered.
- If unsure, consult a qualified electrician.
✍️ Made by Farnaz


