Introduction: Node MCU With 4 Port Relay Module, Blynk App, IFTTT and Google Home. Profit?
This post is all about how to connect google home with NodeMCU and blynk app, you can control your appliances with simple blynk controlled NodeMCU switch and google assistant.
So lets go, Ok Google.. Turn on thingy :)
Step 1: Things Required
- Breadboard
- Node MCU
- Breadboard Power Supply
- 4 Port Relay Module
- Jumper Wires
- Led
- Smartphone
- Blynk App
- IFTTT Account
- Google Home or Android Phone with Google Assistance
- Few Minutes
Step 2: Breadboard, Node MCU and 4 Port Relay Module
Connect all the components as shown in schematics, you can use a breadboard power supply or use Node MCU USB to power for prototyping.
I had used a simple led here, you can use AC load on the relays in real project, please be aware that you do it with caution.
Step 3: The Blynk Sketch
Get the basic blink sketch from
https://examples.blynk.cc/?board=ESP8266&shield=ES...
You will need to change these details
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
once done try to upload the sketch to NodeMCU, check if it connects to Wi-Fi
Step 4: The Blynk App
once testing the blynk sketch on NodeMCU open the blynk app in your smartphone and
- create a button
- choose the output pin same as on the board (which references to the relay on board)
- select switch type not push button
- let data for states be 0 and 1
that's all you can manually try to switch the relay from this button and the tutorial is finished if that's what you wanted to achieve to control a relay from smartphone.
if you wanted to hook this up with google home then continue...
Step 5: If This Then That
IFTTT, Yes there is not another way so far to connect Blynk directly to google assistance and here comes IFTTT to our rescue.
Create an account with IFTTT and
- click on the if tag and search google assistance from IFTTT
Connect IFTTT to your Google account and create a new ‘Simple phrase’ trigger
Add a couple of phrases you would find natural, and add a response that the Google Home should say.
- Next we will need section, choose webhook
- To get the IP address for blynk server, ping blynk-cloud.com
- The complete URL for webhook will be something like< http://blynk-server-ip>//update/
- choose method PUT and body as ["0"] or ["1"] as per the command and switch
- you will need to create 2 requests both of on and off
That's all folks once this step if done your google assistance will call the IFTTT applet which will then call the blynk webhook and finally send the command to NodeMCU.
Thanks