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.

Our code:

http://pastebin.com/Hxcv2Qix

*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.

http://pastebin.com/5gyEEiix

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!



Good Luck!

Comments

author
AgungB (author)2015-08-14

i've been looking for so many years just to make this project, well can you suggest me what sould i do now? i got speech recoginiton and been playing with this program for about a year ago, but i need to make it more and more real with arduino, can you show me about this? thanks

author
ВалентинД (author)2015-01-12

Its perfect, with little more complex work on this project, with your voice , you will be able to expand functionality of the arduino. But for now would you show how to wire the board and module to PC. What arduino module are you using.

author

I Used Arduino UNO. I don't think there are any schematics, you just connect your arduino to your PC and a led for example to the pin you set up in the code.

author
owen.liew (author)nupity2015-04-22

arduino mega uno 2560 or arduino uno r3 ? thx

author
nupity (author)owen.liew2015-04-22

arduino mega is not arduino uno

choose the mega if you need alot of pins

author
ankit.antony (author)2015-01-17

Nice project ... but i'm having trouble with some part ... c# coding n arduino works well but the speech recognition is where i'm getting trouble.. the computer recognizes the command but doesnt execute the program... i.e. it just prints console application1 but doesnt execute

author
nupity (author)ankit.antony2015-01-17

weird. did you start Speech Recognition and then Speech Recognition Macros?

Untitled.png
author
ankit.antony (author)nupity2015-01-18

yes... the exe file gets loaded and is displayed in the speech recognition display.. but it doesnt get executed

Untitled.jpg
author
nupity (author)ankit.antony2015-01-18

the error in the background seems like the port in your code isn't the port the arduino is connected to. In the code change where it says "COM5" to your port

author
ankit.antony (author)nupity2015-01-18

:( sad but it works wel without the speech recg. part..

which means i'm having some error with the macros maybe

author
nupity (author)ankit.antony2015-01-18

That is pretty weird...

Did you set up the macro like I described?

If you want I can try to upload one of my scripts/compile yours and upload the file

author
ankit.antony (author)2015-01-17

help in any form would be appreciated.

ankit.antony@gmail.com

pls do help .. n hats off to ur support

author
pelegren (author)2014-12-06

this is cool thing to explore.. please provide the schematic or picture of how things were connected. thanks.

author
strimpel (author)2014-06-11

the windows speech recognition marco dont work for me is my pc must be in english editon ?

author
nupity (author)strimpel2014-06-11

Does the Speech Recognition recognizes in English?

author

Cool project!

author

Thank you :)

About This Instructable

13,889views

63favorites

License:

Bio: A new maker around, so new instructables are still in progress ☺.
More by nupity:Voice Control the Arduino with Windows 7's Speech Recognition
Add instructable to: