SMART HOME AUTOMATION USING ESP32 WITH GOOGLE ASSISTANCE

by prajaktagumphalwar in Circuits > Electronics

845 Views, 0 Favorites, 0 Comments

SMART HOME AUTOMATION USING ESP32 WITH GOOGLE ASSISTANCE

cover img.jpeg

In today's world the home automation is essential part of modern living .This project is demonstrate how to build the smart home system using Esp32 microcontroller that allow you to control the electrical device such as light using voice command through google assistance. The system uses WIFI connectivity to link esp32 with online platform like Sinric pro . which act as bridge between the microcontroller and voice assistance. By using this setup the user can turn on or off from anywhere using their smartphone or simply by speaking commands.

Supplies

relay module.jpg
Breadboard.jpg
jumper wire.jpeg
resistor.jpeg
LED.jpeg
esp32  .jpeg
usb  .jpeg

HARDWARE COMPONENT :

  1. ESP32 Dev Module (ESP32 Devkit1).
  2. Relay module(2- channel /4 -channel as per requirement)
  3. LED (for testing )
  4. Resistor(220ohm for LED)
  5. Breadboard
  6. Jumper wire
  7. USB cable (for programming)
  8. power supply 5v

SOFTWARE COMPONENT:

  1. Arduino IDE (for coding and uploading program)
  2. sinric pro account(for connecting ESP32 with voice assistance)
  3. Google home app(for google assistance control)

Step 1

WhatsApp Image 2026-03-27 at 3.30.43 AM.jpeg
WhatsApp Image 2026-03-27 at 3.44.17 AM.jpeg

Hardware Setup

  1. Connection ESP32 to relay module
  2. GPIO 5 - IN1
  3. GPIO 18 - IN2
  4. GPIO 19 - IN3
  5. GPIO 21- IN4
  6. 5v - VCC
  7. GND - GND
  8. Vin -COM
  9. VIN-COM

A) LED connection to Relay module

  1. LED 1(+) - NC(Normally Closed)
  2. LED 2(+) - NC(Normally Closed)

B)LED connection to ESP32

  1. LED 1 (-) -GND
  2. LED 2(-) - GND


Step2

signup img.jpeg
Login img.jpeg
room img.jpeg
Device img.jpeg
WhatsApp Image 2026-03-27 at 1.20.52 AM.jpeg
WhatsApp Image 2026-03-27 at 1.21.27 AM.jpeg
WhatsApp Image 2026-03-27 at 1.26.07 AM.jpeg
WhatsApp Image 2026-03-27 at 1.33.16 AM.jpeg

CREAT SINRIC PRO ACCOUNT

  1. open the sinric pro website
  2. signup and login
  3. select room
  4. Create multiple device (Light1,light2) in the rooms
  5. copy the Device IDs, APP KEY ,APP SECRET

Step 3

Install Required Labraries

  1. Open Arduino IDE
  2. Go to Library manager
  3. Install sinric pro library

Step 4

Upload code to ESp32

  1. Paste the ESp32 Code in Ardino IDE
  2. Enter your Wifi Credetial and sinric pro detail.
  3. Select Borad: ESP32Dev model.
  4. select Correct COM
  5. Upload code

CODE

#include <WiFi.h>

#include "SinricPro.h"

#include "SinricProSwitch.h"


// WiFi Credentials

#define WIFI_SSID "sejal"

#define WIFI_PASS "sejal1234"


// Sinric Pro Credentials

#define APP_KEY "222abdd5-728b-414f-9a27-aeac03a325d2"

#define APP_SECRET "39bb1084-c7e9-40a0-aae5-d0df7b0a5096-4e593b2d-a8b7-4a00-8b0c-45b5fdd28f6f"


// Device IDs (create 2 devices in Sinric)

#define DEVICE_ID_1 "69be7723c2dbd7108b42ff5e"

#define DEVICE_ID_2 "69be7a0317b32c0941d9249c"


// LED Pins

#define LED1 5

#define LED2 18


// Control Function

bool onPowerState(const String &deviceId, bool &state) {


if (deviceId == DEVICE_ID_1) {

digitalWrite(LED1, state ? LOW : HIGH);

}

else if (deviceId == DEVICE_ID_2) {

digitalWrite(LED2, state ? LOW : HIGH);

}


return true;

}


void setup() {

Serial.begin(115200);


pinMode(LED1, OUTPUT);

pinMode(LED2, OUTPUT);


// OFF initially (for relay logic)

digitalWrite(LED1, HIGH);

digitalWrite(LED2, HIGH);


// Connect WiFi

WiFi.begin(WIFI_SSID, WIFI_PASS);

Serial.print("Connecting to WiFi");

while (WiFi.status() != WL_CONNECTED) {

delay(500);

Serial.print(".");

}

Serial.println("\nConnected!");


// Setup Sinric Pro

SinricProSwitch &sw1 = SinricPro[DEVICE_ID_1];

SinricProSwitch &sw2 = SinricPro[DEVICE_ID_2];


sw1.onPowerState(onPowerState);

sw2.onPowerState(onPowerState);


SinricPro.begin(APP_KEY, APP_SECRET);

}


void loop() {

SinricPro.handle();

}

Step5

WhatsApp Image 2026-03-27 at 2.58.04 AM.jpeg
WhatsApp Image 2026-03-27 at 2.58.46 AM.jpeg

Connect to wifi

  1. open serial monitor
  2. wait until it show "wifi connected

Link with Google Assistance

  1. Open Google Home App
  2. Tap add -work with Google
  3. Search sinric pro and login
  4. Your device will appear

Working

working:-

  1. When the command is received
  2. The ESP32 process it
  3. The corresponding GPIO pin changes the state
  4. Relay switches ON/OFF or LED glow accordigly

output:-

  1. You can control the home applinces from anywhere using voice command through google assistance ,making your home smart

Downloads

CONCLUSION

conclusion :-

In this project we succsefully built the smart home automation system using ESP32 microcontroller with Google Assistance. by using sinric pro platform . we are able to control the electrical device such as LED and and Relay through voice command over the internet

Application

APPLICATION:-

  1. Smart home automation : control Light ,fans using voice command.
  2. Remote device control : oprate device frome anywhere using internet connectivity.
  3. Energy saving :Turn off unused device easily to reduce electricity consumption.
  4. Office Automation: manage the office equipment like light and AC Effeciently