fbpx

Controlling Appliances with Google Assistant

Till now you have used your Google Assistant to answer questions regarding weather condition, currency rates, direction, date & time etc. Your Google Assistant can do more than just answer these questions. Now use Google Assistant to control your home appliances, just say:

Ok Google, turn on light. 

And your work is done. So read this article to learn how to make this possible.

Process

This process consists of three parts:

  • Hardware (WiFi controlled Relay)
  • Coding (Adafruit MQTT Client Code)
  • IFTTT ( Merging Google Assistant and Adafruit MQTT)

Hardware

For the hardware we need to have a relay to switch AC appliances which is operated through WiFi. So for that I have used my already-made-in-a-previous-project Sonoff. In case you have watched this project and made your own Sonoff, then your hardware & coding portion is completed.

For the rest of the people, I’ll show you simple relay which is controlled using ESP8266 12e dev board. So the connections of relay, ESP8266 and the AC appliance (bulb) is something like this:

Coding

For coding the ESP8266 we are going to use Adafruit MQTT Library which you can download from my GitHub account. In that library, we are just going to modify the example code called “mqtt_esp8266”.

There are lot of changes you need to do in that code, so better watch my tutorial video. And yes, you also need to make an account in io.adafruit.com before uploading the code as there are few details of your account which you need to enter in the code. So watch out my video attached in the end of the article to know the process.

IFTTT

IFTTT stands for If This Then That which basically provides a platform on which we can merge two different services. Like for our project, we are going to use Google assistant and Adafruit MQTT. So any instruction coming from Google assistant will be processed by IFTTT and accordingly the actions will be performed on Adafruit MQTT server side.

Making account in IFTTT and making applets in that application is a bit lengthy process and it will be difficult to explain it in words. For this, please watch my tutorial video.

Tutorial video