Google Assistant based home automation

Introduction

The Internet of things (IoT) is the network of physical devices, vehicles, home appliances and other items embedded with electronics, software, sensors, actuators, and connectivity which enable these objects to connect and exchange data. Each thing is uniquely identifiable through its embedded computing system but is able to inter-operate within the existing Internet infrastructure.

The IoT allows objects to be sensed or controlled remotely across existing network infrastructure, creating opportunities for more direct integration of the physical world into computer-based systems and resulting in improved efficiency, accuracy, and economic benefit in addition to reduced human intervention. When IoT is augmented with sensors and actuators, the technology becomes an instance of the more general class of cyber-physical systems, which also encompasses technologies such as smart grids, virtual power plants, smart homes, intelligent transportation, and smart cities

About Google Assistance

Google Assistant is a virtual personal assistant developed by Google that is primarily available on mobile and smart home devices. Unlike Google Now, Google Assistant can engage in two-way conversations. Assistant initially debuted in May 2016 as part of Google’s messaging app, and its voice-activated speaker Google Home. After a period of exclusivity on the Pixel and Pixel XL smartphones, it began to be deployed on other Android devices in February 2017, including third-party smartphones and Android Wear, and was released as a standalone app on the iOS operating system in May.

Working of the project

The whole project is divided into two main parts, following the the parts one after another you can build a complete working project.

PART 1: Adafruit Account setup

Open an account on the Adafruit website HERE using your Gmail id and create a toggle button feed over your dashboard. To do this first we log into it and go to Dashboard and give it a suitable name by choosing the toggle button in that dashboard will we create one feed. Here we have given the “switch” name in our dashboard. In this dashboard, we will find important information like the user name, the key of the feed which we have created, and the feed name.

PART 2:  IFTTT Account setup

Now switch to the website and click HERE. Sign in to it and create one recipe. IFTTT stands for IF This Then That so we need to set the key This and Than only. So to set This we choose Google assistant to take our voice and match it with our provided key word like ” Turn on my kitchen light” and with response write down “Ok Let me do. Turning on your kitchen light” you can write anything in place of response words to speak out. Now to set Than, here we choose to send any value to the feed we have created. Our feed name is “switch”. So, the switch is a variable that holds the value. And we set some value to it. Let’s suppose we set it to ‘1’. And again to turn it off set it to ‘2’. Any value or character you can choose but not the special character.

Hardware Requirements

Disclaimer: It may contains Amazon affiliate links. which means I can get a small commission on the sale. This might be your indirect help to me. Thank You 🙏
  • Arduino UNO (HERE)
  • ESP8266-01 (HERE)
  • 1K and 10K ohm resistors
  • 12-0 Step-down transformer
  • IN4007 Diode.
  • Three-pin socket: To connect any device
  • 5mm LED
  • 7805 and 7812 voltage regulators
  • 12v Relay
  • Transistor (BC547)
  • Bulb holder
  • TWO-pin plug

Software Requirements

  • Arduino IDE (You can download it from HERE)
  • Adafruit_MQTT Arduino Library (Download it from HERE)
  • ESP8266WiFi Arduino Library (Within the IDE)
  • Adafruit_MQTT_Client (Within the Adafruit Library)

Block diagram

Circuit diagram

Circuit Explanation

According to the above circuit diagram, the major components of the circuit are:

  • Arduino UNO
  • Power Supply
  • WIFI Module ESP8266-01
  • Relay and relay drivers

Arduino UNO Circuit 

Main logic decision-making takes place over here. The Arduino UNO board is connected to the ESP module and Relay with Relay drivers. ESP8266-01 is the most important part of the circuit. Should be connected in a proper manner to transmit and receive data.

ESP8266-01Arduino UNO
Rx and TxPin2 (Tx) and Pin3 (Rx) respectively
CH_PD and Vcc3.3v
GNDGND

Power Supply

While the device will be running on an AC supply, the circuit will require a 12V and 5V DC supply. The 12V supply will be provided via an external power supply and supplied to a 12V relay and voltage regulator. The other components will need a 5V DC supply which will be provided via a 7805 voltage regulator that is converting the input 12V supply to 5V DC.

Relay and Relay drivers

When a key gets confirmed the respective pin becomes HIGH and due to this HIGH LEVEL or 5v it triggers the transistor BC547 connected with a resister to its base, the emitter is grounded and the collector of this BC547 is connected to the one end of the coil of 12v relay. So, when the transistor gets a voltage more than the voltage of the base emitter it triggers the transistor making the current flow from the collector to the emitter. And provides a ground to the relay circuit and the relay starts operating. This means the COMM point of relay switches to NO from the NC point. NO is connected with the NEUTRAL point of the AC supply and PHASE is provided to the device initially. So, whenever the COMM point switches to NO from NC, COMM provides NEUTRAL to the device. And the device or any appliances or bulb connected to it gets ON.

How to program ESP8266-01 using Arduino

As per the circuit diagram below table build your circuit.

ESP8266-01Arduino UNO (RESET connected to GND
Rx and TxRx and Tx respectively
CH_PD and Vcc3.3v
GPIO0 and GNDGND

To program ESP we need to put the ESP in programming mode. So, connecting the GPIO0 to GND will set the ESP in programming mode. Then we need to reset the module, for resetting we have connected a push-to-on button. On press, the RESET will be connected to GND and on release, it will be disconnected from GND. So, pressing the switch will reset the ESP module and by releasing the switch, ESP will be in programming mode.

Video Tutorial

Download Source Code

Download the complete source code: click here

1 thought on “Google Assistant based home automation”

Leave a Comment