Smart Room Heater Plug






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.
Supplies
These were the materials used in this project:
- XIAO ESP32 C3
- WIFI ANTENNA
- Custom PCB
- AO3400 N channel mosfet
- Relay 5V
- Isolated Power Module
- 16A AC PLUG
- 16A AC SOCKET
- 3D printed parts
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.instructables.com/XIAO-Home-Automation-Board/
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.
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.
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.
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.
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.
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.
Plug Section Complete Assembly





- The next step is to connect the AC connection wires from the plug to the relay circuit. We begin by attaching two wires to the Live terminal of the plug. Two additional wires are added to neutral.
- We're using 2.5 sq/mm wire here, which is rated for loads of 3500 to 5000 watts.
- The first live wire goes to the CON2 screw terminal's live port, and one neutral wire goes to the same CON2 screw terminal's neutral port. This will power the AC isolated module.
- We then connected the second neutral terminal to the second CON2 screw terminal port 1, which connects to the relay NO terminal.
- We then connected another wire to the second CON2 screw connection via the relay NC terminal.
- The circuit is now put into position and secured with four m2 screws.
Socket Section Assembly




- We now begin the socket assembly process, which involves putting the AC socket into the 3D printed body and securing it in place with two M2 screws that tighten the AC socket to the 3D printed body.
- Next, we installed the WiFi antenna into the mounting hole in the socket body.
Final Assembly






- We now connect the plug and socket portions by inserting the live and neutral wires from the plug section into the AC socket.
- We next connect the WiFi antenna connector to an XIAO ESP32 antenna connector.
- Next, we inserted the socket into the plug and tightened them with four m2 screws.
- Finally, we attached the antenna to the antenna connector; this completes the manufacturing process and our WiFi plug is now complete.
RESULT







To test the smart WiFi plug, we plugged it into a 16A socket and attached our room heater to the onboard socket.
After turning on the device, the XIAO ESP32 connects to WIFI and allows us to access the device's webpage.
Using the WEBPAGE, we can turn on or off the relay that controls the room heater.
For the time being, the webpage simply has an ON OFF button, but we can modify the code slightly to include a timer or a smart function such as scheduled ON OFF.
Also, the size of this plug is huge, which we need to address in the next version. My goal is to create an opensource Smartplug that is both portable and opensource, allowing anyone to make their own and customize as they see fit.
For the time being, our project is working and has achieved our goal of adding IoT capabilities to our dumb room heater; we can now operate the heater using our tablet without ever moving. This means we can stay in our cozy blanket and turn on or off the heater without moving, which is terrific.
Leave a comment if you need any help regarding this project. This is it for today, folks.
Thanks to Seeed Studio Fusion for supporting this project.
You guys can check them out if you need great PCB and stencil service for less cost and great quality.
And I'll be back with a new project pretty soon!