The idea is to program your computer to recognize some keywords that will activate the scanning process automatically, this is done by controlling your mouse automatically, like a mouse bot.

Windows speech recognition SDK allows for speech recognition applications to be developed.

Instructions:

- Install skanect

- Install Microsoft speech tool-kit

- Install visual studio

- Open the voicerecognition project (attachment)

The code recognizes the keywords and sends commands to the COM port connected to the Arduino via Bluetooth.

Change the COM port to match the Bluetooth port, change the path to the skanect software, and finally run the program.

Now you just need to position your self on to the rig and say "start skanect" for the scan to begin. The mouse will move by it self, make necessary adjustments to the coordinates of the mouse if necessary. The scan takes 60 seconds, make necessary adjustments if necessary.

You can also change the speed of the turntable by using the following voice commands:

- spin motor faster

- spin motor slower

For safety you can also turn the motor off and on by using the following keywords:

- turn motor off

You also have the option to change spin direction using the following keywords:

- turn motor right

- turn motor right

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Windows.Media.Animation; using System.Speech.Recognition; using System.Speech.Synthesis; using System.Runtime.InteropServices; using System.IO.Ports; using System.Threading; namespace VoiceRecognitionGame { public partial class MainWindow : Window { private SpeechSynthesizer _synthesizer = new SpeechSynthesizer(); [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] public static extern void mouse_event(uint dwFlags, int dx, int dy, int dwData, int dwExtraInfo); const int MOUSEEVENTF_MOVE = 0x0001; //moving the mouse const int MOUSEEVENTF_LEFTDOWN = 0x0002; //the analog left mouse button is pressed const int MOUSEEVENTF_LEFTUP = 0x0004; //the analog left mouse button lift const int MOUSEEVENTF_RIGHTDOWN = 0x0008; //simulate a right mouse press const int MOUSEEVENTF_RIGHTUP = 0x0010; //simulate a right mouse lift const int MOUSEEVENTF_MIDDLEDOWN = 0x0020; //simulate a middle mouse button is pressed const int MOUSEEVENTF_MIDDLEUP = 0x0040; //simulate a middle mouse button lift const int MOUSEEVENTF_ABSOLUTE = 0x8000; //marked the absolute coordinate public SerialPort serialPort = new SerialPort(); public float speed = 0; public float direction = 1; private SpeechRecognitionEngine _recognizer; public MainWindow(){ InitializeComponent(); _recognizer = new SpeechRecognitionEngine(); _recognizer.SetInputToDefaultAudioDevice(); Choices choices = new Choices("spin motor slower", "turn motor off", "spin motor faster", "turn motor right","turn motor left", "start skanect"); GrammarBuilder grBuilder = new GrammarBuilder(choices); Grammar grammar = new Grammar(grBuilder); _recognizer.LoadGrammar(grammar); _recognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(_recognizer_SpeechRecognized); _recognizer.RecognizeAsync(RecognizeMode.Multiple); serialPort.BaudRate = 9600; serialPort.PortName = "COM12"; // Set in Windows serialPort.Open(); // WRITE THE INCOMING BUFFER TO CONSOLE //while (serialPort.BytesToRead > 0) // { // Console.Write(Convert.ToChar(serialPort.ReadChar())); // } // SEND //Thread.Sleep(500); } void arduino_write(float spd) { if (spd == 0) serialPort.Write("s00"); if (spd == 1) serialPort.Write("s01"); if (spd == 2) serialPort.Write("s02"); if (spd == 3) serialPort.Write("s03"); if (spd == 4) serialPort.Write("s04"); if (spd == 5) serialPort.Write("s05"); if (spd == 6) serialPort.Write("s06"); if (spd == 7) serialPort.Write("s07"); if (spd == 8) serialPort.Write("s08"); if (spd == 9) serialPort.Write("s09"); if (spd == 10) serialPort.Write("s10"); if (spd == 0 ) serialPort.Write("s00"); if (spd == 1 ) serialPort.Write("s01"); if (spd == 2 ) serialPort.Write("s02"); if (spd == 3 ) serialPort.Write("s03"); if (spd == 4 ) serialPort.Write("s04"); if (spd == 5 ) serialPort.Write("s05"); if (spd == 6 ) serialPort.Write("s06"); if (spd == 7 ) serialPort.Write("s07"); if (spd == 8 ) serialPort.Write("s08"); if (spd == 9 ) serialPort.Write("s09"); if (spd == 10 ) serialPort.Write("s10"); } void _recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e){ output1.Clear(); output1.AppendText(e.Result.Text); output2.Clear(); output2.AppendText(e.Result.Confidence.ToString()); if (e.Result.Confidence < 0.40) return; SpeechSynthesizer s = new SpeechSynthesizer(); switch (e.Result.Text) { case "start skanect": s.Speak("Yes Master, the application will start in a few seconds"); // System.Diagnostics.Process.Start("C:\\Program Files\\Skanect 1.5\\bin\\skanect"); //Thread.Sleep(10000); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); Thread.Sleep(5000); speed = 10; arduino_write(speed); Thread.Sleep(25000); speed = 0; arduino_write(speed); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); Thread.Sleep(1000); speed = 0; arduino_write(speed); break; case "spin motor slower": if (speed > 1) { speed--; speed--; } arduino_write(speed); break; case "turn motor off": serialPort.Write("s00"); // s.Speak("motor off"); speed = 0; arduino_write(speed); break; case "spin motor faster": if (speed < 9) { speed++; speed++; } break; case "turn motor left": // s.Speak("Have a nice day sir"); arduino_write(speed); direction = 0; break; case "turn right": // s.Speak("Have a nice day sir"); arduino_write(speed); direction = 1; break; default: break; } } } }