Voice Controlled Home Automation using Google Assistant

With the advancement in virtual assistants like Google Assistant and Alexa, Home automation and Voice controlled applications are becoming common nowadays. Now, we ourselves have built many home automation projects, from simple Automatic Staircase Lights to IoT based web controlled Home Automation using Raspberry Pi. But the project here is different.

Isn’t it cool how you can say “turn on the light” and the light will turn on with your voice command? It’s using the NodeMCU and Google Assistance. Yes, you can complete this wonderful craft with very low-cost electronic components.

In this tutorial we will learn to make IOT based Home automation then we will add google assistant to control it over voice commands.

Hardware Required :

  • Light bulb with light bulb holder and wire.
  • DC to AC relay board.
  • AC pin without ground.
  • NodeMCU Board.
  • Jumper Cable.
  • And Google Assistant On your smartphone.

This project will be completed in the following four major steps.

Step 1: Installing the Arduino IDE and the Blynk Libraries.

Step 2: Download and install the Blynk app.

Step 3: Assemble the hardware.

Step 4: Set up IFTTT.

Software Installation Steps:

  • To programme the NodeMCU module, you must first download the Arduino IDE.

Here is the link to get your Arduino IDE for your respective operating system.

  • The ESP8266 board must now be installed in your IDE.

Additional board manager URL can be found in File/Preferences/Additional board manager.

It will appear like this on your Screen preference tab.

preference tab
  • Then go to Tools/board/board manager and type ESP8266; you’ll see an ESP8266 board, which you can install.

So this is how your board of NodeMCU gets installed.

Library Installation:

  • The next step is to download the blynk library and install it in our Arduino IDE.
  • Go to Arduino library/sketch/include library to install this library.
  • Then add the blynk library though the procedure shown above.
  • On your computer, the software installation, board installation, and library installation processes are now complete.
  • The next step is to navigate to


  • Open ESP8266_standalone sketch and upload into your NodeMCU board.
  • After you’ve uploaded the code to your NodeMCU board, you’ll need to connect it as indicated below.

block diagram of system Fig. block diagram of system.[/caption]

Application Installation and Configuration:

Go to play store/app store and type blynk, you will find green color icon for blynk app, then install it on your device.

blynk app
blynk app
  • Create a new project after signing up with a gmail account.
  • Then select the Create option and fill in the necessary information, such as the project name, device utilised, and connection type.
Create New project
  • Create New project
  • This auth token will be produced and will be available in the project’s settings as well as in your Gmail account.
AuthToken Notification
AuthToken Notification.
  • After you’ve built your project, you’ll need to add various types of widgets to it. For example, I’ll be adding two buttons from the widget box shown below.

  • After you’ve selected two buttons, click the Settings button and fill in the details as shown in the image.
button Setting
The button setting.

  • After you’ve completed the process with these settings, your Dashboard should look like this.
Home Automation
  • The board icon shown in brown circle has One Red Notification like symbol on it, because  the app is not connected with board for that you have to follow some steps.
  • To begin, open your blynk-registered Gmail account and open the email from the blynk app, which will provide you with an AUTH token for your project “HomeAutomation.” Copy that auth code and paste it into the Auth type box.
  • In your Arduino sketch, enter your Hotspot ID password in the SSID and Password fields.
final Code
  • Select your NodeMCU board and click on upload.


That’s all, with the help of the blynk app, you can now control your household appliances with a touch of your fingers.However, the focus of this article is on using voice commands to operate your appliances. As a result, we’ll now proceed to the Magic Steps.

IFTTT Configuration:

We can’t connect the Google Assistant directly to the NodeMCU, that’s why we’re utilizing the Blynk app. The Blynk app may connect to the NodeMCU directly and send data to it.

So, if we can transmit Google Assistant-interpreted voice commands directly to the Blynk app, the Blynk app can then forward those commands to the NodeMCU.

However, Google Assistant is unable to recognise foreign requests such as “turn on the fan” or “turn on relay one” on its own. So, to overcome this, we use ‘IFTTT,’ an intermediary app/website.So, when we say something to Google Assistant like “OK Google, turn on the light,” Google Assistant sends this foreign command to IFTTT.

