top of page
Search
Writer's pictureThingsInNet

A Home Automation System Using ThingsInNet ESP32 Devkit for Actuating IoT Unit and Blynk Platform

Updated: Apr 27

You can save energy by controlling your appliances remotely, even when you're not at home. In this project, we are going to control four home appliances using a web dashboard and a mobile app. We use the ThingsInNet ESP32 Dev Kit for Actuating IoT unit, which can handle these appliances around the clock. Additionally, we'll make use of the Blynk.Cloud platform, which lets you connect your devices to the Internet and create mobile and web dashboards to control your appliances from anywhere in the world. The dashboards provided by Blynk make it easy to monitor and control your appliances, ensuring a user-friendly experience. The project can be expanded to control more devices or add additional features as required, offering scalability and adaptability to changing needs. The flexibility offered by the ThingsInNet and Blynk platforms provides opportunities for seamless integration of a wide range of sensors, actuators, and other devices, rendering them highly adaptable for diverse automation and monitoring purposes.



A Mobile app control four electric appliances over the Internet



Prerequisites:



What we will do:

  • Create your first device in Blynk.Cloud

  • Prepare firmware code and upload it to your device

  • Build a mobile app to control four devices


Create your first device in Blynk.Cloud


Step1: Go to blynk.cloud website and login.


After logging in, you'll encounter a list of your devices that are currently connected to the cloud.



Step2: On the left side, select the Templates button, then click the New Template button on the right, which will open the Create New Template dialog.


Step3: Please complete the required details and then click Done. Finally, click the Save button located on the right.



Step4: In the Next Window, let’s add five data streams. Here we are going to specify a set of virtual pins.



Datastreams: DataStream is a way to structure data that regularly flows in and out from device. Use it for sensor data, any telemetry, or actuators.


Step5: Click New Datastream button and then select Virtual Pin.



Step6: In this project we are going to control four appliances connected to the four channel ThingsInNet Actuator kit. So, Name Switch1 for the first Datastream as picture below. Then select PIN V1 and click Create button.



After creating the Datastream you will see it as follows.



Step7: Create another four Virtual PINs namely Switch2, Switch3, Switch4 and Switch5 by yourself. Make sure to add virtual pins V2, V3, V4 and V5 respectively. Then click Save.



Step8: Click on Web Dashboard tab to configure the web Interface with five switches. This interface can be used to control your appliances over the Internet.



Step9: Drag and drop a Switch from the Widget Box and click Switch Settings. Then put the Title and Set the Datastream as shown below. Then click Save button at the bottom.



Step10: Do the same for the other four switches and make sure to select the right Datastream for each switch as shown below and click Save button.



Step 11: Now you are ready to create a new IoT device in the Blynk using the template above.


Goto Home tab and click Add first device then name it as Home1. Click the Create button.



A new device will be created and Template ID, Template Name, Device Name, and AuthToken will be shown on the right. This information should be declared at the very top of the firmware code which is going to be explained next. This information is confidential and must be kept securely.



You can see the new device is being added and in the next few steps you will work on the Arduino program running on the device.




Prepare firmware code and upload it to your device


Step1: Download the sample code provided here. Unzip the project folder and open it using Arduino IDE.


The ThingsInNet team has already tested the code with Arduino IDE version 2.1.


Step2: You may install the required libraries. Goto Sketch → Include Library → Manage Libraries then search


  • Mainly you need to add Blynk library

  • Install Adafruit SSD1306 by Adafruit library

  • Install Adafruit GFX Library by Adafruit


Step3: Connect ThingsInNet Dev Kit for Actuating board to the computer using USB Type-C cable. Select the right Comport and board (ESP32 Dev Module).


Step4: Update Blynk Template ID, Template Name, Device Name, and AuthToken in the code segment below.


/*Fill-in your Template ID Device Name and Auth Token */

#define BLYNK_TEMPLATE_ID "XXXXXXXXXXXXXXX"

#define BLYNK_TEMPLATE_NAME "Home Automation"

#define BLYNK_DEVICE_NAME "Home1"

#define BLYNK_AUTH_TOKEN "XXXXXXXXXXXXXXX"


Update your Wi-Fi credentials in the code segment below.

// Your WiFi credentials.

char ssid[] = "XXXXXXXXXXXXXXX";

char pass[] = "XXXXXXXXXXXXXXX";


Step5: We're nearly finished! Compile the code and upload it to the board. If you encounter any errors in the code, try to resolve them independently. Remember, you can always seek support from the ThingsInNet team when needed.


Mobile dashboard

In the earlier part of this blog post, you set up a web dashboard to control your devices online. However, the most popular method for device control is through a mobile app. In this section, we'll guide you through configuring the Blynk mobile app for online device control.

Exciting, right? To get started, download the Blynk mobile app on your phone. It's available for both iOS and Android. Follow the instructions provided in the images below.





Ensure a safe connection of your devices to the relay modules, especially when dealing with high voltages.



A sample device connection is shown in the picture above.


If you want to order the enclosures for the ThingsInNet products, please e-mail support@thingsinnet.com as they are not available to sale in our online store.


Each channel (relay) on the Dev Kit can drive 600W device and if you want to drive high power devices you may do it through a contactor.






99 views0 comments

Comments


bottom of page