How to make a Home Automation system with an ESP32 board

How to make a Home Automation system with an ESP32 board

Hello and welcome back. In this project, we will learn how to make a home automation system with an ESP32 board. For that, I used Bluetooth classic technology. These ESP32 boards have inbuilt Bluetooth technology so we don’t need a separate Bluetooth module for this. So we can do this project easily and at a low cost. Also, I have used a 2-channel relay module for this project. But you can change it as you like. Eg:- 4 channels, 6 channels, 8 channels, or 16 channels.

Also, you must remember to select the correct relay modules for your equipment. That is, select the appropriate amperage value. You can see it on Relay. Also, if you want to add more relays, please study the circuit diagram and program carefully. (You should be careful working with AC voltage)

In this project, I used an ESP32 adapter board. I have designed it using JLCPCB. But don’t worry you can assemble this project on the breadboard. If you want, you can order it. Gerber file below.

ESP32 Adapter — Download

OK, let’s do this project step by step. The required components are given below.

Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.

Step 1

Firstly, identify these components.

Step 2

Secondly, let’s order the ESP32 adapter PCB. For that, follow the steps below. If you don’t need PCB, please skip this step.

  • Now, go to the JLCPCB website and login into your account. Then, upload the Gerber file to the website. It’s below.
  • Gerber file — Download

  • Next, choose your favorite color and other settings as you like. Then, add your PCB to the cart and enter your shipping details and shipping method. Finally, pay for your order. You can choose different payment methods for that. It depends on your requirement.

Now, you can get quality PCBs within 1 or 2 weeks. It depends on your shipping method.

Step 3

Thirdly, let’s solder the components one by one. For that, use the pictures below. If you are not using PCB, please place the ESP32 board on the breadboard.

Step 4

Next, connect the ESP32 board to the adapter. And then, connect it to the computer and upload the program for that. It’s as follows.

  • Full details of this project — Download

//Include the library file
#include "BluetoothSerial.h"

//#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
//#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
//#endif

BluetoothSerial SerialBT;

#define relay1 2
#define relay2 4

void setup() {
  Serial.begin(115200);
  SerialBT.begin("SriTu Hobby"); //Bluetooth device name
  Serial.println("The device started, now you can pair it with bluetooth!");

  pinMode(relay1, OUTPUT);
  pinMode(relay2, OUTPUT);

  digitalWrite(relay1, HIGH);
  digitalWrite(relay2, HIGH);

}

void loop() {
  if (SerialBT.available()) {
    char value = SerialBT.read();
    String newValue = String(value);
    if (newValue == "A") {
      digitalWrite(relay1, LOW);
      Serial.println("on");
    } else if (newValue == "a") {
      digitalWrite(relay1, HIGH);
      Serial.println("off");
    } else if (newValue == "B") {
      digitalWrite(relay2, LOW);
    } else if (newValue == "b") {
      digitalWrite(relay2, HIGH);
    }
  }
}

Step 5

Now, select the board and port. Then, click the upload button and hold the boot button for 1 or 2 seconds when “Connecting” is displayed on the shell.

Step 6

Next, remove the USB cable and connect the relay module to the ESP23 board. For that, use the circuit diagram below.

How to make a Home Automation system with an ESP32 board

Now, power up this board. For that, you can use a USB cable, power terminal, or VIN/GND pins.

Step 7

And then, download and install the SriTu Hobby app from the play store. Next, click the control button and select Bluetooth Home Automation. Now you can choose your remote type.

Step 8

Now, click the gear wheel icon and find your device. In this case, you need to enable location and location permission. Finally, select your device.

Now, you can control the relay module using this remote. Ok, the full video guide is below. So, see you in the next project or tutorial.

Similar Posts

Leave a Reply

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