DIY Home Automation Project using Blynk and Google Assistant

DIY Home Automation Project using Blynk and Google Assistant

0 comments / Posted on by Quartz Components

DIY Home Automation Project using Blynk and Google Assistant

Today we are going to automate a light bulb using ESP8266 NodeMCU board and Blynk assistant, further we will also be integrating the system with Google Assistant. NodeMCU is a quite popular IoT module and has many capabilities. We will be integrating the final project through google assistant by using the IFTTT which stands for IF This Then That and lets you create certain applets including several services.

 

Components Required:-

Yeah, these are the only components that you’ll need for making the whole project. The connections of these components are fairly simple too.

 

NodeMCU Home Automation Circuit Connection:-

You just have to connect the relay to the NodeMCU board i.e. GND, VCC, and IN pin. Apart from this, you need to connect the bulb to the relay between the Common and NO terminal.

 

The schematic diagram for the same is something like this:-

NodeMCU Home Automation Schematic Diagram

Now that we have done the connections, it is time to jump over to the coding part. But before that, we have one more task left to do that is setting up the Blynk IoT application.

 

Setting up Blynk:-

What's Blynk?

Blynk Logo

Blynk is a Platform with iOS and Android apps to control Arduino, Raspberry Pi, and the likes over the Internet. It’s a digital dashboard where you can build a graphic interface for your project by simply dragging and dropping widgets.

Blynk was designed for the Internet of Things. It can control hardware remotely, it can display sensor data, it can store data, visualize it, and do many other cool things. It's a digital dashboard where you can build a graphic interface for your project by simply dragging and dropping widgets. It's really simple to set everything up and you'll start tinkering in less than 5 mins. Blynk is not tied to some specific board or shield. Instead, it's supporting hardware of your choice. Whether your Arduino or Raspberry Pi is linked to the Internet over Wi-Fi, Ethernet, or this new ESP8266 chip, Blynk will get you online and ready for the Internet of Your Things. (Source: Blynk website).

 

For setting up Blynk. First, open the application and create a new project.

Create New Project For Blynk

Give your project a name and choose the board as NodeMCU and connection type as Wi-Fi.

Project Settings For Blynk

After doing this you’ll receive an authentication token in your email. Note it as it will be used later on while programming and while connecting to IFTTT as well.

Authentication Token For Blynk

Auth Token is a unique alphanumeric string to identify your project in the Blynk’s server and assigning the correct data through it.

 

After creating the project drag and drop a button from the menu.

Widget Box For Blynk

Connect it to any digital pin of your choice I’ll go with D2 as I had connected relay to that pin. Also, change the slider to switch, as you don’t want it to act like a push button.

Button Settings For Blynk

Now we are done with setting up Blynk and can jump to coding but before that, we’ll have to install the Blynk libraries in our Arduino IDE.

 

Installing Libraries:-

Download the Blynk libraries from the below link and install it as follows. <totheeditor>I have provided the zip file of the library kindly attach its link. </totheeditor>

 

First of all extract the downloaded zip file.

Installing Libraries

Now, copy and paste the extracted file to C:\Users\User\Documents\Arduino\libraries.

Blynk Libraries

And by just doing this much. You have successfully installed the Blynk library in your Arduino IDE.

Now that we have our Blynk application setup and we have also installed the libraries, it is time to program our NodeMCU and get it running.

 

Programming:-

For programming the NodeMCU with Blynk sketch open Arduino IDE and go to:- Files à Examples à Blynk à Boards_WiFi à NodeMCU

NodeMCU Sketch

Open the following sketch.

In this sketch, you need to make slight changes before uploading it to your NodeMCU board. Those changes are, SSID, Password, and auth respectively. In SSID and password fill in the details of your router and in the auth token field give the token that you had received in the email during the blynk setup process.

Programming NodeMCU With Blynk

After making those changes hit the upload button. After the code gets uploaded. Pick your mobile phone and press the button in the Blynk application, if everything went correctly you should see a response in the bulb.

 

Connecting to Google Assistant:-

For connecting our project to google assistant we will use ifttt.com as mentioned above in the article. For setting up.

  • Go to ifttt.com

Click on create and choose THIS

IFTTT Setting

  • Now search for Google assistant from the search box and fill in the basic details like what will you say to trigger the assistant (Turn on the Lights) and what do you want the assistant to reply(Okay, turning the lights on).
  • Save this and now click on THAT.
  • Now search for webhooks and fill in the details like this.

 Webhooks For IFTTT

The URL that you have to fill is:-

http://188.166.206.43/YourAuthToken/update/D4?value=0

Do the same thing for turning off the lights. Just change the 0 at the end of the URL to 1. Remember 1 for OFF and 0 for ON

 

