Control LED Using Your Voice Command

Control LED Using Your Voice Command

In this tutorial I am showing how you can control 3 RGB LEDs using your voice command.

  • 20,856 views
  • 4 comments
  • 28 respects

Components and supplies

Apps and online services

About this project

This is very basic project for controlling 3 LED (Red, Green, Blue) using voice control. To accomplish this we have used Bluetooth HC-05 module and an android app IoTBoys available on play store. LEDs will be On/Off on your voice command.

Detail Description and wiring available on www.iotboys.com

Visit www.iotboys.com for more projects.

Article available on https://goo.gl/XjmCJE.

Code

Source Code C/C++
Write below code on Arduino IDE and upload to your Arduino Uno board.
String voice;
int RED = 2;
int GREEN = 3;
int BLUE = 4;
void RedOn(){
digitalWrite (RED, HIGH);
}
void RedOff(){
digitalWrite (RED, LOW);
}
void GreenOn(){
digitalWrite (GREEN, HIGH);
}
void GreenOff(){
digitalWrite (GREEN, LOW);
}
void BlueOn(){
digitalWrite (BLUE, HIGH);
}
void BlueOff(){
digitalWrite (BLUE, LOW);
}
void allon() {
digitalWrite (RED, HIGH);
digitalWrite (GREEN, HIGH);
digitalWrite (BLUE, HIGH);
}
void alloff() {
digitalWrite (RED, LOW);
digitalWrite (GREEN, LOW);
digitalWrite (BLUE, LOW);
}
void setup() {
Serial.begin(9600);
pinMode(RED, OUTPUT);
pinMode(GREEN, OUTPUT);
pinMode(BLUE, OUTPUT);
}
void loop() {
while(Serial.available()) {
delay(10);
char c=Serial.read();
if(c=='#')
{break; }
voice += c;
}
if (voice.length() > 0) {
Serial.println(voice);
if (voice == "on" || voice == "all")
{
allon() ;
}
else if (voice == "off" || voice=="all off")
{
alloff() ;
}
else if(voice =="red" || voice =="red on"){
RedOn();
}
else if(voice =="red off"){
RedOff();
}
else if(voice =="green" || voice =="green on"){
GreenOn();
}
else if( voice =="green off" ){
GreenOff();
}
else if(voice =="blue" || voice =="blue on"){
BlueOn();
}
else if(voice =="blue off"){
BlueOff();
}
voice="";
}
}

Schematics

Circuit Design
Follow the Design
Controlling led using voice command  iotboys com a2wrardmf4

Comments

Similar projects you might like

Bluetooth control led with lcd led status display real time.

Project tutorial by Youssef Sabaa

  • 17,290 views
  • 4 comments
  • 34 respects

Control an LED with the Remote Control

Project showcase by Nicholas_N

  • 6,656 views
  • 3 comments
  • 16 respects

Control RGB LED using Bluetooth

Project showcase by kamatalaashish

  • 8,965 views
  • 0 comments
  • 8 respects
Add projectSign up / Login