Material Required

  1. Arduino UNO
  2. HC-06 Bluetooth Module
  3. LEDs (Red, and Green)
  4. Resistor 220 ohm (2 nos.)
  5. Arduino Bluetooth Voice Controller (Download from play store)
  6. Breadboard
  7. Connecting wires

HC-06 Bluetooth Module:

Bluetooth can operate in the following two modes:
Command Mode
Operating Mode

In Command Mode we will be able to configure the Bluetooth properties like the name of the Bluetooth signal, its password, the operating baud rate etc. The Operating Mode is the one in which we will be able to send and receive data between the PIC Microcontroller and the Bluetooth module. Hence in this tutorial we will be toying only with the Operating Mode. The Command mode will be left to the default settings. The Device name will be HC-05 (I am using HC-06) and the password will be 0000 or 1234 and most importantly the default baud rate for all Bluetooth modules will be 9600.

The module works on 5V supply and the signal pins operate on 3.3V, hence a 3.3V regulator is present in the module itself. Hence we need not worry about it. Out of the six pins only four will be used in the Operating mode


Circuit Diagram

Circuit diagram for this Voice Controlled Lights is given below, while uploading the code in the Arduino UNO disconnect the Rx and Tx pins and connect again after the code is uploaded.

Working Procedure:



Step 1:- Connect all components as per the circuit diagram; disconnect Rx and Tx pins while uploading the code.

Step 2:- Download the app called “Arduino Bluetooth Voice Controller” which is free on play store.

Step 3:- Open the app and follow the image below, like first click on “connect to Bluetooth device” and select your Bluetooth module and check if it is connected or not. Then click on the mic icon to speak and send the voice command to the HC-06 module

Step 4:- After setting up all the things, you just have to send the voice command by using the app which is further sent to Bluetooth module HC-06 and the HC-06 serially communicate with the Arduino UNO and then the task is performed as per the command




1.

all LED turn on

Both Red and Green LED turns ON

2.

all LED turn off

Both Red and Green LED turns OFF


3.

turn on Red LED

Red LED turns ON


4.

turn on green LED

Green LED turns ON


5.

turn off red LED

Red LED turns OFF


6.

turn off green LED

Green LED turns OFF

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

Theme images by Dizzo. Powered by Blogger.