Control your Arduino with voice commands using an Android smartphone! Before we make a voice activated home automation system, we must first learn the basic principles of the experiment. This guide will let you command the Arduino using your Android smartphone and a HC-05 Bluetooth module.

The designer of the app did not include a sample code. I looked for alternatives in Google's PlayStore but none was as good as the app that I've found. Luckily, I was able to figure it out although it took me a while to program it. Sorry IOS users, this app isn't available in Apple's app store :/

How Does It Work?
Have you ever encountered Android's speech recognition? Yes android has one and you can use it to control your Arduino, via Bluetooth. The App works by pressing the mic button, then the it will wait for you to say a command. The app will then display the word's that you've stated and will send data strings for the Arduino to process.

Home Automation System (on July 4, 2014):
A month from now/ I'll be releasing a highly sophisticated home automation + security system. It's my biggest project ever! Our current agenda is to program a better smartphone app that work's like Siri (talks back) and sends strings (data types) to the Arduino via bluetooth. If you want to take a sneak peek of the project and it's concept, kindly skip to the last step. The prototype that I'm working on now is composed of a network of wireless switch boxes that connects to a main control panel via WiFi/ Bluetooth.

Here's A Quick Video Demo:

Step 1: Parts & Materials

If your having trouble in finding them, I'm sure RadioShack has all of them. If you want to buy online try searching on Amazon or DealExtreme.

Thing that you'll need:
- 5 LED Indicators (the color of your choice)
- Arduino UNO (a clone works fine)
- HC-05 Serial Bluetooth Module
- Solderless Breadboard
- Jumper Cables


