Close
0%
0%

Smart Room Heater Plug

A WIFI PLUG Powered by XIAO ESP32 C3 DEV board and a CUSTOM AC RELAY DRIVER BOARD.

Public Chat
Similar projects worth following
0 followers
Greeting everyone and welcome back. Here's something warm.

We built a WiFi Smart Plug to remotely control our room heater.

The concept here was that it was inconvenient to get up and control the room heater with a switch, so why not add an IOT feature to it and turn the entire setup into a smart room heater?

The idea was great but developing an IOT room heater that can only be used in the winter would be a waste, so we created the Smart Plug, which can be used with the room heater in the winter and with an air conditioner in the summer.

The Smart Plug consists of a single XIAO ESP32 C3 microcontroller linked to a custom relay board, which also houses an isolated 240V to 5V power source to power the XIAO and relay configuration.

Using a Web app, customers may effortlessly turn the gadget on or off from their tablets, smartphones, or PCs.

This article covers the entire build process for this project, so let us get started.

Design of the Plug

We begin the design process by using the previously developed XIAO RELAY driver board, as well as a socket and plug.

https://www.hackster.io/Arnov_Sharma_makes/xiao-home-automation-board-4c0256#toc-seeed-studio-fusion-service-3

Before proceeding with the model, we needed to reduce the size of the plug and socket as much as possible; thus, we clipped away any extra material while retaining the essential components of both socket and plug. Both the plug and socket housing are built of thermal-grade PC, which can withstand the heat generated by the plug when plugging in a higher power load; this heat might easily melt the PLA if we made our own socket from scratch; thus, we had to incorporate PC material for the socket and plug into our model as well.

The model for this project is separated into two components or sections: the socket section and the plug section.

We are in India, and we use BS 546 Plug socket type, which includes two-pole and earthing-pin plugs, socket outlets, and socket-outlet adaptors for AC (50-60 Hz) circuits up to 250 V." It describes four plug sizes rated at 2 A, 5 A (Type D), 15 A (Type M), and 30 A.

The plug section is the back part where we have mounted the plug and circuit. Over the Plug section, we have the socket section, which includes the socket part and the WiFi antenna.

Both sections are held together with M2 screws from both sides.

To achieve a two-color theme, we printed the socket part in transparent PLA and the plug section in gray PLA using a 0.4mm nozzle and 0.2mm layer height.

PCB Design: XIAO RELAY Board

For this project, we are repurposing one of our past projects, the XIAO RELAY BOARD. It's a simple XIAO breakout board with a relay attached to a Mosfet as a switch controlled by the XIAO microcontroller.

We're utilizing an N-channel mosfet here, the AO3400 n-channel mosfet, with an AC-isolated Powers supply module installed on the board to deliver 5V from 240V AC.

https://www.hackster.io/Arnov_Sharma_makes/xiao-home-automation-board-4c0256

Seeed Studio Fusion Service

After finalizing the PCB and generating its Gerber data, we sent it to SEEED STUDIO FUSION for samples.

PCB was ordered in the blue solder mask with white silkscreen.

PCBs were received in a week, and their quality was super good considering the rate, which was also pretty low.

Seeed Fusion PCB Service offers one-stop prototyping for PCB manufacture and PCB assembly, and as a result, they produce superior-quality PCBs and fast turnkey PCBAs within 7 working days.

Seeed Studio Fusion PCB Assembly Service takes care of the entire fabrication process, from Seeed Studio Fusion Agile manufacturing and hardware customization to parts sourcing, assembly, and testing services, so you can be sure that they are getting a quality product.

After gauging market interest and verifying a working prototype, Seeed Propagate Service can help you bring the product to market with professional guidance and a strong network of connections.

WIFI PLUG v6.step

step - 1.36 MB - 02/27/2025 at 18:38

Download

SCH.pdf

Adobe Portable Document Format - 156.45 kB - 02/27/2025 at 18:38

Preview

BACK.stl

Standard Tesselated Geometry - 97.15 kB - 02/27/2025 at 18:38

