Voice-Controlled LED Project Using Arduino and HC-05 Bluetooth Module

Controlling electronics with voice commands is one of the most exciting applications of IoT and embedded systems. In this project, you’ll learn how to build a voice-controlled LED system using an Arduino Uno, an HC-05 Bluetooth module, and a mobile app to send commands via Bluetooth.

We’ll control two LEDs (Red and Green) using simple voice commands like:

  • “Red LED on”
  • “Red LED off”
  • “Green LED on”
  • “Green LED off”

Components Required

ComponentQuantity
Arduino Uno1
HC-05 Bluetooth Module1
Red LED1
Green LED1
220Ω Resistors2
Breadboard1
Jumper WiresAs needed
Android Phone with Voice Control App1

Circuit Diagram & Connections

HC-05 Bluetooth Module:

HC-05 PinConnects ToNotes
VCC5V on ArduinoPower
GNDGND on ArduinoGround
TXDPin 10 on ArduinoSoftwareSerial RX
RXDPin 11 on ArduinoSoftwareSerial TX (via voltage divider)

LEDs:

LEDAnode (Long Leg)Cathode (Short Leg)Resistor
Red LEDPin 8 on ArduinoGND via 220ΩYes
Green LEDPin 9 on ArduinoGND via 220ΩYes

How It Works

  1. The user gives a voice command through a mobile app (such as “Bluetooth Voice Control for Arduino”).
  2. The app converts the voice to text and sends it over Bluetooth.
  3. The Arduino receives the command and matches it with pre-defined phrases like "RED LED ON" or "GREEN LED OFF".
  4. Based on the command, the corresponding LED turns ON or OFF.

Mobile App Configuration

You can use apps like:

  • Arduino Bluetooth Control
  • Arduino Voice Control

Steps:

  1. Pair your phone with the HC-05 module (default PIN: 1234 or 0000).
  2. Open the app and connect to the HC-05 module.
  3. Use voice commands like:
    • “Red LED on”
    • “Green LED off”
    • “Turn off red”
    • etc.

If the command is recognized correctly and matches the code, the LED will respond accordingly.

Arduino code:

#include <SoftwareSerial.h>

SoftwareSerial BT(10, 11); // RX, TX

const int redLED = 8;
const int greenLED = 9;
String command = "";

void setup() {
  pinMode(redLED, OUTPUT);
  pinMode(greenLED, OUTPUT);
  Serial.begin(9600);
  BT.begin(9600); // HC-05 default baud rate

  Serial.println("Ready to receive voice commands...");
}

void loop() {
  // Read from Bluetooth
  while (BT.available()) {
    char c = BT.read();
    command += c;
    delay(5); // Small delay to ensure complete string is received
  }

  // If we received a command, process it
  if (command.length() > 0) {
    Serial.println("Command: " + command);

    // Convert command to uppercase for case-insensitive comparison
    command.toUpperCase();

    // Control logic using UPPERCASE strings
    if (command.indexOf("RED LED ON") != -1) {
      digitalWrite(redLED, HIGH);
      Serial.println("Red LED turned ON");
    }
    else if (command.indexOf("RED LED OFF") != -1 || command.indexOf("TURN OFF RED") != -1) {
      digitalWrite(redLED, LOW);
      Serial.println("Red LED turned OFF");
    }
    else if (command.indexOf("GREEN LED ON") != -1) {
      digitalWrite(greenLED, HIGH);
      Serial.println("Green LED turned ON");
    }
    else if (command.indexOf("GREEN LED OFF") != -1 || command.indexOf("TURN OFF GREEN") != -1) {
      digitalWrite(greenLED, LOW);
      Serial.println("Green LED turned OFF");
    }

    command = ""; // Clear command buffer
  }
}

Testing and Debugging Tips

  • Open Serial Monitor to see incoming commands for debugging.
  • If the command doesn’t work, type it manually in the Bluetooth app to test.
  • Make sure the LED anode is connected to the correct digital pin, and the cathode goes through a resistor to GND.

Result

Once everything is set up:

  • Saying “Red LED on” turns the red LED ON.
  • Saying “Red LED off” turns it OFF.
  • Saying “Green LED on” turns the green LED ON.
  • Saying “Green LED off” turns it OFF.

Conclusion

This project is a simple yet powerful demonstration of how you can control electronic components wirelessly using voice commands. It introduces key concepts of serial communication, string parsing, and voice-to-text Bluetooth control in Arduino.

This is perfect for beginners looking to explore home automation or start with IoT!