Automation Using Google-Assistant
Last Updated on July 24, 2023 by Editorial Team
Author(s): Santhosh Bandaru
Originally published on Towards AI.
Technology
Automating our home appliances is a bit interesting. So letβs see how we can automate them with google-assistant.
If you are an excited geek and want to automate your home, here is an interesting application for you. In this module, we are going to build a simple automation system that allows you to control the home appliance from anywhere. We are using Blynk and IFTTT for software purposes. And we use esp8266(Node MCU) as a part of the hardware. Installing modules on our own will quite interesting.
Blynk:
Blynk is an open-source platform that allows us to quickly build interfaces for monitoring and controlling our hardware projects from our mobiles. It supports both Android and iOS mobiles. It provides an attractive interface. After downloading it, you can create your project dashboard and arrange buttons, graphs, sliders, timers, and other widgets onto the screen.
NodeMCU:
NodeMCU is an open-source firmware. It is a microcontroller. It is a development board specially targeted for IoT based applications. It includes firmware that consists of an esp8266 WiFi socket on chip(SoC).
It consists of 17 GPIO pins and a 2.4GHz antenna. It has 128 KB RAM and 4MB of Flash memory to store programs and data. It can be powered using a micro USB jack. It supports UART, SPI, and I2C interface. It supports a voltage of 3.3V.
IFTTT:
The abbreviation of IFTTT is (If This Then That) helps us connect all our different applications and devices. It is a freeware web-based service. It creates connections of simple conditional statements, called applets, which help in connecting apps together via the internet. Here it is helping in connecting Google Assistant to the Blynk app.
Implementation:
We need to control our home appliances using the Internet. So, we need a proper internet connection at our home. For this, you need Nodemcu and Wi-Fi. Initially, install Arduino-Uno on your PC. And make sure you install esp drivers. If not, install them. And include the packages by adding the following content in preferences. You can found this dialog box by clicking (CTRL+comma) in IDE.
https://dl.espressif.com/dl/package_esp32_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json
Install Blynk applications in your mobile and registered with a valid email address. Create your project and name it. Choose NodeMCU(esp8266) as a device and make your dashboard by adding buttons. Make sure your buttons are digital. After registration, you will receive mail from blynk with code and authentication token. The authentication token is unique for every project. This authentication token useful while connecting the application to the device. It also useful while connecting the application to the IFTTT service.
Dumping Code:
As soon as you create a project, you will receive mail with code. Open the code in IDE(Arduino) and dump that code into the microcontroller(NodeMCU). Before, fill SSID and password of your Wi-Fi in code. And fill the auth[] with the authentication token which you received in your mail.
Dump the code into a microcontroller before connections are made. Be careful while connecting the connections as we are dealing with 230V. While dumping, makes sure that the board manager and baud rate are related to the microcontroller, we use i.e., nodemcu(esp8266). Dumping of code may take a couple of minutes.
Modules used:
Dump the code before connecting the circuit. Make sure connections are correct. Here we used Relay and bulb. We can control that bulb using our mobile
With this, we finished building automation using mobile such that now, we can control our appliances using mobile.
Using Google assistant:
Till now, we have access to our devices using mobile i.e., Blynk application. Now we will how to access them using over Google Assistant. For this, we need to use IFTTT. As this is a web-based service we need to code it on the web. Open IFTTT on your browser. Here we have two phases in IFTTT. Follow these steps for setup.
Phase-1:
1)Open IFTTT(If this then that) and click on new applet.
2)Click on '+' before 'this' and choose your service as Google Assitant.
3)Fill the phrases in dialog box that appears on screen.
4)Make sure you have to remember the commands you given in trigger dialog box.
5)And fill those details.
6)Click on the trigger button.
Phase-2:
7)Now you will see the GOOGLE ASSISTANT Logo at the THIS position in the window. (Click on the + symbol before THAT)
8)Search for WEBHOOKS and choose it. Then click on β Make a WEB REQUESTβ. On the next page complete the fields.
9)In URL, provide the IP address of blynk-cloud.com where we found in cmd.
(URL Format is http://ip address of blynk-cloud/authid/update/pin no.)
10)And choose method tobe PUT and the content type has to json. Then click on the finish.
Make sure that while your setup the commands you have given are correct. These are the steps that have to follow while setting up IFTTT. Take your mobile and give commands to Google Assistant. Now you will see that our home appliances will function according to our commands.
Commands have to match the instructions which you have chosen in the IFTTT setup. This is the complete setup.
We have to repeat the process for each device that you have used in your circuit. So, for every device, you have to repeat the above process. After connecting all our devices to IFTTT, we can control all devices with our Google Assistant.
Finally, you have built your automation system.
You can checkout the whole project on Github.
Conclusion:
We learned how to automate our house appliances using the Internet and Google assistant. Here we can access them using the Blynk app (manually) and using Google assistant (using voice commands). You can control them using Alexa also but tiny changes have to make in IFTTT. I hope you enjoyed the procedure and now understand how you can start them. Please feel free to suggest any changes wherever you find a scope of improvement. I will catch up with you again soon. Till then, Stay Home and Stay Safe!
If you would like to get in touch, connect with me on LinkedIn.
Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming aΒ sponsor.
Published via Towards AI