Voice Activated Arduino Bluetooth Android
Voice Activated Arduino Bluetooth Android
Table of Contents
File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
http://www.instructables.com/id/Voice-Activated-Arduino-Bluetooth-Android/
Author:ASCAS ASCAS.com
Hello There! I'm Angelo. I'm 15 and I love to build projects during my pastime!I plan to become an engineer someday and work for a company who innovates
new products. ___________________ My #1 inspiration is my grandpa! He's one of the reasons why I make so many projects. He was a great engineer and
the best grandfather that a geek can ever have. When I was in elementary, he used to pick me up from school. We shop at hardware stores before we head
home, then build projects together at their garage. When he passed away, I continued my hobby in honor of him. ___________________ Most of my projects
focus on Electronics, Woodworking and Robotics. I've been making projects since I was, now I that I have earned a lot of knowledge through my experience.
I now compete in the annual "National Robotics Competition". I earned last year's championship title. I'll be one of our country's representative in this year's
International Robotics Olympiad (which will be held at Beijing).
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 :/
http://www.instructables.com/id/Voice-Activated-Arduino-Bluetooth-Android/
Step 2: Assemble The Mini Bluetooth Shield
My JY-MCU (DX Bluetooth Module) is still installed on my robots, what I have right now is the bare HC-05 module.
As we all know, the HC-05 doesn't come with a PCB. Soldering wires, directly to the metal conductors, isn't a good idea since the conductors could chip off anytime. As a
solution, you can cut a fraction of perf-board then mount the HC-05 on it. I mistakenly connected my LED indicator on a blank (N/A) pin so mine doesn't work.
___________________________________________
Too lazy to assemble a Bluetooth shield? DX.com has a ready made version (click here ). I've used the DX Bluetooth module on my robots, it's tested and it's 100% ok!
You can visit Bluetooth related projects (Bluetooth Sumobot and Bluetooth FPV Rover ) as reference.
http://www.instructables.com/id/Voice-Activated-Arduino-Bluetooth-Android/
Step 3: Connect The Bluetooth Module
Grab some jumper cables and power the Bluetooth module with 3.3 volts. Remember, the bare HC-05 run on 3.3v and not on 5v. On the other hand, the JY-MCU has a
built in regulator, it can run on a 5v line.
Now connect the RX (pin #0) of the Arduino to the TX pin of the Bluetooth module and the TX (pin #1) of the Arduino to the RX pin of the Bluetooth module. (refer to the
image above)
http://www.instructables.com/id/Voice-Activated-Arduino-Bluetooth-Android/
Step 4: Connect The LEDs
Connect the positive leads of each LED on pins # 2,3,4,5,6 of the Arduino. The negative leads of each LED goes to the negative rail of the breadboard. The negative rail
of the breadboard goes to the Arduino's ground.
What's the format of the string? How does it know when the next command kicks in? How does it differentiate a set of words from a new command? The app sends
strings in this format *command# , the asterisk (*) indicates the start of a new command and the hash-tag (#) indicates the end of a command. I was able to remove the
hash-tag (#) after each word in the conditional statement was not able to remove the asterisk (*). You'll need to start your command condition with an asterisk otherwise
the sketch will not work.
String voice;
int
led1 = 2, //Connect LED 1 To Pin #2
led2 = 3, //Connect LED 2 To Pin #3
led3 = 4, //Connect LED 3 To Pin #4
led4 = 5, //Connect LED 4 To Pin #5
led5 = 6; //Connect LED 5 To Pin #6
//--------------------------Call A Function-------------------------------//
void allon(){
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
}
void alloff(){
http://www.instructables.com/id/Voice-Activated-Arduino-Bluetooth-Android/
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
}
//-----------------------------------------------------------------------//
void setup() {
Serial.begin(9600);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
}
//-----------------------------------------------------------------------//
void loop() {
while (Serial.available()){ //Check if there is an available byte to read
delay(10); //Delay added to make thing stable
char c = Serial.read(); //Conduct a serial read
if (c == '#') {break;} //Exit the loop when the # is detected after the word
voice += c; //Shorthand for voice = voice + c
}
if (voice.length() > 0) {
Serial.println(voice);
//-----------------------------------------------------------------------//
//----------Control Multiple Pins/ LEDs----------//
if(voice == "*all on") {allon();} //Turn Off All Pins (Call Function)
else if(voice == "*all off"){alloff();} //Turn On All Pins (Call Function)
//----------Turn On One-By-One----------//
else if(voice == "*TV on") {digitalWrite(led1, HIGH);}
else if(voice == "*fan on") {digitalWrite(led2, HIGH);}
else if(voice == "*computer on") {digitalWrite(led3, HIGH);}
else if(voice == "*bedroom lights on") {digitalWrite(led4, HIGH);}
else if(voice == "*bathroom lights on") {digitalWrite(led5, HIGH);}
//----------Turn Off One-By-One----------//
else if(voice == "*TV off") {digitalWrite(led1, LOW);}
else if(voice == "*fan off") {digitalWrite(led2, LOW);}
else if(voice == "*computer off") {digitalWrite(led3, LOW);}
else if(voice == "*bedroom lights off") {digitalWrite(led4, LOW);}
else if(voice == "*bathroom lights off") {digitalWrite(led5, LOW);}
//-----------------------------------------------------------------------//
voice="";}} //Reset the variable after initiating
File Downloads
Voice_Activation.zip (1 KB)
http://www.instructables.com/id/Voice-Activated-Arduino-Bluetooth-Android/
Voice_Activation.zip (1 KB)
[NOTE: When saving, if you see .tmp as the file ext, rename it to 'Voice_Activation.zip']
Step 6: Learn To Use The App
Download The Free App Here: Android Meets Robots : Voice
5 Simple Steps:
1st.) Download the app from Google PlayStore
2nd.) Tap on options menu then select "Connect Robot"
3rd.) Click on your BT-Module (in my case it's the HC-05)
4th.) Wait until it says Connected to BT-Module (HC-05)
5th.) Tap on the mic icon and state your command!
http://www.instructables.com/id/Voice-Activated-Arduino-Bluetooth-Android/
Related Instructables
CxemCAR 1 -
Android Control Bluetooth Arduino -
Remote- RC Car over mobile phone Arduino bot Control DC
Controlled Cool accessory for Android remote Arduino bot Motor via
Bluetooth by
Neon El Wire by Missed calls control II by Android remote Bluetooth by
tolik777
daryllukas and SMS by braserito66 control by RuiSantos
zmashiah donmatito
Advertisements
Comments
2 comments Add Comment
http://www.instructables.com/id/Voice-Activated-Arduino-Bluetooth-Android/