Skip to content

Instantly share code, notes, and snippets.

@xmfcx
Last active January 6, 2022 14:06
Show Gist options
  • Star 31 You must be signed in to star a gist
  • Fork 11 You must be signed in to fork a gist
  • Save xmfcx/3e6be68dd655cd7058085702e0bcb4b0 to your computer and use it in GitHub Desktop.
Save xmfcx/3e6be68dd655cd7058085702e0bcb4b0 to your computer and use it in GitHub Desktop.
OK Google, Arduino Uno, ESP8266, Blynk, IFTTT, Google Assistant Integration Tutorial

OK Google, Arduino Uno, ESP8266, Blynk, IFTTT, Google Assistant Integration Tutorial

This is a tutorial to realize following video: https://www.youtube.com/watch?v=PBiOGvJRPqg

Requirements:

  • Android phone Marsmallow or higher or Apple phone (for google assistant)
  • IFTTT app
  • Blynk app
  • Arduino UNO
  • ESP8266 Wifi module
  • Some jumper cables
  • 5v to 3.3v logic converter (optional)

Arduino-ESP8266 connections

Here you have 2 options:

  • To use a 5V to 3.3V logic converter (recommended)
  • Connect things directly without it (what I did)

For me it didn't cause any visible harm not using it. So you can connect like shown in the image below, connect right colors to right pins, with or without the logic converter. (Image taken from https://www.hackster.io/circuito-io-team/simple-arduino-uno-esp-8266-integration-dba10b ) Connections

Arduino-ESP8266 And Blynk Integration

  1. Follow instructions on http://www.blynk.cc/getting-started/
  2. DOWNLOAD BLYNK APP FOR ANDROID OR IOS
  3. GET THE AUTH TOKEN
  4. INSTALL BLYNK LIBRARY
  5. And put the code from https://examples.blynk.cc/?board=Arduino%20Uno&shield=ESP8266%20WiFi%20Shield&example=GettingStarted%2FBlynkBlink to arduino and flash it with standard Arduino IDE.

Make sure to fill in your home wifi SSID and Password and Authkey from blynk app.

Comment out following line because Arduino Uno doesn't have hardware serials: #define EspSerial Serial1

And uncomment these lines because we will use software serial: //#include <SoftwareSerial.h> //SoftwareSerial EspSerial(2, 3); // RX, TX

For our case EspSerial rx, tx stuff is (10, 11)

Also make sure your esp baud rate is correct on this line: #define ESP8266_BAUD 115200 (for me it was 9600)

  1. Install Blynk app on your smartphone and add a button to it and make it turn on/off a digital pin. In my case it was D7 pin. Which harbored the LED.

  2. Once your arduino is powered it will connect to your home wifi with esp thus to internet. And when you press the button from blynk app it will turn it on and off.

IFTTT Integration:

  1. Get IFTTT on your phone. Create a new applet. IF part (trigger) is upto you. For testing try to make it a button widget.

  2. THEN part (action) is, Maker webhooks. When it asks you to select an action, you can type maker in search box and select that thing.

  3. Select action: Make a web request

URL:

http://188.166.206.43/yourauthkeycomeshere/update/D7 that ip is i guess India's dns ip thingy of blynk-cloud.com and it worked for me in Turkey.

This part was a bit painful because they changed format a lot. http://docs.blynkapi.apiary.io/#reference/0/write-pin-value-via-put/write-pin-value-via-put

normally you should do like explained there: http://blynk-cloud.com/auth_token/update/pin

but for me, i had to write that ip there otherwise it wouldn't resolve the DNS correctly.

Method:

PUT

Content Type:

application/json

Body:

["1"]

And accept etc. That body part decides what you put in D7 pin. Apparently this will make the led light up. Then you can define another IFTTT Applet to write ["0"] on the pin to turn it off.

IFTTT - Google Assistant Integration:

  1. First you need to get latest version of google assistant on your phone. I believe you need to have at least Marshmallow to make it work. It didnt work on my friend's KitKat. I had a Nougat rom on my Samsung Note 2 (N7100) Phone. To get it for your Android 6+ phone,

What you need To use the Google Assistant, you’ll need a phone with:

  • Android 6.0 or higher
  • Google app 6.13 or higher
  • Google Play services
  • 1.5 GB of memory and 720p screen resolution
  • Phone's language set to English. On Pixel phones, you can use English or German.

Turn on

  1. Open the Google app Google Search.
  2. At the top left of the Home screen, tap Menu Menu and then Settings and then Enable Google Assistant.

If these don't work for you, you can try the unofficial way from https://www.googleplayservicesapk.com/download-google-assistant-apk-for-marshmallow-nougat-lollipop/ (I got mine from there)

Once you get Google Assistant rolling, you can add it as an IF(trigger) in IFTTT instead of Widget Button we previously tested.

Congratulations, now you have your voice controlled light!

Possibilities are endless, you can put any trigger you like from IFTTT to turn on or off your light.

https://ifttt.com/google_assistant Also you can make google assistant do anything you want with your custom voice commands.

Ending note:

Everything is shiny and good looking, you have now become even more dependent to the Google botnet, Blynk arduino service and IFTTT botnet.

Theoretically any malfunction on these giant web services could take control of your home device intentionally or not.

Don't forget, nothing is free when it comes to these giant corporations, you either pay for the product or you are the product.

Google now knows when you turn on your light or not and is listening you.

Get GNU/Linux, Install gentoo etc.

@KingModest
Copy link

Webhooks service is not sending any web request, in IFTTT page on activity applet is failed and skipped

@Quantaindew
Copy link

I want my own private server (my wifi router and the iot products itself) to control my iot products, I want to create a private grid of iot devices, and then control it when I am connected to the grid via the wifi router and via the Internet (by a password or something)

@Quantaindew
Copy link

And I want to use my voice to control this system and with voice also

@fanaticjo
Copy link

saying esp not responding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment