100% found this document useful (1 vote)
119 views

Automation

This document provides instructions for building a home automation system using an Arduino, Bluetooth module, and Android phone. The system allows you to control Arduino outputs like LEDs using voice commands on the Android phone. It works by sending voice data strings from an Android app to the Arduino via Bluetooth. The hardware includes an Arduino, Bluetooth module, LEDs, breadboard, and Android phone. The Arduino code defines pins for the outputs and listens for voice commands over Bluetooth to control the LEDs.

Uploaded by

ab_s5036
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
119 views

Automation

This document provides instructions for building a home automation system using an Arduino, Bluetooth module, and Android phone. The system allows you to control Arduino outputs like LEDs using voice commands on the Android phone. It works by sending voice data strings from an Android app to the Arduino via Bluetooth. The hardware includes an Arduino, Bluetooth module, LEDs, breadboard, and Android phone. The Arduino code defines pins for the outputs and listens for voice commands over Bluetooth to control the LEDs.

Uploaded by

ab_s5036
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

russelGuide

HOME AUTOMATION
USING ARDUINO + BLUETOOTH + ANDROID
Overview
Control your Arduino with voice commands using an Android phone! 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 phone and
a HC-05 Bluetooth module.

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 Arduino UNO will match the voice command received and wait for you
to say a correct voice command. The app will then display the word's that you've stated
and will send data strings for the Arduino to process.

The system is based on the popular Arduino development platform and the inexpensive
HC-05 or HC-06 Bluetooth module. It uses android application (AMR Voice) as the
voice recognition system.

The Hardware

The main component lists the start the experiment.


1.
2.
3.
4.
5.
6.

Arduino UNO (cloned is worked fine).


HC-06 Bluetooth module
2 LED (red, green)
Jumper wires
Breadboard
Android Phone with AMR Voice application installed

Programming Tools
If you dont have PC or Laptop you can used tablet Android phone as
alternative and it works fine. Just install the application Arduino IDE at play
store.
Things you need are:
1. USB cable
2. PC or Tab
3. Arduino sketch file (voicecontrol.ino)
Open the sketch file and compile.

The main setup


The Arduino module can be in any version and model for the control of the LEDs, and
its possible to replace it with relays as well. HC-05 or HC-06 Bluetooth module being
used for communication with the Android phone.

Now the wiring diagram as shown in the image are pretty much self explanatory even
for those newbies in electronics, just follow the instruction and load the code.
PINS CONFIGURATION:

PIN2- lights on/off


PIN3- fan on/off
PIN4- radio on/off - p# 3
PIN5- outlet/off - p# 4
PIN6- TV on/off - P# 5
PIN0(RX)- Bluetooth module TX
PIN1(TX)- Bluetooth model RX
PIN(3.3v)- Bluetooth module VCC

Warning!
Please note that HC-06 Bluetooth module only require 3.3v to operate. Do not use the
5v or 6v because the module will burn-up and fry your device.

Photo shows the wire connection between VCC and GND going to the Bluetooth
module.

The photo shows the connection between (RX) and (TX) going to the Bluetooth module
as well and the PIN1 and PIN2 going to the LED (red and green).

The code
/*
-----------------------------------------------------------------------russelGuide
Voice Activated Controller
Arduino Bohol
-----------------------------------------------------------------------*/
String voice;
#define led1 2 //Connect led1 to pin 2
#define led2 3 //Connect led2 to pin 3
#define led3 4 //Connect led1 to pin 4
#define led4 5 //Connect led2 to pin 5
#define led5 6 //Connect led1 to pin 6
void setup()
{
Serial.begin(9600);
//Set rate for communicating with serial
pinMode(led1, OUTPUT);
//Set led1 as an output
pinMode(led2, OUTPUT);
//Set led2 as an output
pinMode(led3, OUTPUT);
//Set led3 as an output
pinMode(led4, OUTPUT);
//Set led4 as an output
pinMode(led5, OUTPUT);
//Set led5 as an output
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
digitalWrite(led5, LOW);

//Switch led1 off


//Swtich led2 off
//Switch led3 off
//Swtich led4 off
//Switch led5 off

}
void loop()
{
while(Serial.available()) //Check if there are available bytes to read
{
delay(10);
//Delay to make it stable
char c = Serial.read(); //Conduct a serial read
if (c == '#'){
break;
//Stop the loop once # is detected after a word
}
voice += c;
//Means voice = voice + c
}
if (voice.length() >0)
{
Serial.println(voice);
if(voice == "*all on")
{allon();}

else if(voice == "*all off") {alloff();}


else if(voice == "*lights on") {digitalWrite(led1, HIGH);}
else if(voice == "*lights off"){digitalWrite(led1, LOW);}
else if(voice == "*fan on") {digitalWrite(led2, HIGH);}
else if(voice == "*fan off") {digitalWrite(led2, LOW);}
else if(voice == "*radio on") {digitalWrite(led3, HIGH);}
else if(voice == "*radio off") {digitalWrite(led3, LOW);}
else if(voice == "*outlet on") {digitalWrite(led4, HIGH);}
else if(voice == "*outlet off"){digitalWrite(led4, LOW);}
else if(voice == "*TV on") {digitalWrite(led5, HIGH);}
else if(voice == "*TV off") {digitalWrite(led5, LOW);}
voice=""; //reset voice string to none
}
}
//-------------- Call Function -------------------void allon()
{
digitalWrite(led1, HIGH); //Switch led1 off
digitalWrite(led2, HIGH); //Switch led2 off
digitalWrite(led3, HIGH); //Switch led3 off
digitalWrite(led4, HIGH); //Switch led4 off
digitalWrite(led5, HIGH); //Switch led5 off
}
void alloff()
{
digitalWrite(led1, LOW); //Switch led1 off
digitalWrite(led2, LOW); //Switch led2 off
digitalWrite(led3, LOW); //Switch led3 off
digitalWrite(led4, LOW); //Switch led4 off
digitalWrite(led5, LOW); //Switch led5 off
}
//------------------------------------------------/*
----------rGuide
----------*/

Using the Application


Before you install the AMR Voice recognition software please insure Google Voice
already installed on your phone. Download the AMR Voice application from the play
store and open to run the program.
Activate the Bluetooth device on your phone and connect from the HC-06 module and
type the pairing password 1234 or 0000. Speak one of the commands in the code and
see what happens.

You might also like