Introduction: Voice Control Using Mac OS X and Arduino

Picture of Voice Control Using Mac OS X and Arduino

In this Inscrutable we are going to add voice control to Arduino using MAC OS X inbuilt feature of accessibilty and Voice recognition.

Here is the link of working System.

Led's are on table, Sorry for so reduced visibility of LED's.

Step 1: Installing Arduino-Serial Utility

Picture of Installing Arduino-Serial Utility

Download Arduino Serial Utility and Extract it in your home folder.

Use command in terminal:

make arduino-serial

List the Serial Ports available using command:

ls /dev/tty.*

Copy the port on which Arduino is connected

Step 2: Connections on Arduino

Connect a Green led on Arduino on 11 pin.

and Burn following code to Arduino

int Green = 11;

void setup()

{

pinMode(Green,OUTPUT); // declare the LED's pin as output

Serial.begin(9600); // connect to the serial port

}

void loop () {
val = Serial.read(); // read the serial port

if(val == '2')

{ digitalWrite(Green,HIGH);

}

if(val == '5')

{ digitalWrite(Green,LOW);

}

}

Step 3: Create a Application Using Automator

Picture of Create a Application Using Automator

Go to automator

Select to create a new application

Select Run a shell Script on left hand side.

and write these commands to the shell script.

While Writing these command do replace serial port names by yours which are copied in the first step.

The first command is to communicate using USB port.

and the second command is to communicate via Bluetooth Port.

Save it to applications folder.

For more detail on the commands refer this arduino-serial link.

Step 4: Create a Command in Accessibility.

Picture of Create a Command in Accessibility.

Go to dictation comands and create a new command as shown.

If Dictation is not available then you will have to download offline recognition. by checking the box of use enhanced dictation in Dictation and Speech Preferences.

Add Your command in What is say box.

and choose application to run on that command.

Step 5: Connect Arduino Via USB or Bluetooth.

Picture of Connect Arduino Via USB or Bluetooth.

For bluetooth just connect Rx of bluetooth pin to Tx pin on Arduino and Tx of Bluetooth to Rx of Arduino.

And VCC of bluetooth to 5V of Arduino and GNG To Any GND on Arduino.

Now pair your bluetooth in settings.

I pairing fails then you will have to check password of your bluetooth in advanced settings.

For USB just plugin Your Arduino.

Step 6: Running Voice Recognition.

Picture of Running Voice Recognition.

For Accessibility short cut.

By default we need to press fn key twice.

A listening mic will appear as shown now say your command.

And bingo if every thing is right than it will Turn the Green led On.

Comments

nsiccuotlta (author)2016-05-21

Hi Rajat,

I'm trying to get your tutorial to work but for some reason when I run my script and then run my Arduino code, it doesn't pass the correct value to val. I don't know where it gets -1, but that's what it prints in the serial monitor. Any ideas? Thank you so much!

nsiccuotlta (author)nsiccuotlta2016-05-21

I should add that I've tried both .tty and .cu as the port in my Automator script. I'm very new to Arduino and Automator by the way!

fzahiri (author)2016-04-03

So what change do you make to the C++ code to turn the LED light off?

fzahiri (author)fzahiri2016-04-03

Actually I understand the on/off using the commands. I'm struggling working individual lights without uploading a different program

tym3k (author)2015-06-30

Nice! Do you also know how to use the -r function? I would like to send and receive data from my arduino and display it in a mac app.

RajatV (author)tym3k2015-07-01

Go to arduino-serial link in third step, there you will get detailed Guideline.

RajatV (author)tym3k2015-07-01

./arduino-serial -b 9600 -p /dev/cu.usbserial -r

This will get serial data from arduino to your terminal.

DIY Hacks and How Tos (author)2015-06-28

Cool project. Thanks for sharing.

Thankyou

About This Instructable

3,365views

22favorites

More by RajatV:Voice Control Using Mac OS X and Arduino
Add instructable to: