This tutorial we will learn to make IOT based Home automation then we will add google assistant to control it over voice commands.
This Project Sponsor By NextPCB PCB
Google assistant is AI (Artificial Intelligence) based voice command service. Using voice, we can interact with the google assistant and it can search on the internet, schedule events, set alarms, control appliances, etc.
This service is available on smartphones and Google Home devices.
We can control smart home devices including lights, switches, fans, and thermostats using our Google Assistant. Yes you can do this amazing project with a very cost-effective electronic parts.
Here’s a video that’ll take you step by step to complete your home automation.
All you Required is:
- 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.
That’s it, your project will be completed with this few things, now let us move towards the next step.
Block DiagramNodemcu ESp8266 is linked with the Blynk application account with the IFTTT website which is connected to the Google assistance cloud. Home appliances like BULB, FAN, and MOTOR are connected to the Nodemcu ESP8266
Hardware Required- Nodemcu ESP8266
- Bulb
- Fan
- Motor
- Arduino IDE
- Google assistance
- Language – Embedded C
According to this system, a smart voice control home automation system is deployed into the Nodemcu ESP8266 using the Blynk App account with the IFTTT website and Google assistance API within it. Through which a user can home appliances just by giving the voice controls input.
This project will be done under this 4 Major Steps.
Step 1 : Downloading and Setting up Arduino IDE and Blynk Libraries.
Step 2 : Install and Configure Blynk App.
Step 3 : Hardware Assembly.
Step 4 : Configure IFTTT.
Software Installation Steps:- First, you have to download Arduino IDE for programming NodeMCU module.
https://www.arduino.cc/en/Main/Software
here is the link provided for downloading your Arduino IDE for you on your Respective OS.
- Now we need to install ESP8266 board in your IDE.
For that, you need to open your ARDUINO IDE first and paste the URL Provided below.
File/preferences/Additional board manager URL
http://arduino.esp8266.com/stable/package_esp8266com_index.json
It will appear like this on your Screen preference tab.
preference tab.
- Then follow the path Tools/board/board manager and Type ESP8266, you will find a board of ESP8266 click on install option.
Board Manager.
So this is how your board of NodeMCU gets installed.
- Next thing, We need to install blynk library in our Arduino IDE from here..
- To install this library, Go to Arduino library/sketch/include library
ArduinoIDE.
Then add the blynk library though the procedure shown above.
- Then add the blynk library though the procedure shown above.
Addinglibrary
Now Software Installation, Board Installation, and Library Installation process completed on your PC.
- Next process is you have to go to path file/Example/blynk/boardWifi/ESP8266_Standalone.
path
- Open ESP8266_standalone sketch and upload into your NodeMCU board.
tools.
here the code has been uploaded into your NodeMCU board, now you have to make the connection as shown below.
Fig. block diagram of system.
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.
- Sign up with a gmailid and then create a new project.
- then click on create option and fill the details like project name, device used and connection type.
Create New project.
- Auth token will be generated this auth token you will get in the settings option of this project and on your Gmail Account.
AuthToken Notification.
- Once your project is created, you have to insert different types of widget into it, For example I will be adding two buttons from widget box shown below.
widgetBox.
- After selecting two buttons click on the Settings button and fill the details like I did in following image.
The button setting.
ButtonSetting.
- After all the process with this settings your Dashboard will look appear 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.
- First, you have to open your blynk registered Gmail acc open the mail from blynk app which gives you AUTH token for your project”HomeAutomation“, copy that auth code to Auth type in the code box.
- Insert your Hotspot ID password into your SSID and Password on your Arduino Sketch.
final Code.
- Select your NodeMCU board and click on upload.
Tools.
And that’s it, Now you can control your home appliances with a touch on your fingers with the help of blynk app.
But, this tutorial is all about controlling your appliances on your voice commands. So now we will move towards the Magic Steps now.
IFTTT Configuration:We cannot connect the Google Assistant to the NodeMCU directly, and that is the only reason we are using the Blynk app. Blynk app can directly connect to the NodeMCU and send data from it.
So, if we can send the voice commands interpreted by Google Aassistant directly to the Blynk app, the Blynk app can then forward those commands to the NodeMCU.
But the problem is Google Assistant cannot directly understand foreign commands like “turn on the fan” or “turn on relay one” etc. on its own. So, to solve this we use another intermediate app/website called ‘IFTTT’.
So, in the end what will happen is, when we say a voice command like “ok google turn on the light” to the Google Assistant, Google Assistant sends that this foreign command to IFTTT.
IFTTT interprets this command and sends an On or Off signal to the Blynk app via the Blynk Server. Blynk will then send this signal to the NodeMCU and then to our electrical appliances.
AdafruitFirst, created an account at www.Adafruit.io
Now, create dashboard at Adafruit. This dashboard is a user interface to control things remotely.
After following the above steps, provide a name to the dashboard and save it. We can see our dashboard as follows,
Now, create a feed (user interface) to control light On-Off. To create it, just click on the ‘+’ symbol and select the toggle feed shown below,
After selecting the toggle feed, a pop-up window appears as shown below.
Enter the name of our feed (shown in the red box) and create it. After creation, select the created feed (here mine is light) and then click on the Next step.
In the next step configure the feed which is shown below,
Here, I used 0(OFF) and 1(ON) text for button and then click on create. This will create a toggle button on your dashboard which can be used to control things remotely.
Now, my dashboard is ready for IoT applications like home automation.
IFTTT (If This Then That)
If This Then That, also known as IFTTT is a free web-based service to create chains of simple conditional statements, called applets. An applet is triggered by changes that occur within other web services such as Gmail, Facebook, Telegram, Instagram, or Pinterest.
For example, an applet may send an e-mail message if the user tweets using a hashtag or copy a photo on Facebook to a user's archive if someone tags a user in a photo.
Here, I used IFTTT to use google assistant service and Adafruit service in the chain. So, when I use google assistant to control the light of my home by saying Ok Google, turn the light ON or OFF. Then IFTTT interprets the message and can send it to Adafruit’s dashboard as an understandable command to the created feed.
Configure IFTTTThe first step is creating an account on IFTTT.
Note: Create an account on IFTTT byusing the same e-mail id which you have used for Adafruit.
After account creation, click on My Applets and then select New Applet shown below,
After selecting a new applet, we get a new page in which we should click on to This as shown in the below image.
Then search for Google Assistant and select it.
Now, enter voice phrases which we will use as a command for google assistant.
We can enter any phrase as per our application. As you can see, the phrases entered in the above fields is for making Light ON. For making Light OFF, we have to create another applet with different phrases.
Now, we get another page on which we have to click on that option which is used to connect Google Assistant with Adafruit.
Then search for Adafruit and select it.
After selecting Adafruit, choose action as shown below,
📷
Now enter what data we need to send to which feed of Adafruit dashboard.
Click on Create Action.
So, when I use Google Assistant on my mobile and give a voice command as “Ok Google, Turn LED ON”, the applet created in IFTTT receives this command and will send data ‘1’ to the Adafruit feed. This will trigger the event on the Adafruit dashboard which is continuously monitored by the microcontroller (here NodeMCU). This microcontroller will take action as per the data change on the Adafruit dashboard.
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
- 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.
When this it is all done, you will be able to generate the voice commands with your Google Assistant and it should work like a charm! So now, you have your own voice controlled with the application.
- When this it is all done, you will be able to generate the voice commands with your Google Assistant and it should work like a charm! So now, you have your own voice controlled with the application.
I hope you enjoyed learning this cool project. If you want to know more about its parameter in details please click on the links given below
Comments