Voice-controlled home automation is no longer a luxury reserved for those who can afford premium smart home ecosystems. With an ESP32 microcontroller and Google Assistant, you can build a voice-controlled smart home system that lets you say “Hey Google, turn on the bedroom light” — and it actually works, reliably, for a fraction of the cost of commercial solutions available in India.
In this guide, we cover three different methods to connect your ESP32 to Google Assistant, from the simplest (Sinric Pro) to the most powerful (Home Assistant with Nabu Casa).
How Voice-Controlled Home Automation Works
When you say “Hey Google, turn on the fan”, here is the chain of events:
- Google processes your voice: Your phone or Nest speaker sends the audio to Google’s servers, which interpret the command
- Google contacts the smart home service: Google Home sends an ON command to the linked smart home platform (Sinric Pro, Home Assistant, etc.)
- The platform relays to your ESP32: The platform sends the command over the internet to your ESP32 via MQTT or WebSocket
- ESP32 activates the relay: The ESP32 receives the command and switches the relay ON, turning on the fan
The entire process takes about 1–2 seconds from voice command to appliance response.
Components You Need
Additional requirements:
- A Google Home speaker or Android phone with Google Assistant
- A stable WiFi connection at home
- A Google account
- Arduino IDE installed on your computer
- Jumper wires for connections
Method 1: Sinric Pro (Easiest)
Sinric Pro is a free cloud service designed specifically for connecting DIY IoT devices to Google Home and Alexa. It is the simplest way to add voice control to your ESP32 projects.
Step 1: Create a Sinric Pro Account
- Go to sinric.pro and create a free account
- Add a new device — select “Switch” as the device type
- Note down your App Key, App Secret, and Device ID
Step 2: Install Libraries in Arduino IDE
Install these libraries via the Arduino Library Manager:
- SinricPro (by Boris Jaeger)
- ArduinoJson (by Benoit Blanchon)
- WebSockets (by Markus Sattler)
Step 3: Upload the Code
#include <WiFi.h>
#include <SinricPro.h>
#include <SinricProSwitch.h>
#define WIFI_SSID "Your_WiFi"
#define WIFI_PASSWORD "Your_Password"
#define APP_KEY "your-sinric-app-key"
#define APP_SECRET "your-sinric-app-secret"
#define DEVICE_ID_1 "your-device-id-1"
#define DEVICE_ID_2 "your-device-id-2"
#define DEVICE_ID_3 "your-device-id-3"
#define DEVICE_ID_4 "your-device-id-4"
#define RELAY1 26
#define RELAY2 27
#define RELAY3 14
#define RELAY4 12
// Callback when Google/Alexa sends command
bool onPowerState1(const String &deviceId, bool &state) {
digitalWrite(RELAY1, state ? LOW : HIGH);
return true;
}
bool onPowerState2(const String &deviceId, bool &state) {
digitalWrite(RELAY2, state ? LOW : HIGH);
return true;
}
bool onPowerState3(const String &deviceId, bool &state) {
digitalWrite(RELAY3, state ? LOW : HIGH);
return true;
}
bool onPowerState4(const String &deviceId, bool &state) {
digitalWrite(RELAY4, state ? LOW : HIGH);
return true;
}
void setup() {
Serial.begin(115200);
pinMode(RELAY1, OUTPUT);
pinMode(RELAY2, OUTPUT);
pinMode(RELAY3, OUTPUT);
pinMode(RELAY4, OUTPUT);
digitalWrite(RELAY1, HIGH);
digitalWrite(RELAY2, HIGH);
digitalWrite(RELAY3, HIGH);
digitalWrite(RELAY4, HIGH);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
Serial.println("WiFi connected");
SinricProSwitch &switch1 = SinricPro[DEVICE_ID_1];
switch1.onPowerState(onPowerState1);
SinricProSwitch &switch2 = SinricPro[DEVICE_ID_2];
switch2.onPowerState(onPowerState2);
SinricProSwitch &switch3 = SinricPro[DEVICE_ID_3];
switch3.onPowerState(onPowerState3);
SinricProSwitch &switch4 = SinricPro[DEVICE_ID_4];
switch4.onPowerState(onPowerState4);
SinricPro.begin(APP_KEY, APP_SECRET);
}
void loop() {
SinricPro.handle();
}
Step 4: Link Sinric Pro to Google Home
- Open the Google Home app on your phone
- Tap the “+” icon → Set up device → Works with Google
- Search for “Sinric Pro” and sign in with your Sinric account
- Your devices will appear in Google Home automatically
Now you can say:
- “Hey Google, turn on the bedroom light”
- “Hey Google, turn off the fan”
- “Hey Google, turn on all lights”
Method 2: Blynk IoT + IFTTT
Blynk IoT provides a mobile app dashboard for controlling your ESP32, and when combined with IFTTT (If This Then That), you can add Google Assistant voice control.
How It Works
- Create a Blynk project with virtual pins mapped to your relays
- Create IFTTT applets: “If Google Assistant (turn on light), Then Blynk (set V1 to 1)”
- When you speak the command, IFTTT triggers Blynk, which sends the command to your ESP32
This method is more complex than Sinric Pro but gives you the excellent Blynk mobile dashboard in addition to voice control.
Method 3: Home Assistant + Nabu Casa (Most Powerful)
For the ultimate voice-controlled smart home, combine Home Assistant with Nabu Casa cloud service:
- Install Home Assistant on a Raspberry Pi, old laptop, or mini PC
- Connect ESP32 devices via MQTT (Mosquitto broker) or ESPHome
- Subscribe to Nabu Casa (₹500/month) for Google Home and Alexa integration
- Configure rooms and devices in Home Assistant
Home Assistant offers unmatched automation capabilities:
- Complex automation rules (e.g., “Turn on porch light at sunset only on weekdays”)
- Device groups and scenes (“Movie mode” dims lights and turns on the TV)
- Presence detection (auto-off when everyone leaves)
- Energy monitoring and usage analytics
- Integration with 2,000+ smart home brands
Setting Up Multiple Devices
A typical Indian home might have 8–12 switches you want to automate. Here is a practical approach:
| Room | Devices | ESP32 Channels |
|---|---|---|
| Bedroom | Light, Fan, AC | 1 ESP32 + 3 relays |
| Living Room | Light, Fan, TV outlet | 1 ESP32 + 3 relays |
| Kitchen | Light, Exhaust fan | 1 ESP32 + 2 relays |
| Bathroom | Light, Geyser | 1 ESP32 + 2 relays |
That is 4 ESP32 boards and 10 relays, controlling your entire home for approximately ₹3,000–₹4,000 in components. Name each device clearly in Google Home (e.g., “bedroom light”, “kitchen exhaust”) for intuitive voice control.
Indian-Specific Considerations
- 230V AC compatibility: Always use relays rated for 250V AC, 10A minimum. Indian mains voltage can spike to 250V during low-demand hours.
- Power cuts: After a power cut, the ESP32 takes 3–5 seconds to boot and reconnect to WiFi. Google Assistant commands will not work during this brief window.
- WiFi routers: Many Indian ISPs provide basic routers that struggle with multiple IoT devices. If you plan to have more than 8–10 ESP32 devices, consider upgrading to a router that supports more concurrent connections.
- Monsoon: If installing ESP32 switches in semi-outdoor locations (balcony, garage), use IP65-rated enclosures to protect against humidity.
- Language: Google Assistant in India supports Hindi voice commands. You can say “Hey Google, bedroom ka light on karo” if you set your device names in Hindi.
Frequently Asked Questions
Can I use Google Home Mini for voice control?
Yes. Any Google Home device or Android phone with Google Assistant works. The Google Home Mini (available in India for around ₹2,500–₹4,000) is the most popular choice for placing in each room.
Does voice control work without internet?
No. Google Assistant requires an internet connection to process voice commands. If your internet is down, you can still control the switches via the ESP32’s local web interface or physical buttons.
Can I control a ceiling fan speed with voice?
With a relay, you can only turn the fan ON or OFF. For speed control, you would need a TRIAC dimmer module and configure the device as a “fan” in Sinric Pro or Home Assistant, which supports speed levels.
Is Sinric Pro free?
Sinric Pro offers a free tier with up to 3 devices. For more devices, paid plans start at around $3/month. For a full house automation, Home Assistant with MQTT is the most cost-effective long-term solution.
Can I use Alexa instead of Google Assistant?
Yes. Both Sinric Pro and Home Assistant support Amazon Alexa. The ESP32 code remains the same — only the voice assistant app configuration differs.
Conclusion
Adding voice control to your DIY home automation system transforms the experience from “cool tech project” to “genuinely useful daily convenience.” Being able to say “Hey Google, turn off all lights” as you drift off to sleep, or “Hey Google, turn on the geyser” while still in bed on a cold morning — these small conveniences add up to a significantly better quality of life.
We recommend starting with Sinric Pro for simplicity and migrating to Home Assistant as your system grows. Either way, the ESP32 is your ideal hardware platform — powerful, affordable, and incredibly well-supported by the maker community.
Get started with voice-controlled home automation today. Browse ESP32 development boards, relay modules, and all the components you need at Zbotic.in — India’s largest electronics component store.
Add comment