IFTTT analyses this command and uses the Blynk Server to deliver an On or Off signal to the Blynk app. After that, Blynk will transmit this signal to the NodeMCU, which will subsequently deliver it to our electrical appliances.


Journey of connecting Google Assistance with your home appliances:

Because Google Assistant is unable to send commands directly to NodeMCU, we use an intermediary programme called IFTTT, which receives input from Google Assistant and delivers the output to the Blynk app for a specific command. Let’s look at how it works.

If I say “turn on light,” IFTTT takes this command as an input because we’ve registered it as a condition in its applet, and we write what output we should send to the Blynk app depending on that condition. Now that we’ve had enough of talking and speaking, let’s get down to business.

  1. Go to the official website of IFTTT and sign up with your gmail account.    
  1. IFTTT will ask you for permission to use your Google account to add voice commands to it at this point. Allowing this is as simple as clicking the ‘Allow’ button. 
  1. Now go to the account and click on my applet, then click on create your own, then you will find a sentence “IF THIS THEN THAT“. 


  1. Click on IF option(+ option).
  2. After typing Google Assistance into the search box and selecting the option, you will see a box where you must type the input you wish to offer to Google Assistant.
Google Assistant
Google Assistant
  1. And with respect of your input what output you want from it, So as you can see in the image below I wrote what input I will feed and what output I want to listen from the Google Assistant, as you can see in the image below. 
  1. Select the Language English and hit on create trigger. 
create Trigger
  1. “IF” procedure is complete now now jump on “that” procedure 
  2. Select webhooks and click connect after clicking that option and typing webhooks. We’ll be able to send commands to the Blynk Server using webhooks.
  1. Now, in the URL field type the URL provided below: 
WEbhooksTab YourAuthTokenHere / update / DigitalPinToBeUpdateHere.
This is the URL for the India Blynk Server, but it should work in other countries as well. Replace “YourAuthTokenHere” with the Blynk Auth token you received in your e-mail.

  1. And the “DigitalPinToBeUpdateHere” part with the NodeMCU’s Digital pin that needs to be updated. As a result, we must write D1 in place of “DigitalPinToBeUpdateHere” because we assigned NodeMCU’s Digital Pin D1 to relay one. But wait, we can’t put D1 there because when Blynk Server receives this command from IFTTT, it assumes it’s for a ‘Arduino Uno’ board, but we’re actually sending it to NodeMCU.
  1. To solve this, we must type the Digital pin of Arduino which corresponds with the NodeMCU. You can find the mapping in the image below.
NodeMCU Pinout
  1. As you can see in the figure, NodeMCU’s Digital Pin D1 matches Arduino’s Pin D5. As a result, I’ll write D1 as the pin instead of D1. The URL should look something like this at the end: d5*********************d8 / update / D5

  1. Select PUT in the ‘Method‘ field next.
  2. Choose Application/JSON as the ‘Content type.’
  3. This is what you should type for the ‘Body’ type: [“1”]
  4. Here, ‘1’ indicates to turn on, so we’re simply telling Blynk to turn on the relay attached to pin D1, which is Relay one in our case.
  1. After that, click ‘Create Action‘ and then ‘Finish.’
  2. We construct another applet to turn off the relay in the same way. Except for the following adjustments, repeat all of the actions from Step 4 above.
  • Type “Turn off the light” instead of “Turn on the light” in Steps 6 and 7. 
  • In step 13, instead of [“1”], type [“0”].
  1. So now we have successfully created two triggers to Turn On and Off one Relay. As a result, we build triggers for the remaining three relays in the same way. For each Relay, simply modify the sentence and digital pin. The rest of the steps will be the same. So, in order to turn two relays on or off, we’ll need four triggers in all.
  2. When you’ve finished, you’ll be able to use your Google Assistant to generate voice requests, which should work flawlessly! As a result, you now have your own voice-controlled programme.

I hope all of you are clear about how to  make IOT based Home automation and to add google assistant to control it over voice commands.We MATHA ELECTRONICS will be back soon with more interesting topics.

Leave a Reply

Your email address will not be published.