Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Voice control lighting system

Introduction:
Controlling LEDs with voice command seems to be a difficult task, but it’s easy and
you can quickly build it. We just need an Arduino UNO to serially communicate with HC-06
Bluetooth module and a smartphone to send voice command to Bluetooth module HC-06. For
receiving voice command we are using “Arduino Bluetooth Voice Controller” android app
which you can download from play store.

Material requirement:
1. Arduino-UNO
2. HC-06 Bluetooth Module
3. LEDs (Red, and Green)
4. Resistor 220 ohm (2 nos.)
5. Breadboard
6. Connecting wires

Connection:

Code:
String readString;
int IN1=13;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(IN1,OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
while(Serial.available())
{ //Check if there is an available byte to read
delay(10);
char c = Serial.read(); //Conduct a serial read
if (c == ',')
{
break;
}
readString += c;
}
Serial.println(readString);
if (readString.length() > 0)
{
Serial.println(readString);
if(readString == "light on")
{
digitalWrite(IN1, HIGH);
}
if ( readString=="light off")
{
digitalWrite(IN1, LOW);
}
readString = "";
}

You might also like