Wednesday, March 11, 2020

VOICE CONTROLLED LEDS USING ARDUINO AND BLUETOOTH(HC-05)

Rakshith S

6th Sem BCA, NCMS




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 (link is given below)


Material Required


  • Arduino UNO
  • HC-06 Bluetooth Module
  • LEDs (Red, and Green)
  • Resistor 220 ohm (2 nos.)
  • Arduino Bluetooth Voice Controller (https://play.google.com/store/apps/details?id=appinventor.ai_nitinpandit_00.Arduino_bluetooth_voice_controller&hl=en_IN)
  • Breadboard
  • Connecting wires

SOURCE 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);       
      }
 }
}



No comments:

Post a Comment

AI IN CRYPTOGRAPHY

Written by: PALLAVI V (Final year BCA) 1.     ABSTRACT: The integration of AI in Cryptography represents a significant advancement in ...