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

  1. Breadboard
  2. Node MCU
  3. Breadboard Power Supply
  4. 4 Port Relay Module
  5. Jumper Wires
  6. Led
  7. Smartphone
  8. Blynk App
  9. IFTTT Account
  10. Google Home or Android Phone with Google Assistance
  11. 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

Share

    Recommendations

    • Optics Contest

      Optics Contest
    • Make it Glow Contest 2018

      Make it Glow Contest 2018
    • Plastics Contest

      Plastics Contest

    5 Discussions

    0
    None
    JēkabsK

    20 days ago

    Will this work if blynk server is in local area network? I mean blynk server will not have real IP, can ifttt still access it?

    1 reply
    0
    None
    imraxyJēkabsK

    Reply 19 days ago

    No, ifttt will call a remote webhook, how come their server reach at blynk server? This can only work if you allow external access to blynk server

    0
    None
    imraxyDIY Hacks and How Tos

    Reply 21 days ago

    Many thanks mate, I didn't try as this was my first intractable, let me see if I can still do that

    0
    None
    imraxy

    Tip 21 days ago on Step 4

    Note that the pins on NodeMCU are not same as Arduino, please use correct pin else it won't work