3 Ways To Add Speech Control To Arduino Projects

James Bruce 13-02-2013

arduino projectsI’m really starting to love my Arduino lately; having gone through the basic tutorials and even made an LED cube, I was ready to tackle something far more complex.  Fortunately, speech controlling an Arduino project really isn’t as complex as I’d thought – so here are 3 distinctly different approaches you can take.


Using OSX Automator and Speakable Items

One way we can do this is utilizing the existing speech command utilities built into OSX; setting up custom commands to trigger Automator actions is simple. (If you’re unfamiliar with Automator, download our free PDF guide to automating your Mac The Awesome Automation Guide for Mac Users Whether it's sorting your email, searching your documents or building a playlist, you'd be amazed how many tasks can be done automatically instead of manually - if only you knew how to get started. Read More !)

On the Arduino code side, we’re making use of a String buffer detailed on this Arduino forum thread  – this enabled us to search for exact words in the serial communication – without this, I found the type conversions between numbers, bytes, and strings to be problematic. Here’s the full Arduino code for listening to serial commands, though you’ll need to add your own commands and hardware for actually controlling the devices, as that’s out of the scope of this Arduino project tutorial. If you’re using relays, remember they need to be able to handle 120-240vAC.  Also, if you’re new to all of this, make sure to check out our beginner’s Arduino guide Getting Started With Arduino: A Beginner's Guide Arduino is an open-source electronics prototyping platform based on flexible, easy-to use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments. Read More first.

arduino projects

Next, download this Arduino-serial utility which enables us to communicate directly with the Arduino from the command line or shell script.  Place this in the root of your user directory, then open up a Terminal session and type:

make arduino-serial

to compile the package for your system.


Usage of this utility is fairly simple, but for our purposes, begin by typing

ls /dev/tty.*

to figure out which port your Arduino is on (the USB one). Then to send a command, use:

./arduino-serial -b 9600 -p /dev/tty.usbmodemfd13411 -s lightsOn

Replace /dev/tty.usb~ with the exact name you found for your USB port connected to the Arduino. Refer to the original page for more usage examples including getting a return value, but this will do for now.

arduino speech control


One thing I did find is that I had to “kickstart” the Arduino by sending a command using the Arduino Serial Monitor first, then everything worked fine. If anyone knows why this is the case, I’d love to hear.

Next up, open Automator and create a new Application. Find the Run a Shell Script action, add it, and paste in the serial command to turn the lights on.

Save that to the library/speech/Speakable Items folder with the words you’d like to trigger the action – in my case “lights on”.

arduino speech control


Then, enable speakable commands from the Accessibility preferences panel.

arduino speech control

This tutorial from 2009 How To Use Speech Commands on Your Mac Read More is still relevant, but basically you want to enable the Global Speakable Items.

arduino projects


Here’s a demo of it all working.

Easy VR Shield (Hardware)

EasyVR is an add-on hardware shield that first encodes your pre-recorded speech samples then uses a hardware based solution for pattern-matching them. The setup is a little complicated, and each command only responds to a single voice imprint, but this is the most comprehensive choice if you want the project to be computer independant. The EasyVR Shield costs £35 from CoolComponents in the UK, or $50 from SparkFun in the US. Here’s a demo of the shield in action along with the encoding process:

SiriProxy Via Ruby

If you have a Siri capable iPhone that’s been jailbroken, Siri Proxy is a great way to harness the voice recognition capabilities of your phone. SiriProxy is a Ruby app that listens in on the commands being recognized and sent to Apple’s servers; add in a way to communicate with Arduino, and you have SiriProxy-Arduino. The only downside is that you need to upload a special sketch to the Arduino that implements a Ruby API, so you’ll either need to adjust that, or code everything in Ruby on the computer side.

There you have it – 3 unique ways to control any Arduino project with your voice alone. Will you try voice controlling your lights? Do you think you could make use of these ideas in another project? Let us know in the comments!

Related topics: Arduino, Speech Recognition.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Anonymous
    August 4, 2015 at 7:54 am

    I am very new to Arduino projects but I am trying to find a way to have my arduino Uno board trigger a servo when nI speak a specific made up word. This si for a scavenger hunt I am involved i and only have a couple days to get it to work. Would your first option using the mac or for this? I don't fully understand al the directions since it is a bit over my head but I can probably follow along if the directions are 100% . any thoughts on this? thanks guys

    • James Bruce
      August 4, 2015 at 7:57 am

      Easiest route would be the Mac, but I think it needs a keyword first, like "computer" to wake up and start listening. I might be wrong though, been a very long time since I did this. Have a go!

  2. ishaan nimkar
    June 29, 2013 at 4:43 am

    hey, i copied the file to the root of my user folder (MacintoshHD/Users/Ishaan/arduino-serial)
    i then went to terminal and typed " make arduino-serial" and it gave me this message "-bash: make: command not found"

    what have i done wrong or what can i do to fix it

  3. Nevzat Akkaya
    February 14, 2013 at 7:12 am

    this user should be banned! I think there should be a button for reporting spam comments.

    • Tina Sieber
      February 14, 2013 at 9:41 am

      The spam was removed. They find ever new ways to circumvent our filters. A spam button is a good idea. We've tried it before, might have to introduce it again. Thanks for the suggestion!

      • Nevzat Akkaya
        February 14, 2013 at 9:59 am

        Thanks you too :)