How to Make an ESP32 Smart Home Automation System Using KME Smart
by Pro Maker_101 in Circuits > Electronics
25 Views, 1 Favorites, 0 Comments
How to Make an ESP32 Smart Home Automation System Using KME Smart
In this project, I will show you how to build an ESP32-based smart home automation system using KME Smart Control relays. This system allows you to control home appliances using manual switches, a mobile app, and an IR remote from anywhere.
I used KME Smart Control for reliable relay control, along with an IR hub to control a BLDC fan with speed control.
The project also includes a DHT11 temperature and humidity sensor for environmental monitoring.This DIY project is simple, safe, and beginner-friendly, making it perfect for anyone interested in smart home automation.
Supplies
- ESP32 Development Board
- Custom PCB (From NEXTPCB)
- HF46F 5V Relays
- ULN2003 Driver IC
- Optocouplers (PC817) – 4 Nos
- DHT11 Temperature & Humidity Sensor
- TSOP1738 IR Receiver
- IR Transmitter LED
- Hi-Link 5V AC–DC Power Supply Module
- Resistors:
- 330Ω – 4 Nos
- 4.7kΩ
- 1kΩ Resistor Array
- Diodes (1N4007) – 4 Nos
- Manual Switches
- Terminal Blocks
- Connecting Wires
Order Custom PCB From NextPCB
After completing the PCB design, the Gerber files were sent to NextPCB, and an order was placed for a White solder mask with Black silkscreen.
Click the NextPCB link below & Get instant Quote NOW:https://www.nextpcb.com/?code=Promaker101
The PCBs were delivered within a week, and the quality was excellent — clean silkscreen, precise solder masks, and accurate dimensions.
In addition, I want to introduce HQDFM, NextPCB’s free Design for Manufacturing (DFM) software, which has been extremely helpful in my projects. HQDFM allows PCB designers to visualize and verify their designs before production, saving time and avoiding potential errors.
💡 Tips
- HQDFM offers online Gerber viewing and basic DFM reports, which are great for quick checks.
- For full DFM analysis and PCBA insights, download the desktop version.
- Using HQDFM ensures your designs are optimized for manufacturing and reduces production errors.
With over 15 years of PCB industry experience, NextPCB and HQDFM are reliable tools for budget-friendly, high-quality PCB production — a great way to bring your ideas to life efficiently!
📎 Circuit diagram and Gerber files are attached for reference.
Place All Components on the PCB
Place all components on the custom PCB according to the circuit diagram.
Start with resistors and diodes, followed by ICs, optocouplers, and ULN2003.
Then place the HF46F 5V relays, ESP32, IR receiver, IR transmitter, and terminal blocks.
Before soldering, always check the orientation of each component.
🔧 Use of Each Component
- ESP32 – Main controller with WiFi, handles logic, relays, and IR control
- HF46F 5V Relays – Switch AC/DC loads safely
- ULN2003 IC – Drives relay coils and protects ESP32 pins
- Optocouplers (PC817) – Provide electrical isolation for safety
- TSOP1738 IR Receiver – Receives IR remote signals
- IR Transmitter LED – Sends IR commands to control BLDC fan
- Hi-Link 5V Power Module – Converts AC mains to stable 5V DC
- Diodes (1N4007) – Flyback protection for relay coils
- 330Ω Resistors – Current limiting for optocoupler LEDs
- 4.7kΩ Resistor – Sensor/data line stabilization
- 1kΩ Resistor Array – Pull-up and signal conditioning
- Terminal Blocks – Safe and easy wiring connections
Solder All Components
Once all components are placed correctly on the PCB, it’s time to solder them.
- Trim the excess legs of components after inserting them into the PCB.
- Solder each pin carefully, making sure the joints are shiny and solid.
- After soldering, use a brush and isopropyl alcohol (IPA) to clean the PCB. This removes flux residue and keeps your board neat.
- Inspect all solder joints to ensure there are no short circuits or cold joints
💡 Tips
- Solder small components first, then ICs, relays, and larger components.
- Keep high-voltage (relay) and low-voltage (ESP32) areas separate.
- Use enough flux if needed for better soldering.
- Work in a well-ventilated area when using IPA.
Connect the DHT11 Sensor
For accurate temperature and humidity readings, especially if the sensor is placed outside the main PCB:
- Connect the DHT11 sensor wires to the PCB terminals according to the circuit diagram.
- Make sure the wires are long enough to place the sensor in the desired location.
- For the 3 DHT11 pins, ensure no short circuits.
- Use sleeving / heat shrink tubing on each pin to prevent accidental contact.
- Double-check the data, VCC, and GND connections before powering up.
Make Enclosure for the PCB
After assembling and testing the PCB, it’s time to make a protective enclosure:
- Measure the PCB size accurately, including height with components.
- I used 3mm acrylic sheets laser-cut from a shop to make a custom enclosure.
- You can also use a 3D printer to make the case.
- Make sure to cut holes for terminals, IR receiver, and IR transmitter so wires and signals can pass through easily.
- Assemble the enclosure, keeping the PCB secure inside without pressing on the components.
Program the ESP32 Using KME Smart
Now that your PCB and enclosure are ready, it’s time to program the ESP32 and configure the dashboard:
- Connect the ESP32 to your PC using a USB cable.
- Open the KME Smart and download the KME Config Tool for Windows
- Launch the KME Config Tool.
- Select the correct COM port for your ESP32.
- Configure the firmware update and click Upload.
- Wait until it reaches 100% completion.
- After firmware update, you can add the layout in the app:
- Set up relays, IR hub, DHT11 sensor (temperature & humidity), and other devices.
- Configure input and output pins according to your circuit connections.
- Once all settings are done, click the Upload button in the tool to finalize the setup.
Final Setup and Test With KME Smart App
Now that the ESP32 is mounted on the PCB using the female headers, we can do the final testing and setup:
- Connect the power supply:
- Connect the L (live) and N (neutral) wires to the PCB terminal block.
- Make sure the connections are secure and insulated.
- Install the KME Smart App:
- Download from Google Play Store(Android) or Apple App Store.(IOS)
- Sign up or log in.
- Add your device:
- Click the “+” button in the app.
- Select Add Device.
- Enter your WiFi SSID and password.
- Click Next.
- Connect ESP32 via Smart Connect:
- Press the BOOT button on ESP32 for 2 seconds.
- The app will auto-connect the ESP32.
- Your layout (relays, IR hub, DHT11 sensor, etc.) will appear automatically from the configuration.
- Add BLDC fan remote control:
- On the IR Hub, add 6 switches in the KME app.
- Configure Switch 1:
- Press Speed 1 on the fan remote.
- ESP32 receives and stores this signal.
- Repeat for other speeds / switches if needed.
- Control via app:
- Now, when you click a switch in the KME app, the signal is sent via IR transmitter to the fan.
You can control the fan from anywhere — no physical remote is needed.
Connect Manual Switches and Control Anywhere
Now that your ESP32 PCB and app are ready, we can connect manual switches and load terminals for full control:
- Connect Manual Switches:
- Connect one side of each manual switch to the input pins on your PCB.
- Connect the other side to the corresponding load terminals (lights, fan, etc.).
- Control Options:
- You can now control devices:
- Manually using switches
- Via KME Smart App from anywhere
- Using IR Hub for remote-controlled devices, like your BLDC fan
- How the IR Hub & Fan Works:
- The IR Hub receives input from the app or manual setup.
- When you click a switch in the app, the ESP32 sends the stored IR signal via the IR transmitter.
- The fan receives this signal and changes speed or turns on/off as configured.
- All signals are stored in ESP32 memory during setup, so no remote is needed anymore.
Watch and Enjoy
Your ESP32 smart home automation system is now fully set up and working!
- You can control devices manually, via the KME Smart App, or through the IR hub for remote-controlled fans.
- Check all relays, sensors, and switches to ensure everything works correctly.
- Now your home is smart, and you can control devices from anywhere.
🎥 Watch the detailed video demonstration here