And you’re DONE. 

You can see the project in action in the video below.

 

Today we are going to automate a light bulb using ESP8266 NodeMCU board and Blynk assistant, further we will also be integrating the system with Google Assistant. NodeMCU is a quite popular IoT module and has many capabilities. We will be integrating the final project through google assistant by using the IFTTT which stands for IF This Then That and lets you create certain applets including several services.

 

Components Required:-

Yeah, these are the only components that you’ll need for making the whole project. The connections of these components are fairly simple too.

 

NodeMCU Home Automation Circuit Connection:-

You just have to connect the relay to the NodeMCU board i.e. GND, VCC, and IN pin. Apart from this, you need to connect the bulb to the relay between the Common and NO terminal.

 

The schematic diagram for the same is something like this:-

NodeMCU Home Automation Schematic Diagram

Now that we have done the connections, it is time to jump over to the coding part. But before that, we have one more task left to do that is setting up the Blynk IoT application.

 

Setting up Blynk:-

What's Blynk?

Blynk Logo

Blynk is a Platform with iOS and Android apps to control Arduino, Raspberry Pi, and the likes over the Internet. It’s a digital dashboard where you can build a graphic interface for your project by simply dragging and dropping widgets.

Blynk was designed for the Internet of Things. It can control hardware remotely, it can display sensor data, it can store data, visualize it, and do many other cool things. It's a digital dashboard where you can build a graphic interface for your project by simply dragging and dropping widgets. It's really simple to set everything up and you'll start tinkering in less than 5 mins. Blynk is not tied to some specific board or shield. Instead, it's supporting hardware of your choice. Whether your Arduino or Raspberry Pi is linked to the Internet over Wi-Fi, Ethernet, or this new ESP8266 chip, Blynk will get you online and ready for the Internet of Your Things. (Source: Blynk website).

 

For setting up Blynk. First, open the application and create a new project.

Create New Project For Blynk

Give your project a name and choose the board as NodeMCU and connection type as Wi-Fi.

Project Settings For Blynk

After doing this you’ll receive an authentication token in your email. Note it as it will be used later on while programming and while connecting to IFTTT as well.

Authentication Token For Blynk

Auth Token is a unique alphanumeric string to identify your project in the Blynk’s server and assigning the correct data through it.

 

After creating the project drag and drop a button from the menu.

Widget Box For Blynk

Connect it to any digital pin of your choice I’ll go with D2 as I had connected relay to that pin. Also, change the slider to switch, as you don’t want it to act like a push button.

Button Settings For Blynk

Now we are done with setting up Blynk and can jump to coding but before that, we’ll have to install the Blynk libraries in our Arduino IDE.

 

Installing Libraries:-

Download the Blynk libraries from the below link and install it as follows. <totheeditor>I have provided the zip file of the library kindly attach its link. </totheeditor>

 

First of all extract the downloaded zip file.

Installing Libraries

Now, copy and paste the extracted file to C:\Users\User\Documents\Arduino\libraries.

Blynk Libraries

And by just doing this much. You have successfully installed the Blynk library in your Arduino IDE.

Now that we have our Blynk application setup and we have also installed the libraries, it is time to program our NodeMCU and get it running.

 

Programming:-

For programming the NodeMCU with Blynk sketch open Arduino IDE and go to:- Files à Examples à Blynk à Boards_WiFi à NodeMCU

NodeMCU Sketch

Open the following sketch.

In this sketch, you need to make slight changes before uploading it to your NodeMCU board. Those changes are, SSID, Password, and auth respectively. In SSID and password fill in the details of your router and in the auth token field give the token that you had received in the email during the blynk setup process.

Programming NodeMCU With Blynk

After making those changes hit the upload button. After the code gets uploaded. Pick your mobile phone and press the button in the Blynk application, if everything went correctly you should see a response in the bulb.

 

Connecting to Google Assistant:-

For connecting our project to google assistant we will use ifttt.com as mentioned above in the article. For setting up.

  • Go to ifttt.com

Click on create and choose THIS

IFTTT Setting

  • Now search for Google assistant from the search box and fill in the basic details like what will you say to trigger the assistant (Turn on the Lights) and what do you want the assistant to reply(Okay, turning the lights on).
  • Save this and now click on THAT.
  • Now search for webhooks and fill in the details like this.

 Webhooks For IFTTT

The URL that you have to fill is:-

http://188.166.206.43/YourAuthToken/update/D4?value=0

Do the same thing for turning off the lights. Just change the 0 at the end of the URL to 1. Remember 1 for OFF and 0 for ON

 

And you’re DONE. 

You can see the project in action in the video below.

 

0 comments

Leave a comment

All blog comments are checked prior to publishing