Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
hrsajjad844
Published © MIT

Voice Controlled LED's using Arduino and Bluetooth

Controlling LEDs with voice command seems to be a difficult task, but it’s easy and you can quickly build it.

AdvancedShowcase (no instructions)3,621
Voice Controlled LED's using Arduino and Bluetooth

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
5 mm LED: Red
5 mm LED: Red
×1
5 mm LED: Green
5 mm LED: Green
×1
Resistor 220 ohm
Resistor 220 ohm
×2
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1

Story

Read more

Schematics

Schematic design

The project circuit diagram

Code

Code

C/C++
The project code
#include <SoftwareSerial.h>
String value;
int TxD = 11;
int RxD = 10;
int servoposition;
SoftwareSerial bluetooth(TxD, RxD);

void setup() {
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  Serial.begin(9600);       // start serial communication at 9600bps
  bluetooth.begin(9600);
}

void loop() {
  Serial.println(value);
 if (bluetooth.available())
   {
    value = bluetooth.readString();

    if (value == "all LED turn on"){
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);  
      }

    if (value == "all LED turn off"){
      digitalWrite(2, LOW); 
      digitalWrite(3, LOW);       
      }

    if (value == "turn on Red LED"){
    digitalWrite(2, HIGH); 
      }

    if (value == "turn on green LED"){
      digitalWrite(3, HIGH);       
      }
      
    if (value == "turn off red LED"){
    digitalWrite(2, LOW); 
      }

    if (value == "turn off green LED"){
      digitalWrite(3, LOW);       
      }

 }

}

Credits

hrsajjad844
1 project • 16 followers
Contact

Comments

Please log in or sign up to comment.