Voice Control the Arduino With Windows 7's Speech Recognition

14,979

63

17

About: A new maker around, so new instructables are still in progress ☺.

Intro: 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!

Share

    Recommendations

    • Audio Contest 2018

      Audio Contest 2018
    • Tiny Home Contest

      Tiny Home Contest
    • Furniture Contest 2018

      Furniture Contest 2018

    17 Discussions

    0
    None
    AgungB

    3 years ago on Introduction

    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

    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.

    3 replies

    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.

    0
    None
    ankit.antony

    3 years ago on Introduction

    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

    5 replies
    0
    None
    ankit.antonynupity

    Reply 3 years ago on Introduction

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

    Untitled.jpg
    0
    None
    nupityankit.antony

    Reply 3 years ago on Introduction

    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

    0
    None
    ankit.antonynupity

    Reply 3 years ago on Introduction

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

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

    0
    None
    nupityankit.antony

    Reply 3 years ago on Introduction

    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

    0
    None
    ankit.antony

    3 years ago on Introduction

    help in any form would be appreciated.

    ankit.antony@gmail.com

    pls do help .. n hats off to ur support

    0
    None
    pelegren

    3 years ago on Introduction

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

    0
    None
    strimpel

    4 years ago on Introduction

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

    1 reply