<p>Works perfectly. I have plans to use this in my living room.</p>
Ok sir thanks alot
<p>hey dude can u give me the sample codes? I have problem with error in my codes and what code language do you use????? thanks.:)</p>
Hello RaylinP,<br>The code is edited in and uploaded from the Arduino software. Also known as the Arduino IDE (integrated development environment) and the video and the Instructable article is where I found the information. I did manage to add two more relays to my copy of the Arduino software (sketch) for a total of four. <br>Here is the Instructable: <br>http://www.instructables.com/id/Arduino-Home-Automation-Bluetooth/<br>and his Youtube video:<br>https://youtu.be/ecPbeIkFHxQ?list=PLLS_feeVWGq-LMUirPsmULI0Tl4721JLe<br>So if I can help you with anything let me know.<br>David Connolly,<br>volthaus lab
<p>My voice controlled Arduino/4 relay sketch is at:</p><p>http://volthauslab.com/sketchs/FourRelayVoiceControl/HomeAutomationVH4.ino</p>
<p>Sir , David Im so thankful for considering my question and giving some of your time just to reply me, I greatly appreciate it, :) and can I ask 1 more thing? when you try with the code of Sir. Angelo Casimero does the code work? or having some error? thank you very much! :)</p><p><br><br>credits to Sir Angelo Casimero :)<br>String voice;</p><p>int<br>led1 = 2, //Connect LED 1 To Pin #2<br>led2 = 3, //Connect LED 2 To Pin #3<br>led3 = 4, //Connect LED 3 To Pin #4<br>led4 = 5, //Connect LED 4 To Pin #5<br>led5 = 6; //Connect LED 5 To Pin #6<br>//--------------------------Call A Function-------------------------------// <br>void allon(){<br>digitalWrite(led1, HIGH);<br>digitalWrite(led2, HIGH);<br>digitalWrite(led3, HIGH);<br>digitalWrite(led4, HIGH);<br>digitalWrite(led5, HIGH);<br>}<br>void alloff(){<br>digitalWrite(led1, LOW);<br>digitalWrite(led2, LOW);<br>digitalWrite(led3, LOW);<br>digitalWrite(led4, LOW);<br>digitalWrite(led5, LOW);<br>}<br>//-----------------------------------------------------------------------// <br>void setup() {<br>Serial.begin(9600);<br>pinMode(led1, OUTPUT);<br>pinMode(led2, OUTPUT);<br>pinMode(led3, OUTPUT);<br>pinMode(led4, OUTPUT);<br>pinMode(led5, OUTPUT);<br>}<br>//-----------------------------------------------------------------------// <br>void loop() {<br>while (Serial.available()){ //Check if there is an available byte to read<br>delay(10); //Delay added to make thing stable<br>char c = Serial.read(); //Conduct a serial read<br>if (c == '#') {break;} //Exit the loop when the # is detected after the word<br>voice += c; //Shorthand for voice = voice + c<br>} <br>if (voice.length() &gt; 0) {<br>Serial.println(voice);<br>//-----------------------------------------------------------------------// <br>//----------Control Multiple Pins/ LEDs----------// <br>if(voice == &quot;*all on&quot;) {allon();} //Turn Off All Pins (Call Function)<br>else if(voice == &quot;*all off&quot;){alloff();} //Turn On All Pins (Call Function)<br><br>//----------Turn On One-By-One----------//<br>else if(voice == &quot;*TV on&quot;) {digitalWrite(led1, HIGH);}<br>else if(voice == &quot;*fan on&quot;) {digitalWrite(led2, HIGH);}<br>else if(voice == &quot;*computer on&quot;) {digitalWrite(led3, HIGH);}<br>else if(voice == &quot;*bedroom lights on&quot;) {digitalWrite(led4, HIGH);}<br>else if(voice == &quot;*bathroom lights on&quot;) {digitalWrite(led5, HIGH);}<br>//----------Turn Off One-By-One----------//<br>else if(voice == &quot;*TV off&quot;) {digitalWrite(led1, LOW);}<br>else if(voice == &quot;*fan off&quot;) {digitalWrite(led2, LOW);}<br>else if(voice == &quot;*computer off&quot;) {digitalWrite(led3, LOW);}<br>else if(voice == &quot;*bedroom lights off&quot;) {digitalWrite(led4, LOW);}<br>else if(voice == &quot;*bathroom lights off&quot;) {digitalWrite(led5, LOW);}<br>//-----------------------------------------------------------------------// <br>voice=&quot;&quot;;}} //Reset the variable after initiating</p>
<p>Yes the code is fine. You'll want to use Tools/Auto Format if you copy and paste the code from this page I think. Sometimes copy and pasting the code into a webpage can make a negative change in the code. Better yet download the zip and use that.</p>
<p>Hi sir I have one more question. can I use any bluetooth serial? hope ill get your reply tnx :)</p>
<p>I have the best results using the HC-05 module. It seems to do a better job of maintaining the connection. Often when I use HC-06 I have to keep re-connecting. You are very welcome my friend.. I'm always glad to help someone who is interested in electronics. Good luck.</p>
<p> sir I used voltage divider for rx and tx still the LEDs aren't responding as per my commands.. I changed the program and added a else statement in the end what I noticed is when i speak directly else statement is getting executed not the if else statements. Am not understanding whether it's the problem with my program or module???</p>
<p>I have some interesting information. I had this worling perfectly and decided to build a second system. All the same parts and code. Uploaded code and did not get LEDS to blink. Uploaded code (same code as before) to the working system and now it no longer works. I will be trying some other options but I suggest trying it with other parts and observing results.</p>
<p>Thank you so Much sir David :) hope I can return the favor, again Thank you ! :)</p>
<p>Thank you so much sir David! :) Im so grateful :) thank you for considering my questions and making use of your time just to answer me .again thank you :) </p>
<p>dude did you rectify the problem??.. If so plz plz guide me, I tried everything perfectly my voice is also recognised on the arm voice application (after i speak text appears on the app) but leds are not blinking as per the commands. plz plz help me to solve this problem...</p>
<p>I want to help you dude but I dont know how. maybe you can ask sir David of Volthaus Elecs. Lab</p>
Tysm raylinP for replying so quickly.. Can you tell me how can i contact DAVID sir ??
<p>Sir I tried everything perfectly my voice is also recognised on the arm voice application (after i speak text appears on the app) but leds are not blinking as per the commands. plz plz help me to solve this problem...</p>
<p>When you encounter problems you often learn even more.. You now need to double check and confirm you have connected the positive leads of each LED on digital pins # 2,3,4,5,6 of the Arduino. (Not the Analog pins) The negative leads of each LED goes to 220 ohm resistors and then to the negative rail of the breadboard. If you do not put a resistor between each LED and the ground you will probably ruin the LED. Check the LED and make sure it is good and lights. You could use the 5V output pin on the Arduino.. Maybe post a picture of your setup? I hope this helps, if not we will keep working on it until it does. Do not despair, this is the fun part Sachin008.</p>
Thank you sir for considering my question. Sir I have connected LEDs and Bluetooth module exactly how you said still my LEDs are glowing as per my command
<p>The Bluetooth modules HC-05 and 06 can be powered by 5VDC however the signals being sent from the module to the Arduino and the signals back from the Arduino to the Bluetooth module should be 3.3VDC. My modules can handle a 5VDC signal but I'm sure some can not so I suggest you add a level shifter to make sure the 5VDC signal the Arduino sends to the Bluetooth module is 3.3VDC when it arrives to the Bluetooth. Also it will change the 3.3VDC signal being sent from the Bluetooth to 5VDC before it reaches the Arduino.</p><p>Here is my Instructable on Level Shifters:</p><p><a href="http://www.instructables.com/id/Level-Shifters/" rel="nofollow">http://www.instructables.com/id/Level-Shifters/</a></p>
Sir i have used voltage divider at the rx pin of the module . i will send you the pic of the entire setup.
<p>Well try a separate voltage divider for both TX and RX. </p>
<p>Well try a separate voltage divider for both TX and RX. </p>
My Bluetooth hc 05 has 6 pins is that the cause of the problem??
<p>Also most importantly confirm the RX pin on the Bluetooth is connected to the TX pin (Digital Pin #1 on the Arduino) and the TX pin on the Bluetooth is connected to the Digital 0 (zero) pin on the Arduino</p>
<p>VERY COOL! Great directions...Many Thanks. All worked straight away. Was a fun little project for a Sunday Afternoon.</p>
<p>thank u for your excellent work. can u explain why a variable char c used. can we use directly string voice as Serial.read()?</p>
Can you tell me the logic behind this project?
Could you please tell
<p>Hey nice job! This was something me and my friend made when we got bored and stuff and it was pretty cool to try it out. Thank you very much. I've written about this and also posted a video showing us just playing with the stuff trying to get it to listen to us :P. You can see that at igeorge.in :)</p>
<p>eyy dude thats great :) but I have problems with mine can you help me? this is my fb account raylinpanes@yahoo.com really appreciate if you do :) tnx best regards :)</p>
<p>will this work with HC-06&gt;&gt;&gt;&gt;?</p>
<p>how do i use two commands to do the same thing?, i have tried this but the system confused and any randome commands was accepted. PLZ help</p><p>else if(voice == &quot;*fan on&quot; || &quot;*stop&quot;)</p><p>{</p><p>digitalWrite(led2, HIGH);</p><p>digitalWrite(led1, LOW);</p>
<p>We tried everything perfectly but leds are not blinking as per the commands. plz help us to solve this problem...</p>
<p>Can we move the robot using voice record. Please help me to make a robot move.</p><p>I mean with programming and items to make it..! because its my first project !!..</p><p>THANK YOU!!</p>
what compiler shld we use for tis program?
<p>Hey! </p><p>I made this project</p><p>Everything works perfectly</p><p>My voice is recognized</p><p>but my LEDs aren't performing the command</p><p>why? :C</p>
Did you rectify this problem <br>Can you tell me how?
<p>I am facing the same error<br>my voice is recognized but LEDs aren't glowing. </p><p>and output on Serial terminal is also some different string</p>
I did everything correctly and my voice is recognised but the leds wont work why
<p>showing &quot;voice was not declared in this scope&quot;</p><p>Help me with this !</p>
<p>//Copy this line to the beginning of your code. </p><p>String voice;</p>
<p>great intructables, if you want upload sketch over bluetooth use android could follow this instructables http://www.instructables.com/id/Program-Your-Arduino-With-an-Android-Device-Over-B/</p>
<p>Is it also possible to control servo`s through arduino with voice control, using a bluetooth conection with my phone?</p>
<p>yes is possible :)</p>
<p>i followed all steps you wrote . <br>but why i can`t upload the code in ardino . ? </p><p>Arduino: 1.6.5 (Windows 8.1), Board: &quot;Arduino Uno&quot;</p><p>Sketch uses 4,714 bytes (14%) of program storage space. Maximum is 32,256 bytes.</p><p>Global variables use 382 bytes (18%) of dynamic memory, leaving 1,666 bytes for local variables. Maximum is 2,048 bytes.</p><p>avrdude: ser_open(): can't open device &quot;\\.\COM1&quot;: The system cannot find the file specified.</p><p>Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.</p><p> This report would have more information with</p><p> &quot;Show verbose output during compilation&quot;</p><p> enabled in File &gt; Preferences.</p>
<p>Check if your com port is correct .....</p>
<p>can you parse whatever string is stored inside voice? so for example, if voice is equal to &quot;please turn on the light&quot;, can I write an if statement saying: &quot;if voice contains on and contains light, then turn on the light&quot; instead of only doing checks for equality?</p><p>thanks!</p>
<p>Teacher~</p><p>send the code to my mail id.</p><p><br>milkso77@gmail.com</p>
I am getting this error while pressing upload.I am new to this and doing this is my first project please help me please

About This Instructable




Bio: Hi I'm Angelo! I am a 17 y/o Physics Major at the DLSU and I use my course as an inspiration for making ... More »
More by ASCAS:DIY Life-Size Phone Controlled BB8 Droid Rig A Car Horn To Your Alarmclock! Build A Smartphone Projector With A Shoebox  
Add instructable to: