Introduction: Home/Lab Voice Controlled Assistant
Hello! This is my first instructable , I am 17 year old. I am from Greece so my English may not be perfect but I shall do my best. So, I firstly designed this app 2 years ago and I found this contest an opportunity to update my old project.
Step 1: Core, the Voice Controlled Assistant
Basically, Core is a voice controlled application developed with Visual Studio using the C# language. Core controls both the computer and some Arduino boards to make it even more useful for a home or a lab. This tutorial is not gonna teach you how to program with Visual Studio or Arduino. The goal of this, is to help you develop your own voice controlled assistant given that you already have some experience on programming. There are numerous applications this project can be used to. I am gonna show you some basic applications since most of the possibilities that can be reached are out of my budget. The good news are that I am gonna explain some of this extra "abilities" that can be added to this project. In this tutorial I am gonna show you how to make Core play music playlists, tell the hour and the weather, open applications like the browser, games or a specific link like youtube, turn on/off the lights, shutdown the computer and last but not least control a simple diy power supply unit which I am gonna explain how to build. So let's begin!
Step 2: Visual Studio's Libraries
The most important part of the code are the libraries. If I am right every single library that I am using is already embedded to the Visual Studio itself. Let's move to the variable section!
Step 3: Visual Studio's Variables
First of all, we have to set the basic variables which are the Media Player for the music and the voice recognition and synthesis. After we have set them we can move to the others. We need a bool that will enable and disable the voice recognition, a variable that will store the time some others for the weather and one to control the PSU's status! Then... we are actually gonna store every single voice command as strings... You really wanna write them as you hear them not the way they are actually written just to make it easier for the microphone to understand you, on the other hand if you have a good mic you do not actually need to write "cor" instead of "core" or "of" instead of "off". We can now go on to the voice synthesis!
Step 4: Voice Synthesis
It would be really friendly to have a welcome message from your assistant when she opens. So here it is! To do the voice synthesis we need a prompt builder. After setting the builder up we need to start a sentence. Once we have made the sentence we are ready to write what we want our welcome message to be. Then we must simply end the sentence and tell the program to say what we wrote! So instead of repeating every time the same process we can create a void. We will refer to this void every time that we want to make the application talk.
Step 5: First Interaction With the Program!
It's time to make Core "alive"! Basically, what we will firstly make is, once you call her name she will respond to you and wait for your command. Also we want to have a "thanks" command to tell her that we do not need her anymore. By the way, the command "VoiceSynthesis(string)" is actually the void that we created before to save time. Once we call this simple line of code we can make her tell whatever we want!
Step 6: Learn Her Close Herself, Tell You Her Status and Shutdown the Computer
This part of the code is pretty simple I do not think that any extra explanation is required since the code can be understood easily.
Step 7: Make Her a DJ
So you can create a simple Windows Media Player Playlist! Yeah! That's it! Just give her the location of the playlist and enjoy the music! Kinda... You have to set a new void first to explain her how to play the music... But after that it is pretty simple!
Step 8: More Uses!
This part of the code is too simply to explain! If I try to explain it I will probably make it more confusing
Step 9: Make Her a Meteorologist!
This part of the code is kinda big... So this part of the code is actually taking the data from a weather forecast web site and saving them to the string variable "weather". You can find the part that says "Mandra, Greece" and replace it with your own. Just to make it clear it is "Town, Country". The temperature is actually counted to Fahrenheit, but I am used to Celsius so I am converting it, you can remove the variables that contains the name "Celsius" and replace them with the ones with the name "Degrees".
Step 10: Are You Bored to Turn the Switch on or Off? Problem Solved!
Soooo! One of the most important and useful parts of a home assistant! A fast way to make the switch work both manually and automatically is a servo! I did not want to use a wire from my computer to the switch since the distance was kinda long... I solved this problem using a simple IR receiver and transmitter. I am sending a signal from an arduino connected to Core to another arduino that controls the servo.
Step 11: The Power Supply Unit
It's a pretty simple application! You are using any 12V AC/DC Adapter with a relay controlled by Arduino! Then you connect the 5V and 3.3V of the Arduino board to two other relays and poofffff your PSU is ready to go!
Step 12: Going Further
You can use an android to computer microphone application like WO Mic to control the program from other rooms just by talking to your smart phone!
Step 13: The Robotic Arm
You can also buy a robotic arm. The arm can be used to give you tools when you ask for them. Just store the rotation of the servos to the arduino code and via serial port control it from the Core... Unfortunately, such an application was out of my budget...
Step 14: Thanks!
If you need any support, if there is something that you would like me to explain to you or you wanna help me improve this instructable page just let me know to in the comment section! Thanks for you time, have a nice and creative day!