In this tutorial, we will turn LEDs ON and OFF by sending voice signals from the HC-05 Bluetooth module, which are then received by the Arduino. This will be done by using a mobile app known as "Arduino Bluetooth Voice Controller," which can be downloaded from the Android Play Store and then connecting it with the Bluetooth Module HC-05 to start communicating between yourself and Arduino IDE.
What Is an HC-05 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.
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.
The standard HC-05 Bluetooth module has six pins. However, we will only be using only four pins in this project. The pins we will be using are the VCC pin, the GND pin, the TXD pin, and the RXD pin.
- Surilli GSM.
- HC-05 Bluetooth module.
- LEDs (Red and Green).
- 2 resistors (220 Ohms).
- Arduino Bluetooth Voice Controller App from Android Play Store.
- Breadboard.
- Connecting Wires.
RX PIN (BLUETOOTH MODULE HC-05) ---> PIN 10 (SURILLI GSM).
TX PIN (BLUETOOTH MODULE HC-05) ---> PIN 11 (SURILLI GSM).
GND PIN (BLUETOOTH MODULE HC-05) ---> GND PIN (SURILLI GSM).
+5V PIN (BLUETOOTH MODULE HC-05) ---> USB PIN (SURILLI GSM).
+ PIN (GREEN LED) ---> PIN 5 (SURILLI GSM).
- PIN (GREEN LED) ---> GND PIN (SURILLI GSM).
+ PIN (RED LED) ---> PIN 13 (SURILLI GSM).
- PIN (RED LED) ---> GND PIN (SURILLI GSM).
Set Up Arduino IDE for Surilli:Make sure you have selected the right port, board and processor for the Surilli as shown in the picture below and it is programmable (compile and upload “Blink” from File>Examples>Digital>Blink onto your Surilli to check if everything is working fine).
The Circuitry:The circuitry is very simple. Follow the figure below to set up your hardware.
Now you have completed setting up your hardware and Arduino IDE. Copy and paste the Arduino sketch given below into your Arduino IDE and hit upload. We will use "Software serial" library to make pin 11 and 10 as Tx and Rx, respectively.
Arduino Code:#include <SoftwareSerial.h>
String value;
int TxD = 11;
int RxD = 10;
int servoposition;
SoftwareSerial bluetooth(TxD, RxD);
void setup() {
pinMode(13, OUTPUT);
pinMode(5, 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(13, HIGH);
digitalWrite(5, HIGH);
}
if (value == "all LED turn off"){
digitalWrite(13, LOW);
digitalWrite(5, LOW);
}
if (value == "turn on Red LED"){
digitalWrite(13, HIGH);
}
if (value == "turn on green LED"){
digitalWrite(5, HIGH);
}
if (value == "turn off red LED"){
digitalWrite(13, LOW);
}
if (value == "turn off green LED"){
digitalWrite(5, LOW);
}
}
}
Connect Arduino to Android DeviceDownload the app "Arduino Bluetooth Voice Controller" from the Android Play Store. Open the app and then first click on "Connect to Bluetooth Device" and select your HC-05 Bluetooth module and check it if it is connected or not. Then click on the mic icon to speak and send the voice commands to the HC-05 module.
Note: When you are connecting your Bluetooth module for the first time with your smartphone it will ask for the passcode, use 0000 or 1234.
After setting up all the things, you just have to send the voice command by using the app which is further sent to HC-05 Bluetooth module and HC-05 serially communicates with the Arduino IDE, and then the task is performed as per the command which is the further displayed on the serial monitor. The table below shows the commands and the actions.
If you make something funny and interesting do share it with our community.
That’s all for now. If you have any queries, visit our website surilli.io or contact our support. Stay connected with Surilli family for more amazing stuff. :-)
Comments
Please log in or sign up to comment.