Download

FRONT.stl

Standard Tesselated Geometry - 57.50 kB - 02/27/2025 at 18:38

Download

  • 1
    PCB Assembly Process
    • Using a solderpaste dispencing needle, we apply solderpaste—in this case, 63/37 Sn/Pb solderpaste—on each SMD component PAD to begin the PICO Driver assembly process.
    • Next, we use an ESD Tweeser to select and position each SMD component on the PCB.
    • Following component placement, the circuit is raised and set on the reflow hotplate, which raises the PCB's temperature from below to the melting point of solder paste. Solder paste melts and all SMD components are secure in place when the PCB hits a temperature of 190 °C.
    • Next, we insert all of the through-hole components, which comprise the CON7 female header pins for the XIAO microcontroller, relay, CON2 screw terminals, and isolated power module. We then flip the board over and solder all of the pads on the through-hole components.
    • Finally, we install the XIAO ESP32 C3 microcontroller over the two CON7 connectors.
  • 2
    Main Sketch

    Before beginning the assembly process, we uploaded the main sketch to the XIAO ESP32, as we won't be able to update code later because the enclosure doesn't have an opening for accessing the XIAO's USB connector.

    Below is the code we have used and its a simple one.

    #include <WiFi.h>
    #include <ESPAsyncWebServer.h>
    const char* ssid = "UR SSID";
    const char* password = "UR PASS";
    #define RELAY_PIN D1
    #define LED_PIN D0
    AsyncWebServer server(80);
    bool relayState = false;
    void setup() {
    Serial.begin(115200);
    WiFi.begin(ssid, password);
    while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
    }
    Serial.println("Connected to WiFi");
    Serial.print("IP Address: ");
    Serial.println(WiFi.localIP());  // Print IP address
    // Configure pins
    pinMode(RELAY_PIN, OUTPUT);
    pinMode(LED_PIN, OUTPUT);
    digitalWrite(RELAY_PIN, LOW);  // Initially off
    digitalWrite(LED_PIN, LOW);    // Initially off
    // Configure routes
    server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send(200, "text/html", "<!DOCTYPE html><html><head><meta name='viewport' content='width=device-width, initial-scale=1'><style>body {background: linear-gradient(135deg, #ff7e5f, #feb47b); color: white; font-family: Arial, sans-serif; text-align: center; padding: 50px;} .button {background-color: #f4511e; border: none; color: white; padding: 40px 80px; text-align: center; font-size: 24px; margin: 20px; opacity: 0.8; transition: 0.3s; cursor: pointer; border-radius: 12px;} .button:hover {opacity: 1;} h2 {font-size: 36px; margin-bottom: 20px;}</style></head><body><h2>Smart WiFi Plug Web Page</h2><button class='button' onclick='fetch(\"/toggle\").then(response => response.text()).then(text => console.log(text));'>Toggle Relay</button></body></html>");
    });
    server.on("/toggle", HTTP_GET, [](AsyncWebServerRequest *request){
    Serial.println("Toggle request received");      // Debug statement
    relayState = !relayState;                       // Toggle relay state
    digitalWrite(RELAY_PIN, relayState);            // Set relay pin
    Serial.print("Relay state: ");
    Serial.println(relayState);                     // Debug statement
    digitalWrite(LED_PIN, HIGH);                    // Turn on LED
    delay(1000);                                    // Delay for visibility
    digitalWrite(LED_PIN, LOW);                     // Turn off LED
    request->send(200, "text/plain", "Toggled!");
    });
    server.begin();
    }
    void loop() {
    // Empty loop
    }

    This code creates a smart WiFi plug with a web interface that allows you to toggle a relay (connected to a device) and an LED for visual feedback.

    You might have noticed that the loop function is empty; it is because the web server handles everything asynchronously.

  • 3
    Plug Section Assembly

    We begin the plug section assembly by inserting the Plug PC body into the cavity made inside the Plug Section component; the Plug PC body fits perfectly in position, and we then fasten them together using the socket's three AC pins.

View all 7 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates