Home Automation using NodeMCU and Google Assistant | Voice Activated | Blynk, IFTTT, Arduino IDE

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
"okay google, turn on the light" "okay, turning on the light" Hey what's up everybody Abhishek Hingorani here and today I'm going to show you how you can control our electronic appliances using your voice over the Internet and that to under a budget of $20 so let's get started okay so we'll complete this whole project in just four simple steps now if you wish to come back at any time or skip ahead on the timeline to any of these steps you can find the time for each of these steps in the description okay so with all that said let's get into it and make a start with the first step which is to install and configure the blynk app so I have my Android phone and the first thing I'll do is go to the Play Store and download the blynk app and install it once it's installed I'll open it and login using Facebook now that I'm logged in I'll click on new project and give the project a name such as home automation I'll select NodeMCU as the device and select connection type as Wi-Fi and finally how would it create at this point blynk will send an auth token to the email id registered with my Facebook account I'll use this auth token later to link the blynk app with the NodeMCU okay now in the blank project I'll add four buttons to control the four relays so to add a button I'll simply click on the blank area and select button from the menu now I'll click on the button and name it relay 1 and select the pin as digital pin d3 similarly I'll add another button drag it into position click on it and name it relay 2 and I'll select its pin as digital pin d4 I'll add the third button name it relay 3 and select the pin as d5 and finally for the fourth button I'll name it relay 4 and select the pin as d6 so that concludes the first step once you have the blynk app all set up it's time to move into the next step which is setting up the Arduino IDE and the blynk libraries ok so now I'm here at my workdesk with my PC powered on so first of all I'll open up my email and copy the auth token from blynk's mail and paste it somewhere like in the notepad will use this auth token later the next thing I will do is go to Arduino website and download the Arduino IDE just choose your preferred operating system and hit download I'll also put all the links in the description below alternatively Windows users can also go to Windows Store search for arduino ide and download and install it from there itself i cannot download it as i already have it installed in my system once the arduino ide is installed I'll go to blynks github page again links are available in the description I'll scroll down and download the latest blynk library as I already have it downloaded it I'll hit cancel but you'll get something like this after you have downloaded it I'll right-click it and extract the contents of the zip file now I'll open up the arduino ide go to file>preferences and copy this path and close the ide then I'll open up this path now this is the directory where all the arduino libraries are installed and therefore i'll have to copy the newly downloaded blink libraries into this folder so first i'll copy the downloaded blink libraries and paste them in the libraries folder as i have already copied them in my directory i won't copy them again so similarly copy the blynk tools and paste them in the tools folder alright now I'll connect the node MCU to the PC ok so now that we have the ID and blynk libraries all set up we're ready to write some code and upload it to the node MCU first of all I'll open up the arduino ide and change some settings i'll go to tools>port and make sure an appropriate port is selected in my case it's COM 4 and then i'll go to tools>board and select node MCU as the board and that's really all the settings we need to change so now let's begin writing some code go to files>examples scroll down select Blynk>Boards_Wi-Fi and click on esp8266 standalone now in this file we only need to change three lines of code the first line we'll have to change is this I'll just replace this with the auth token I copied earlier now here we'll have to write the name of Wi-Fi network we want our node MCU to connect to which in my case is "The Network" so here I'll just type in The Network and for this field we'll have to type in the password of Wi-Fi network so in my case the password for my Wi-Fi the network is "abcd1234" so I'll just type in abcd1234 and that's it that's literally all the code that we need to write and now we are actually ready to upload this code to the NodeMCU so I'll directly hit upload and wait for it to process and it's done the code has successfully been uploaded to the node MCU and the next time I power it on it will automatically connect to my Wi-Fi network and this concludes our step two let's now move to step three hardware assembly okay so here's the plan now you connect the node MCU and the relay board using some jumper cables to power the node MCU we can either use a phone charger and directly plug it in or we can use a power bank to power it up to power the relay board you can either use some batteries or get a breadboard power supply module now the final step is to connect the electronical appliances with the relay board you can directly pull out wires from your main socket and attach them to the relay but to do so I would recommend that you take help of a professional electrician and not to do it on your own because working with such high voltages can be very dangerous and can cause some serious damage if you don't know what you're doing so for the sake of this tutorial I would connect a simple external light bulb to one of the relays using a wire and connect the other end of that wire to the wall socket to supply power to the bulb, simple enough so let's get into it let's start by attaching a node MCU to the breadboard I'll connect the node MCU with the relay board within some jumper cables I'll connect digital pin d3 of the node MCU to relay one pin D4 for to relay 2, D5 to relay 3, D6 to relay 4 and the ground pin of the node MCU with the ground pin of the relay I'll attach the light bulb to the relay board using this wire I'll just screw the two open ends of the wire to the relay. To power the node MCU I'll use a smartphone charger and now to power the relay you should use some batteries or a breadboard power supply module but currently I don't have any of those so as a workaround I'll power the relay using the Arduino board which is wrong you don't have to buy an Arduino board just to power the relay module you can either use some batteries or a breadboard power supply module but as I don't have any of those options I'm using the Arduino board and now I'll attach the bulb to the wire finally I'll plug both the smartphone charger connected to the node MCU and the wire connected to the bulb to the power socket and turn them on alright let's now test this little setup of ours. Before doing that let's change one final setting in the blynk app open home automation project that we created earlier and for each of the button interchange the output from 0 to 1 to 1 to 0 and change the mode from push to switch repeat these steps for all the buttons all right let's now hit the play button to test the project and as you can see the project is working just fine all right if this is what you wanted to control your electronic appliances using a smartphone then you're done it's fine if you don't watch the video but if you want to control your home appliances using your voice with voice commands then do keep watching and lets now move to step 4 configuring IFTTT okay so here is what we have done so far to control home appliances over the Internet we are using node MCU and to connect the home appliances with node MCU we are using a relay board so the blynk app on our smartphone sends on/off commands to the node MCU which turns on/off our home appliances but this is not our goal our goal is to control the electrical appliances using Google assistant's voice commands now we can neither send Google assistance voice commands directly to the node MCU nor can we send them directly to the blynk app therefore we will use an intermediate tool called IFTTT which will bridge the gap between Google assistant and the blink app so in the end this is how things will work when we say a voice commands like "turn on the light" to Google assistant it will send that command to IFTTT, IFTTT will then interpret that command and send appropriate request to the blynk app. And in the end blynk app sends the command to the node MCU and then to the electrical appliances so let's get into it and configure IFTTT first of all I'll go to IFTTT.com and sign up to it using my Google account once I'm signed in I'll click on my applets and then click on new applet I'll click on this search for Google assistant and selected I'll then click on connect at this point IFTTT will ask you permission to use your Google Account to add voice commands for Google assistant which I'll simply allow and now we'll be presented with a screen with four options I'll select the first one which says say a simple phrase which basically means that when I say a simple phrase to Google assistant then some work should happen now here we'll have to fill in the actual command that we say to the Google assistant so for the command I'll type in turn on relay 1 here we'll type some other way to say this previous command which I'll just write as turn the first relay on and once again some other way to say the first command something like turn on the first relay now here I'll type the reply that the Google assistant should respond with for the above phrase something like okay turning on relay one once this is all done I'll click on create trigger as you can now see we have successfully created a trigger which means that if Google assistant gets the command turn on relay 1 then something should happen which in our case is sending a request to the blink app to turn on relay 1 so to program this I'll click on that now here I'll type webhooks and select it and then hit connect now webhooks is a tool that will allow us to send web request to the bynk app so to create a new web request I'll click here now in this web page for the URL field you must type in this URL this is the URL for the blink server of India but it should work for other places as well now after the forward slash you must type the auth token of your blynks project that you received in the mail now here you must specify the digital pin of known MCU that you want to control in our case as we want to control relay one which is connected to digital pin D3 of node MCU I'll type in D3 but we cannot write D3 here because when blynk server sends the command to the node MCU it assumes that it is sending the command to an Arduino board instead of a NodeMCU so in this field will write the digital pin of arduino which corresponds to the digital pin of NodeMCU and as you can see from this diagram the digital pin d3 of node MCU corresponds to pin d0 of arduino so here we'll write d0 now that this is done we'll select the method is put content type as application/json and for the body I'll write 0 in double quotes and inside square brackets here 0 means to turn on so basically the sending blynk a request to turn on digital pin D3 click on create action and finish so similarly I will create another applet to turn off the relay so I'll again click on my applet select new applet click this search for google assistants and select it select say a simple phrase and for the phrase I'll use turn-off really one and as a reply I'll type okay turning off relay one and hit create trigger now for the that part I'll again search for webhooks and select it and follow the same steps as I did earlier but this time in the body instead of zero I'll type in one I'll finally click on create action and finish and as you can now see we have two applets to turn on and off relay one and we have finally completed all the steps so let's test it out Hey Google, turn on relay 1 Okay, turning on relay one hey Google turn off relay one Okay, turning off relay one and that's it for this video guys if you liked this video do hit the like button, share this video with your friends subscribe to the channel if you haven't already thank you so much for watching and I'll see you in my next video
Info
Channel: Codeometry
Views: 544,214
Rating: undefined out of 5
Keywords: Home Automation using NodeMCU, Home Automation Project, DIY Home Automation, Home Automation using NodeMCU ESP8266, Home Automation using NodeMCU and Google Assistant, Voice Activated Home Automation, Voice Controlled Home Automation, Home Automation using Blynk, Arduino IDE, IFTTT, Blynk, Home Automation IOT, IOT, Okay Google, Google Assistant, NodeMcu and Blynk App, DIY Home automation project, DIY Home Automation using NodeMCU and Blynk app, IOT Project Ideas, Tutorial, how to
Id: 5SvRolROPxA
Channel Id: undefined
Length: 16min 58sec (1018 seconds)
Published: Sat Dec 30 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.