Designing Smart Chatbot with IoT for home automation with videos (Hindi & English)




kunal verma

In this project, we will be using ESP8266 12e manufactured by Lolin to make a Chatbot that can control our home applications. To chat with our chatbot, we will use Facebook messenger platform. Also, we will integrate some AI into our chatbot using Chatfuel. It will then be integrated with IFTTT and Adafruit IO. Adafruit IO is linked to our ESP8266 at the hardware side. In a gist, the output pins of ESP8266 will be controlled through our Facebook Messenger Chatbot.

The project is amazing for those who want to integrate some AI into their IoT.

Complete Workflow of Chatbot with IoT

Complete Workflow of Chatbot with IoT

The Fig. 1 will give you some idea of the process we are up to in this project. The IoT and the Chatbot segments are developed separately. Then, we will merge these two to make our final Chatbot.

Material to get started:

  • ESP8266 12e NodeMCU manufactured by Lolin (Check the datasheet, if you are using a different version.)

ESP8266 12e by Lolin

ESP8266 12e by Lolin




  • USB Type C cable to program ESP8266 12e from a laptop or PC. Most Android phones use this type of cable.

USB Type C Cable

USB Type C Cable

  • Relay Module – Relay is an electro-mechanical switching device. In a relay, we can control switching AC or DC appliances digitally by providing input to relay input pins. Here we have used a 1-channel relay operating on 5 Volts.

Channel Relay Module

Channel Relay Module

To connect your AC appliance, use the following connection with the Relay Module use the following connection. The Signal pin is IN.

Relay Connection

Relay Connection

With some wires and breadboard.

READ  Making the TFF: a dress that gets excited when tweeted

Back End Set-up:

  1. Set-up with Facebook Messenger:

We need a Virtual human to chat with. For this, we will create a Facebook Page.

Create a Facebook Page

Create a Facebook Page

To create a Facebook Page, click here and Get Started with Community or Public Figure. Fill your Page name and Category.

Fill the page details

Fill the page details

If you wish, you can even add a Profile Picture and Cover Page to it. You must also hide your Page name and do settings so that your page is not available publicly.

2. Set-up with Chatfuel Platform:

Go to Chatfuel Platform from here. Sign Up with the same Facebook profile you created the Page and go to the Dashboard and select “Create from Template” and then “Blank Bot”.

Create a Chatbot

Create a Chatbot

Now the Blank bot is created in the Dashboard and you need to connect it with the Facebook Page. So, click “Connect”.

Connect Bot

Connect Bot

Now Select the Facebook Page you want to connect with. Now you can start with the AI part of the Chatbot.

Go to Automate and edit the Welcome Message by changing the User’s First name.

Welcome Message

Welcome Message

Now Click the Default Answer and edit it in the same way. The default answer is replied for the commands not programmed in your Chatbot or for any unexpected error.

Default Answer

Default Answer

Now, we start adding Blocks. Blocks are the functions that will be executed on chat commands. Click on the + symbol to add these blocks. These functional blocks will hit the APIs of IFTTT server.

READ  $1.50 Arduino TV Annoyer

Add Block

Add Block

Create two blocks and rename them as Relay On and Relay Off. 

Select Relay On block and add a Text card to it. This text card is a reply that our Chatbot gives on performing this certain block.

 Add a Text Card

 Add a Text Card

You can edit this Text Card in your preferred answer. Do the similar settings for the Relay Off with Light Off message.

Edit this Text Card for Relay On

Edit this Text Card for Relay On

Now, click on Set Up AI (1) and select + ADD AI RULE (2) and fill the AI. This is the main set up of its AI.

Set Up AI

Set Up AI

Add its AI rules by written all permissible phrases a user can say (1) and reply with Blocks (2) and add the corresponding block (3). To add each phrase simply type the phrase and Enter.

Set Up its AI with the Rules

Set Up its AI with the Rules

We will leave it here. Further settings will be done after setup with IFTTT.

3. Set-up with Adafruit IO:

Adafruit IO serve is the IoT end. Here our ESP8266 gets connected with its server and executes our desired command. Go to Adafruit IO. Sign Up or Sign In to your Adafruit IO account.

 Adafruit IO account Set Up

 Adafruit IO account Set Up

After creating Adafruit, you should be taken to Adafruit Home Screen.

Now Select Feeds from hand menu and Click Action > Create a New Feed from the drop-down menu.

Create a new Feed

Create a new Feed

Give this any name you wish, I created “onoff”. Now, Go to Dashboards > Actions > Create a New Dashboard. Similarly name this one also, I named it “LightAutomation”.

READ  The Dryer Messenger using Arduino

Dashboard

Dashboard

And click on + “Blue +” on the Top right side of your Dashboard to create a new block.

Select “Toggle” Block.

Create a new block

Create a new block

Now, choose your feed and click “Next Step”.

Choose Feed

Choose Feed

Fill the block settings and “Create the Block”.

Block Settings

Block Settings

Now let’s merge everything with IFTTT.

  1. Set up with IFTTT:

Create an account on IFTTT (https://ifttt.com) by Signing Up with your same Google Account you are using in your phone.

Now go to My Applets > New Applet > Click “ + this “. Search for the service Webhooks and select it.

 Choose a Service – Webhooks

 Choose a Service – Webhooks

Select Request a Web Service and Fill the event name and Create Trigger.

Create a Trigger

Create a Trigger

After creating Trigger, we must fill the Action Service. For that click on + that.

If Webhooks Then

If Webhooks Then

Now, search for the Action Service Adafruit and select it.

 

 

Read More Detail: Designing Smart Chatbot with IoT for home automation with videos (Hindi & English)




Leave a Comment

*
= 4 + 6

(Spamcheck Enabled)

Read previous post:
How to build a plant monitor with Arduino
How to build a plant monitor with Arduino

As a preview of his latest book, Arduino Project Handbook: 25 Practical Projects to Get You Started, Mark Geddes takes...

Close
Scroll to top