ESP32 Projects

ESP32 Blynk Home Automation with MaTouch 1.28” Toolset Timer Switch Relay

Last Updated on September 29, 2025 by Engr. Shahzada Fahad

Description:

ESP32 Blynk Home Automation with MaTouch 1.28” Toolset Timer Switch Relay- Imagine it’s a freezing winter night. You are already in bed, warm and comfortable, when you suddenly remember; the heater is still running, or the TV is still ON.

Now, you have two choices:

  • Either get out of bed, walk all the way to the switchboard, and turn it OFF; or
  • Simply grab your phone, tap a button, and it’s done!

That’s exactly what this project makes possible.

ESP32 Blynk Home Automation using MaTouch toolset with relay switch

In my previous article, we explored how this amazing MaTouch 1.28” Toolset Timer Switch Relay from Makerfabs can completely replace a conventional switchboard.

We controlled relays using the on-screen UI designed in Squareline Studio, and we also used the encoder and physical buttons for quick access.

We even scheduled timers for automatic ON/OFF control of appliances.

That means you don’t always have to remember to press a button; your devices can turn ON or OFF at the exact time you want.

For example, you can set the heater to turn ON in the morning before you wake up, or have the lights turn OFF automatically at night.

But today, we are taking it to the next level.

This is Version 2 of the project.

And now, the same relays that we previously controlled through the UI; can also be controlled through the Blynk IoT application; from anywhere in the world!

That means you can control your home appliances directly from your smartphone, no matter where you are.




Think about it:

With this setup, you don’t need to worry about forgotten appliances.

Even if you leave home in a hurry and the Heater or TV or water pump is still ON, you can check the status on your phone and switch it OFF from anywhere.

Here is the part I really love;

The UI and the Blynk application are perfectly synchronized.

For example:

If I turn ON a load from the display UI “User Interface”, the same switch will also turn ON in the Blynk app.

Similarly, if I turn ON/OFF any load from my phone, the switch will also update on the UI.

This way, I always know which loads are ON and which ones are OFF, no matter where they were controlled from.

And here’s another thing I have carefully taken care of;

What if WiFi goes down?

Normally, if we had used Blynk.begin(), the controller would just keep trying to connect to Blynk, and the UI would stop responding. That’s not good for home automation.

So instead, I used WiFi + Blynk, which ensures that:

Testing the offline functionality of an ESP32-S3 device in an ESP32 Blynk Home Automation setup.

Even if WiFi is unavailable, the UI continues to work smoothly. Right now, on the display, I have turned ON all three switches, but in the Blynk application, the switches don’t update because the controller is disconnected from WiFi. The UI will continue to work, but it won’t send the switch status to the Blynk app.



And as soon as WiFi comes back, the controller reconnects to Blynk automatically. Normally, it takes a few seconds to update the switch status in the Blynk application.

The ESP32-S3 display and Blynk app are synced in an ESP32 Blynk Home Automation project.

This makes the system reliable both online and offline.

Date and time widget designed in SquareLine Studio for an ESP32 Blynk Home Automation UI.

On this second screen, I am displaying the date and time, and I am using the same background image from the previous project.

Digital watchface UI design for ESP32 Blynk Home Automation project

This background adds a nice touch to the interface and makes it look more polished.

Of course, you can always customize it with your own designs, or even add animations if you want to make the UI more dynamic.



SquareLine Studio:

If you have read my previous articles on Squareline Studio and LVGL, then by now you already know how to start a new project or import an existing one in Squareline Studio.

Date and time UI design in Squareline Studio for ESP32 Blynk Home Automation

Now, on Screen2, we are displaying the Date and Time. For this, I have simply used two labels named lbldate and lbltime. I won’t go into too much detail here, because I have already explained this in my previous article.

Adding an event to call a function in SquareLine Studio for ESP32 Blynk Home Automation.

On Screen1, I have added three switches, and I have assigned events to each of them. For example, when I turn the TV switch ON or OFF, the tvfun function is called. In the same way, I have defined functions for the other two switches as well.

Now, let me show you what I have set up on the Blynk side.



Blynk side set up:

I have already written a getting started article on ESP32 and Blynk. So, if you are using Blynk for the very first time, I recommend reading that article first or you can also watch the video tutorial on my YouTube channel Electronic Clinic.

Diagram showing the connection between an ESP32-S3 and the ESP32 Blynk Home Automation cloud.

Anyway, as you can see, I have created a device named “My Home”, and it’s already online. Let’s go ahead and open it.

An overview of the completed ESP32-S3 and ESP32 Blynk Home Automation project setup.

For this project, I am only using three switches, and I have kept their names the same as in the UI, so there is no confusion when controlling the loads.

Now, if you go to Developer Tools, you will find the Firmware Configuration.

