Integrating Google Assistant with Internet of Things can make our IOT based devices more smarter. It gives voice to our IOT devices with the power of Artificial Intelligence, Natural language understanding & many more.
Project Demo of IOT with Firebase:
IOT Overview:
In this tutorial i will give overview of all steps we need to follow for creating IOT based device that can be controlled via Google Assistant.
What’s different from other posts on Internet ?
On Internet you can find many tutorials which shows IOT home automation using google assistant. But most of them uses private vendor Apps & APIs like Adafruit, Blynk, IFTTT.
All stated above have some basic functionality only. Here we can’t customize our chat bot (to be integrated in Google Assistant) according to our requirements. In our project we are using Google Firebase, Dialog Flow & actions on Google. Best thing here is all 3 are Google products, using Dialog Flow we can customize our chat bot according to our needs. Additionally, there is no need to create a android app, we can directly use android device google assistant to control smart device.
Steps below follows the video to help:
If you like videos like this consider donating $1, or simply turn off AdBlocker. Either helps me to continue making tutorials
Hardware Setup :
Hardware Required :
1. Firstly, Arduino Node MCU – buy which have 5v pinout only, else relay need external supply
2. Secondly, 5v Relay Module
3. Thirdly, Jumper Wires
4. Fourthly, Breadboard
5. Lastly, LED (for testing purpose)
Circuit Diagram:
Connect Arduino D2 pin to relay input, Arduino 5 VCC & GND to relay VCC & GND respectively.
Do other connections exactly as shown in diagram given below.
Connecting Arduino with Firebase:
For connecting arduino nodemcu with firebase realtime database we need to use Firebase Arduino Library, setting up this library has been done in previous tutorial check out here.
Transcript / Cheat Sheet :
Setting Up Dialog Flow/Api.ai agent :
Go to https://dialogflow.com/ and login with same credentials you are using for firebase console.
1. Create a New agent : Type agent name and click create button.
2. Go to Entities Tab : Here need to create 2 custom entities, 1 for lights off and other for light on.
2. Go to Entities Tab : Here need to create 2 custom entities, 1 for lights off and other for light on.
For entity @on :
Entity Name : on
Enter Reference Value : 1
Enter Synonym: TURN ON; POWER ON; SWITCH ON;
For entity @off :
Entity Name : off
Enter Reference Value : 0
Enter Synonym: TURN OFF; POWER OFF; SWITCH OFF;
Enter Reference Value : 0
Enter Synonym: TURN OFF; POWER OFF; SWITCH OFF;
3. Now we are done with setting up custom entities, Let’s create an Intent – Go to Intent Tab & click create Intent button.
- Type Intent Name : Light Control
- Now Go to training phrases option and type given below phrases.
Tip : More Training Phrases you type, more intelligent you chat bot will be.
OK Google turn off the lights
OK Google turn on the lights
turn on the lights
switch on lights
power on lights
turn on lights
turn off lights
switch off lights
i want to turn off light
i want to power off light
- Once done with all training phrases, you action and parameters table should look like :
REQUIRED | PARAMETER NAME | ENTITY | VALUE | IS LIST | |
---|---|---|---|---|---|
|
@on | $on |
|
||
|
@off | $off |
|
- Now at bottom you will find Fulfillment option, here choose enable web-hook call for this intent.
- That’s it we are done with setting up Dialog Flow agent, click on save button and start training your agent, once agent training completed we need to switch to fulfillment tab.
Let’s cover Fulfillment and Firebase tools part in next Post.
If you guy’s facing any issue feel free to comment out, i will try to sort it out as soon as possible.
is it will reconnect again and again if wifi off and on after?
Thank you so much , your video very useful
i m really glad to help you out 🙂
yes sure, code includes a infinite loop for that
Can this be done using an Arduino Uno or Nano as well?
If so, what are the changes that should be made to the code?
can this be ON and OFF with a single entity name like switch and dialog like switch on, switch off?
Nice project, can you post for multiple device control?
estoy tratando de resolver eso, pero por lo que veo si se puede, osea que solocambia de 0 a 1 en un mismo nombre de firebase si es asi creo que si.
Could you provide me with a API v2 compatible index.js?
Getting this error in Serial monitor
connected: 192.168.31.5
Exception (28):
epc1=0x4021509e epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000
>>>stack>>>
ctx: cont
sp: 3ffffda0 end: 3fffffc0 offset: 01a0
3fffff40: 3ffeff28 4020fb10 3fffff8c 40205a6e
3fffff50: 00000100 3ffeec08 00000000 3ffeed58
3fffff60: 3fffdad0 00000000 3ffeeba4 40205b9e
3fffff70: 3fffdad0 00000000 3ffeeba4 40201126
3fffff80: 00000000 00000000 ffefeffe 00006e6f
3fffff90: 00000000 00efeffe feefeffe feefeffe
3fffffa0: feefeffe 00000000 3ffeed28 40206a80
3fffffb0: feefeffe feefeffe 3ffe8578 4010054d
<<<stack<<<
Great post!
I haven’t known about it before. This article is very helpful!
Thank you so much! home automation in abu dhabi
Gathering Room Projectors are principally used to give introductions and reports in meeting rooms for the most part. fixed projector screen
Fantastic blog you have here. You’ll discover me looking at your stuff often. Saved! flexible track lighting
Getting this error in Serial monitor
connected: 192.168.31.5
Exception (28):
epc1=0x4021509e epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000
>>>stack>>>
ctx: cont
sp: 3ffffda0 end: 3fffffc0 offset: 01a0
3fffff40: 3ffeff28 4020fb10 3fffff8c 40205a6e
3fffff50: 00000100 3ffeec08 00000000 3ffeed58
3fffff60: 3fffdad0 00000000 3ffeeba4 40205b9e
3fffff70: 3fffdad0 00000000 3ffeeba4 40201126
3fffff80: 00000000 00000000 ffefeffe 00006e6f
3fffff90: 00000000 00efeffe feefeffe feefeffe
3fffffa0: feefeffe 00000000 3ffeed28 40206a80
3fffffb0: feefeffe feefeffe 3ffe8578 4010054d
<<<stack<<<
Home Automation
People are installing home automation systems because of their immense benefits. In an automated home, every appliance/gadget such as thermostats, lights, cameras is linked with a controllable network.