Hey techies, hope you all be exploring and making something new and if not, than you will definitely gonna learn something very interesting and latest topic of now i.e Personal Assistant. With techiesms, you’ll learn how this all assistants works and not only that, but we will also make our own little assistant which is still in learning age with the help of ESP8266 12E board and having a name ESPSMS. So lets get started……
How this all works?
If you are a regular reader or subscriber of techiesms, you definitely know how this all works because in our articles and projects, we somehow used this technique which all other companies uses for making their assistants responsive. Remembered that technique?????
Yeah!!!! this is the technique which make all the assistants responsive. And the heart of this technique is API(Application Program Interface). With API, we can get the required data from the database or server and hence we can fetch that data through our WiFi module easily. If you don’t know what an API is let me tell you in a very simple manner. Because I also explored many website to know what exactly a API is but no one explained it in a simpler manner. So I tried to simplify API in one sentence.
API :- Comparing API and HTML, In HTML we request an link and get the whole html page along with our required data,advertisements,images,videos,forms,and much more. While in API, we request a link and just get the required precise data we want in response.
How this all started
When I was making my project Alexa on your Pi, I got an Image regarding how Alexa works. Here is that image,
If you observer this code, you’ll definitely come to know the secret. And the secret is API. Alexa first converts our voice into text and request that string to the server which will analyse the words in that string and accordingly request the appropriate API for that and will send the response in form of string and after that the string is converted into voice. That’s,it.
And this is how all the assistant works, The only difference between the assistant from different companies is their database from where the data is fetched. Hence some assistant can respond to every questions while some can respond to only few questions as their database doesn’t contains the answer for rest of the questions. And also they have algorithm of Machine Learning through which their assistant automatically learns from the questions. Our assistant lack this algorithm.
We gonna do the same steps to make our own assistant. But don’t worry, you don’t need to get your server,database or anything like that because we are making this just for upgrading our knowledge not for selling purpose.
So now you learned about how assistant works, so let’s start making our own assistant.
How to make our own Assistant
I chose ESP8266 12e board for making this, you can even use esp8266 01 along with Arduino Board, Raspberry Pi board or any other board which have a Internet connection. You can eve use you smart phone and make an app using this same logic. Hence I told in my intro video that “this video series is not only for techies but app developers will also get benefited“.
Note: Before going into this project, follow this video on Getting started with ESP8266 12e board. Here you will get the necessary libraries to work with ESP 12e.
After this, we need to make API and need to call the API according to the questions asked.We can make our own API with a great wesbsite called thingspeak.com. I have already made a tutorial videos and wrote blogs on making API using Thingspeak. So explore my website and YouTube channel to know how to make API.
Let’s put the process in step wise manner.
Connect your ESP to internet
First in the code, you need to connect you ESP with the router by attaching you wifi SSID name and password. So that the board can communicate with the internet.
Read the String and Convert all the characters in Lower form
In this step we will read the string from the Serial Monitor and than we will convert all the characters in lower form. Why????
In the code, we are getting input string from the user and than we are finding some of the relevant words as to call particular API. So comparison function which I have used is case sensitive (I have used strstr(); function for comparison) so converting the string in lower form becames essential to reduce the number of comparisons.
Analyze the words, and call the relevant API
In this step, we will compare the words in the string with our words already attached in the code. Through this analysis we will get to know what user demands and accordingly we can call the relevant API.
Filtering the data in proper form
The response of API we get is generally in JSON format. We need to filter out some curly braces and all to make the data look neat. But again this is optional, if we don’t follow this step than also we would be getting the data on our serial monitor.
That’s it. Follow this four steps for every trick and with this you can make you own personal assistant. This is just the overview about making, from next blogs I’ll me writing about how to apply all the tricks using these four steps with the help of our ESP8266 board.
Join our community to get regular updates regarding techiesms
explore | learn | share