◆Smart Home Ideas Journal

DIY ESP32 Smart Plug Guide: Control Your Home with Ease

By

Are you tired of manually switching your electrical appliances on and off? Say hello to theesp32 smart plug, a DIY project that turns your regular plug into a smart one. The ESP32 is a low-cost, low-power system on a module that can be used to create IoT projects, and combining it with a smart plug lets you control your devices remotely or automate them based on schedules or sensors.

The ESP32's built-in Wi-Fi and dual-mode Bluetooth make it an excellent choice for smart home projects. In this guide, we'll show you how to create a DIY ESP32 smart plug, complete with over-the-air updates and seamless integration with platforms like Home Assistant and Blynk.

Gathering Materials and Setting Up Your Environment

Before you start, ensure you have the following materials:

How to Power the ESP32 Correctly ⚡
How to Power the ESP32 Correctly ⚡
The 10 Best ESP32 Smart Home Projects
The 10 Best ESP32 Smart Home Projects
🌐 ESP32 + IFTTT = Smart Home Magic! ✨
🌐 ESP32 + IFTTT = Smart Home Magic! ✨
  • ESP32 development board (like the DevKitC V4)
  • Wi-Fi-enabled smart plug (e.g., Sonoff Basic)
  • Jumper wires
  • Female-to-male USB cable
  • Computer with Arduino IDE installed

Connect your ESP32 to your computer using the USB cable. Then, open the Arduino IDE and set it up for the ESP32 by going to File > Preferences, and entering the following URLs in the Additional Boards Manager URLs field:

http://arduino.esp8266.com/stable/package_esp8266com_index.json

10 ESP32 Skills Every Maker Should Learn
10 ESP32 Skills Every Maker Should Learn
ESP32 Smart Home System With Alexa App & Manual Switches
ESP32 Smart Home System With Alexa App & Manual Switches
GitHub - danpeig/ESP32EnergyMonitor: Multiple phase DIY energy consumption monitor using ESP32 and ESPHome
GitHub - danpeig/ESP32EnergyMonitor: Multiple phase DIY energy consumption monitor using ESP32 and ESPHome

https://dl.espressif.com/dl/package_esp32_index.json

Connecting the ESP32 to the Smart Plug

Carefully connect the ESP32 to the smart plug using the jumper wires, ensuring that:

  • GND (or G) on the ESP32 connects to the GND (or -) pin on the smart plug's module.
  • 3V3 (or VCCI) on the ESP32 connects to the VCC or VCCI pin on the smart plug's module.
  • ardi (or D1) on the ESP32 connects to the RST pin on the smart plug's module.
  • Double-check your connections to avoid damages to either device.

Uploading the Firmware

Once connected, select your ESP32 board (Tools > Board > ESP32 Dev Module), and then select the correct serial port (Tools > Port). Now, you're ready to upload the custom firmware to control your smart plug.

📲 Get Live Sensor Readings from Your ESP32 via Telegram!
📲 Get Live Sensor Readings from Your ESP32 via Telegram!
How to Smarten a Plugboard With ESP32
How to Smarten a Plugboard With ESP32
How to send SMS using ESP32
How to send SMS using ESP32
DIY Home Energy Monitor with ESP32, CT Sensor (SCT-013), and EmonLib
DIY Home Energy Monitor with ESP32, CT Sensor (SCT-013), and EmonLib
🌐 ESP32 Static IP Address – Assign a Fixed IP in Arduino IDE!
🌐 ESP32 Static IP Address – Assign a Fixed IP in Arduino IDE!
ESP32 Pinout Guide: GPIO, Buttons & Ports Explained
ESP32 Pinout Guide: GPIO, Buttons & Ports Explained

You can use either the Arduino-based ESPurna project or the Home Assistant ESPHome integration. Both projects provide comprehensive guides and are well-documented, making it easy for beginners to get started.

Controlling and Automating Your ESP32 Smart Plug

After successfully uploading the firmware, you can now control your smart plug using various methods. Here are a few examples:

Web Interface

Both ESPurna and ESPHome projects come with a built-in web interface. You can access it through your browser by entering the IP address of your ESP32 and port 80 (e.g., http://192.168.1.10:80).

Plug It - Open Source Smart Plug
Plug It - Open Source Smart Plug
ESP32 Bluetooth + Manual Home automation - IotCircuitHub
ESP32 Bluetooth + Manual Home automation - IotCircuitHub
ESP8266 EcoPlug Wifi Smart Outlet MQTT Mod for Less Than $15
ESP8266 EcoPlug Wifi Smart Outlet MQTT Mod for Less Than $15
Smart Plug With Esp32/Esp8266 and Solid State Relays
Smart Plug With Esp32/Esp8266 and Solid State Relays
ESP8266 NodeMCU Blynk IoT DIY Smart Plug - IotCircuitHub
ESP8266 NodeMCU Blynk IoT DIY Smart Plug - IotCircuitHub
ESP32 Over-the-Air (OTA) Updates – Wireless Firmware Upload
ESP32 Over-the-Air (OTA) Updates – Wireless Firmware Upload
5 Must-Try ESP32 Projects for Beginners (2025 Edition)
5 Must-Try ESP32 Projects for Beginners (2025 Edition)
ESP32 Home Automation using ESP RainMaker
ESP32 Home Automation using ESP RainMaker
DIY Smart Energy Meter With ESP32 + Home Assistant
DIY Smart Energy Meter With ESP32 + Home Assistant
ESP32 Explained: The Powerful IoT Board
ESP32 Explained: The Powerful IoT Board
✋ ESP32 Capacitive Touch Pins – No Buttons Needed!
✋ ESP32 Capacitive Touch Pins – No Buttons Needed!
an electronic device with the words voice control with esp8366 and google assistant
an electronic device with the words voice control with esp8366 and google assistant

Smartphone Apps

If you've used the ESPurna project, you can install their official app (ESPurna Client) to control your smart plug. For ESPHome, integrate it with Home Assistant and use the latter's app to control your devices.

Automation Scenarios

One of the best features of a smart plug is the ability to automate. Set up schedules, or trigger the smart plug using motion sensors or other environmental sensors connected to your ESP32. Here are a few automation ideas:

  • Turn on a lamp at sunset and off at sunrise.
  • Power a coffee maker at a specified time in the morning.
  • Control christmas lights based on outdoor temperature or humidity changes.

Embrace the power of IoT and automate your daily tasks with this simple yet powerful DIY project. With a bit of tweaking and creative configurations, you can turn your home into a smart home with minimal costs and maximum control. Happy hacking!