The firmware configuration settings page in the Blynk web console for ESP32 Blynk Home Automation.

From here, you can simply copy that configuration and paste it at the top of your code.

Locating the Template ID and Auth Token for an ESP32 Blynk Home Automation project.




Next, if I open the Datastreams, you can see I have added only three variables: relay1, relay2, and relay3.

Configuring Blynk datastreams for an ESP32-S3 in an ESP32 Blynk Home Automation project.

Each one is linked to a virtual pin; V1, V2, and V3; and their data type is set as integer.

The reason we use virtual pins is that;

They make communication between the app and the ESP32 much easier and more flexible.

Instead of being limited to fixed hardware pins, virtual pins let us map any button or widget in Blynk to any function in our code.

This way, even if you change your hardware wiring later, you don’t need to redesign your app; you just adjust the code. It keeps things simple and very organized.

And that’s all we need to set up on the Blynk side.

Blynk IoT on Mobile:

When you open the Blynk app on your phone, you will see the device that you created earlier. In my case, it’s showing up as “My Home.”

The Blynk IoT app on a smartphone showing the "My Home" screen for ESP32 Blynk Home Automation.

If I open this device, you can see I have already added three switches, and I have assigned them to the same datastreams we just created.

The Blynk IoT application interface designed for an ESP32-S3 ESP32 Blynk Home Automation project.

You can also see that the device is online and ready to use. 



ESP32S3 Programming:

Download Complete Project Folder:

And for those who want the ready-to-use project folder, with all the UI designs and SquareLine Studio files included, it’s available on my Patreon; along with many other exclusive resources.



Practical demonstration:

Now, let me give you a detailed demo of this project, and I won’t skip anything.

An ESP32-S3 project using SquareLine Studio and LVGL for ESP32 Blynk Home Automation.

I haven’t connected real appliances to the board, because the onboard LEDs are more than enough to show what’s happening. Plus, you will also hear the clicking sound of the relays “if you watch video tutorial ;)”, so it’s very clear when they switch ON or OFF.

For the practical demonstration watch the video tutorial.

Right now, both my board and my mobile phone are connected to WiFi.

So, let’s first control the relays using the on-screen switches.

The ESP32-S3 device UI and the Blynk app are shown in sync for ESP32 Blynk Home Automation.

As you can see, it’s very fast and responsive. And you might have noticed; whenever I toggle a switch on the display, the same switch updates instantly in the Blynk app as well.

Now, let’s try the other way around; controlling the relays directly from the Blynk app.

The relay status widget showing "ON" in the Blynk app for an ESP32 Blynk Home Automation project.

Again, you can see it’s super fast and responsive. Whenever I toggle a button here on the phone, the same button updates on the display UI in real-time.

But here’s the exciting part; what happens if I disconnect the WiFi?

Now the controller is no longer connected to WiFi…

And look; it’s still working perfectly!

The Makerfabs toolset with timer, switch, and relay for an ESP32 Blynk Home Automation project.

Do you know why?

Because; we didn’t use Blynk.begin() in the code; because it blocks the program until a connection is made.

By handling WiFi and Blynk connections manually, the ESP32 remains responsive even if the internet drops or the Blynk server is unavailable.

Testing the offline functionality of an ESP32-S3 device in an ESP32 Blynk Home Automation setup.

Anyway, right now you can see that two switches are ON and one switch is OFF.



I am going to reconnect the controller to WiFi, and let’s see whether the Blynk app updates the status of these loads or not.

The ESP32-S3 screen showing a "Connected to Wi-Fi" status for ESP32 Blynk Home Automation.

This might take a few seconds…

The status of connected loads is updated on the Blynk app in an ESP32 Blynk Home Automation project.

And there you go; amazing! The load status has automatically updated in the Blynk app.

Now I can also turn these same loads OFF directly from the Blynk app, and the changes will instantly show up on the display as well.

So with this system, you can control your appliances locally using the display or remotely from anywhere in the world using the Blynk app.

And in Version 3, we will take it even further; we will build a custom Android application with feedback acknowledgment, so you will always know the exact status of your appliances.

So, that’s all for now.




Watch Video Tutorial:

 


Discover more from Electronic Clinic

Subscribe to get the latest posts sent to your email.

Engr. Shahzada Fahad

Engr. Shahzada Fahad is an Electrical Engineer with over 15 years of hands-on experience in electronics design, programming, and PCB development. He specializes in microcontrollers (Arduino, ESP32, STM32, Raspberry Pi), robotics, and IoT systems. He is the founder and lead author at Electronic Clinic, dedicated to sharing practical knowledge.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Discover more from Electronic Clinic

Subscribe now to keep reading and get access to the full archive.

Continue reading

Electronic Clinic
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.