I’m really starting to love my Arduino lately; After going through the basic tutorials and even making an LED cube, I was ready to tackle something much more complex. Luckily, speaking control over an Arduino project isn’t really as hard as I thought — here are three completely different approaches you can take.

Using OSX Automator and Speakable Items

One way to do this is to use the existing speech command utilities built into OSX; Setting up custom commands to run Automator actions is easy. (If you’re new to Automator, download our free PDF guide to automating your Mac!)

As for the Arduino code, we use a string buffer detailed in this Arduino forum thread — this allowed us to look up exact words in serial communication — without this I found type conversions between numbers , bytes and lines be problematic. Here is the complete Arduino code for listening to serial commands, although you will need to add your own commands and hardware to actually control the devices as this is beyond the scope of this Arduino project guide. If you are using relays, remember that they must withstand voltage 120-240V AC. Also, if you’re new to all of this, be sure to check out the Arduino manual for first turn.

Arduino projects

Then download this Arduino-serial utility which allows you to communicate directly with the Arduino from the command line or a shell script. Place this at the root of your user directory, then open a terminal session and type:

  сделать ардуино-сериал 

compile the package for your system.

Using this utility is quite simple, but for our purposes, start by typing

  ls /dev/tty.* 

to find out what port your Arduino (USB) is on. Then, to send a command, use:

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

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

Arduino speech control

One thing I found is that I had to «start» the Arduino by first sending the command with Arduino Serial Monitor and then everything worked fine. If anyone knows why this is so, I’d love to hear.

Then open Automator and create a new one Appendix . Find an action Run a Shell Script add it and paste it into the serial command to turn on the light.

Save it in a folder library/speech/Speakable Items with the words you want to run — in my case, «glows».

Arduino speech control

Then turn on voice commands in the settings panel Special abilities .

Arduino speech control

This guide is from 2009 still relevant but basically you want to include Global Speakable Items .

Arduino projects

Here is a demo of it all working.

Easy VR Shield (Hardware)

EasyVR is an optional hardware screen that first encodes pre-recorded speech patterns and then uses a hardware solution to match them. The setup is a little tricky, and each command only responds to one voice print, but it’s the most complete choice if you want a computer-independent project. The EasyVR Shield costs £35 from CoolComponents in the UK or $50 from SparkFun in the US. Here is a demonstration of the shield in action along with the coding process:

SiriProxy Via Ruby

If you have a Siri-enabled iPhone that has been jailbroken, Siri Proxy is a great way to use your phone’s voice recognition capabilities. SiriProxy is a Ruby application that listens for commands that are recognized and sent to Apple’s servers; add a way to communicate with Arduino and you have SiriProxy-Arduino . The only downside is that you have to upload a custom sketch to the Arduino that implements the Ruby API, so you either have to set it up or code everything in Ruby on the computer side.

Here are 3 unique ways to control any Arduino project with just one voice. Will you try to control your lights with your voice? Do you think you could use these ideas in another project? Let us know about it in the comments!

Похожие записи