The code links are at the bottom.
The Smart Table shown in the prevous post was quite nice, but it was something for “fun” and not something I can use for my day-to-day life.
I had an idea. I always had trouble in some of my lessons, especially 2nd and 3dh language lessons in school. I did not know the meanings of a lot of things, and it was always a trouble to translate it every 5 mins. So i though that I should make a simple voice assistant that would just translate sentences to a desired language.
I had done this previously when I made a messenger bot , which was quite impractical for a 1 to 1 conversation, but if the bot added in a group was very helpful. It was a hobby project. one of the functions it offered was “translate”, all you had to type to the bot was “\translate <text> <destination_lang>” for e.g. “\translate this is a pen polish.”
I just had to do something pretty similar.
So first I used the voice recognition library for python and initialized it. Then stored the text it listened from the mic to variable <string> with name “cmd”.
then i used an if statement to check if, what i said started with “translate”. If it did, I saved the text after “translate” to a variable , then i took the last word from the orignal text i said, which would be a language name. Then i’d delete the last word from the toTranslate Variable as that was the language name.
if cmd.startswith("translate"):
toTranslate=cmd.split("translate ",1)[1]
toLang=cmd.split()[-1]
toTranslate=seperator.join((toTranslate.split(" ")[:-1]))
I just passed the toTranslate and toLang variable to the “translate” library.
The next problem I encountered was that I was not able to use my mic in 2 places (the script and my online lessons) and if i did try to use it, the script would be prioritized and it would turn of my speakers off also. So using a wake word was also out of the window as that required constant mic attention.
So what I did was , i had a infrared sensor and attached it to the bottom of my Desk, so I can use my leg as a trigger to activate the voice assistant and so my speakers won’t work only for a second or two. I attached it to my arduino.
So that was done, it was very easy, i thought i might as weel add a few more functions.
So these are the funtions I added:
- Google Search
- Website open
- Synonym finder
- English Dictionary
- Calculator
- Smart Table Led Color changer (supported colors are : red, blue, green, magenta, yellow, and cyan)
- a simple repeat afte me
- and a “close tab” function , which would emulate CTRL+W .
These were all that I needed. And I just use if/elif/else statements as the functions had to be limited and an ML model would be overboard and impractical.
Currently I am working on more fuctions that would automate a few things.
The link to the code: https://github.com/hriday111/Arduino_Smart_Table
2 thoughts on “Voice Assistant Extention for “Smart Table””