Introduction: Voice Control the Arduino With Windows 7's Speech Recognition
First, I'm sorry for any spelling or grammer mistakes that you may find here, as English isn't my native language.
I made this instructable because I haven't seen one that focuses on this subject, so I wanted to share this method. This method is very easy and can be used in both simple and complicated projects.
By the way, this is my first instructable, so wish me good luck!
This is an example I made - My Arduino Uno (with Ethernet shield) and two LEDs.
Watch in Full HD!
Step 1: The Need for Ingredients
What we will need for this instructable:
- PC microphone
- A PC running windows 7 (maybe 8 will also work).
- An Arduino.
- Microsoft Visual C# studio (I'm using 2010 edition).
Also, install now "Windows Speech Recognition Macros" from here.
Step 2: Between Them (C# Code)
So how does it work?
The speech recognition detects our trigger and then it opens a c# script that sends data to the arduino by serial communication.
Lets make our script:
1. Open Microsoft Visual C# Studio.
2. Go to File, then "New Project".
3. Choose "Console Application" and press OK.
4. Remove the default code and paste our code.
*Notice that you may need to change that port in the code (COM5) to the port your Arduino is connected to. Check your port in the Arduino software under Tools>Serial Port.
*Change the "1" to whatever you need.
5. Save the project and press "start debugging" (green triangle).
6. Go to project's folder, ConsoleApplication1, bin, debug, and copy "ConsoleApplication1.exe" to somewhere you will be able to find it later. This is your little program/script.
Repeat those steps for every data you want to send.
Step 3: Arduino's Side
Now that we know what our C# code sends to the Arduino, we can make a code that will do something with those serial messages.
This is a simple code. For this code you will need one exe that sends "1", and one that sends "0".
Connect a LED to pin 3.
Upload the code to the Arduino and test it with our C# programs from the last step (by debugging or our exe's from the previous step).
It should work. If it doesn't - you can send a message with the problem.
Step 4: The Real Fun! (Voice Commands)
If everything is working as it should work, you can start with the voice commands. (If not, you can send a message with the problem).
1. Connect your microphone to the PC.
2. Install Windows speech recognition macros (if you haven't done it before).
(2.5. recommended: do "Set up microphone" from Control Panel > Speech Recognition)
3. Start "Speech Recognition" (Control Panel>Speech Recognition>Start Speech Recognition).
4. Start "Windows speech recognition macros".
5. Press right mouse on "Windows speech recognition macros" icon and then "New speech macro".
6. Choose "Run a program".
7. Enter a phrase that will turn on the led. Browse for the right EXE from STEP 2.
8. Click NEXT and Create.
*For some reason I can't digitally sign, don't know why.
Step 5: All You Need Is Check...
Now all you need is to try the voice commands you made. If, for some reason, you didn't succeed, you can send a message.
This is just the base, upgrade as much as you can!
I made an example video with 2 LEDs, watch in Full HD!