Ultimate Bluetooth LED Controller: 1st Controller in BlueBot Controller App

Ultimate Bluetooth LED Controller

Introduction

Bluetooth LED control with HC-05 transforms your Arduino projects into wireless wonders. This beginner-friendly guide outlines 10 steps to master Bluetooth LED control using an Arduino and the HC-05 Bluetooth module. Perfect for hobbyists and DIY enthusiasts, this project paves the way for smart home automation. By replacing LEDs with relays, you can manage appliances, making this setup highly adaptable. Let’s explore the components, circuit, code, and app to achieve seamless Bluetooth LED control.

Components Required

To achieve Bluetooth LED control, gather these essential components. Each ensures stability and functionality. The table below details everything you need:

ComponentDescription
LEDsStandard 5mm LEDs for visual output. Use multiple for varied control.
HC-05 Bluetooth ModuleFacilitates wireless communication between Arduino and your smartphone.
Arduino Nano or UnoMicrocontroller to process commands and manage LEDs.
Arduino Nano Expansion BoardSimplifies connections for Nano, optional for Uno.
220 Ohm ResistorProtects LEDs by limiting current. One per LED.
Jumper WiresConnect components on the breadboard.
External Power Supply (12V, 1A)Provides stable power, especially for multiple LEDs.
Programming CableUSB cable to upload code to Arduino.
BreadboardPlatform for prototyping the circuit without soldering.

These components are cost-effective and accessible. Additionally, an external power supply enhances reliability for Bluetooth LED control.

Step 1: Understand the HC-05 Bluetooth Module

The HC-05 Bluetooth module is a cost-effective solution for wireless Arduino projects. It uses serial communication, enabling your smartphone to send commands. Therefore, it’s ideal for Bluetooth LED control. Ensure the module operates in slave mode to receive commands from your phone.

Key Features of HC-05

  • Range: Up to 10 meters.
  • Baud Rate: Default 9600, configurable.
  • Power: 3.3V to 5V compatible.

Refer to the HC-05 datasheet for detailed specifications here.

Step 2: Set Up the Arduino

Select either an Arduino Nano or Uno. Both excel in Bluetooth LED control projects. The Nano’s compact size suits small setups, while the Uno’s clear pin labels benefit beginners. For Nano users, the expansion board streamlines connections. Upload code via the programming cable using the Arduino IDE, available from Arduino’s official site.

Step 3: Build the Circuit

Constructing the circuit requires precision. Follow these steps to connect components on the breadboard:

  1. LED Connections:
    • Connect all LED negative (cathode) legs to the breadboard’s negative track.
    • Attach positive (anode) legs to the breadboard’s middle rows.
    • Connect a 220-ohm resistor from each LED’s positive leg to the middle row.
    • Link the resistors’ other ends to Arduino pins (10, 11, 12, 13) as specified in the code.
  2. HC-05 Connections:
    • Connect HC-05 VCC to Arduino 5V.
    • Connect HC-05 GND to Arduino GND.
    • Link HC-05 TX to Arduino pin 2 (RX for SoftwareSerial).
    • Link HC-05 RX to Arduino pin 3 (TX for SoftwareSerial).
  3. Power Supply:
    • Use a 12V 1A external power supply for stability. Connect it to the Arduino’s VIN and GND pins or power the breadboard’s positive and negative tracks.

Circuit Diagram Notes

  • Ensure all LED negatives share a common ground.
  • Verify resistor connections to prevent LED damage.
  • Confirm HC-05 pin connections to avoid communication issues.

For a visual guide, explore Fritzing for circuit diagrams.

Step 4: Write and Upload the Code

The Arduino code enables Bluetooth LED control by processing smartphone commands. Below is the complete code for four LEDs, utilizing the SoftwareSerial library for HC-05 communication.

#include <SoftwareSerial.h>

// RX, TX pins for the Bluetooth module (HC-05)
SoftwareSerial BTSerial(2, 3);

// Define 4 LED pins
int ledPin1 = 13;
int ledPin2 = 12;
int ledPin3 = 11;
int ledPin4 = 10;

void setup() {
  // Start serial communication
  BTSerial.begin(9600);  // Bluetooth communication
  Serial.begin(9600);    // Serial monitor

  // Set LED pins as outputs
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  pinMode(ledPin4, OUTPUT);

  Serial.println("Ready to receive commands");
  BTSerial.println("Bluetooth LED Controller Ready");
}

void loop() {
  if (BTSerial.available()) {
    // Read command
    String command = BTSerial.readStringUntil('\n');
    command.trim(); // Remove extra spaces or newlines
    Serial.println("Command received: " + command);

    // LED 1
    if (command == "A") {
      digitalWrite(ledPin1, HIGH);
      BTSerial.println("LED 1 ON");
    } else if (command == "B") {
      digitalWrite(ledPin1, LOW);
      BTSerial.println("LED 1 OFF");

    // LED 2
    } else if (command == "C") {
      digitalWrite(ledPin2, HIGH);
      BTSerial.println("LED 2 ON");
    } else if (command == "D") {
      digitalWrite(ledPin2, LOW);
      BTSerial.println("LED 2 OFF");

    // LED 3
    } else if (command == "E") {
      digitalWrite(ledPin3, HIGH);
      BTSerial.println("LED 3 ON");
    } else if (command == "F") {
      digitalWrite(ledPin3, LOW);
      BTSerial.println("LED 3 OFF");

    // LED 4
    } else if (command == "G") {
      digitalWrite(ledPin4, HIGH);
      BTSerial.println("LED 4 ON");
    } else if (command == "H") {
      digitalWrite(ledPin4, LOW);
      BTSerial.println("LED 4 OFF");

    // Unknown command
    } else {
      BTSerial.println("Unknown command");
    }
  }
}

BlueBot LED Controller

💡

Your Arduino Code will be ready in 60 seconds!

Code Explanation

  • SoftwareSerial: Establishes a virtual serial port on pins 2 and 3 for HC-05.
  • LED Pins: Assigned to 10–13, aligning with the circuit.
  • Commands: Letters A–H toggle LEDs (e.g., A = LED 1 ON, B = LED 1 OFF).
  • Serial Monitor: Displays commands for debugging.

Upload the code via Arduino IDE. Disconnect the HC-05 during upload to prevent serial conflicts.

Step 5: Install the Bluebot App

The Bluebot app is your gateway to Bluetooth LED control. Available for Android, it sends commands to the Arduino through the HC-05 module. Download it from the Google Play Store: Bluebot Controller.

Bluebot Features

  • Intuitive Interface: Easy-to-use buttons for commands (A–H).
  • Stable Connection: Pairs reliably with HC-05.
  • Custom Commands: Supports commands matching the code.

Pair your phone with the HC-05 (default password: 1234 or 0000). Open Bluebot, connect to HC-05, and test commands.

Step 6: Test the Bluetooth LED Control

Power the circuit with the external supply. Use Bluebot to send commands:

  • Press “A” to turn LED 1 on, “B” to turn it off.
  • Repeat for LEDs 2–4 with commands C–H.

If LEDs don’t respond, check wiring, resistors, and Bluetooth pairing. Use the Serial Monitor to debug command reception. Watch Demo Video

Step 7: Scale to Home Automation

Replace LEDs with relays to control appliances, transforming your project into home automation. A 5V 4-channel relay module connects similarly, controlling high-voltage devices like lights or fans. Update the code for relay pins and commands. This upgrade elevates Bluetooth LED control to smart home functionality.

Relay Connection Tips

  • Connect relay VCC to Arduino 5V, GND to GND.
  • Link control pins to Arduino pins (e.g., 10–13).
  • Use a separate power supply for appliances to prevent Arduino overload.

Learn more about relays here.

Step 8: Optimize Power Management

A 12V 1A external power supply ensures stability for multiple LEDs or relays. However, avoid relying solely on USB power for extended use, as it risks voltage drops. Connect the power supply to the breadboard’s power rails or Arduino’s VIN pin.

Step 9: Troubleshoot Common Issues

Facing issues? Try these solutions:

  • HC-05 Not Pairing: Verify power connections and default password.
  • LEDs Not Lighting: Confirm 220-ohm resistors and pin assignments.
  • App Not Responding: Ensure HC-05 is in slave mode and paired.

Visit the Arduino Forum for community support.

Step 10: Enhance Your Project

Elevate your Bluetooth LED control project:

  • Add More LEDs: Use additional pins and update the code.
  • Incorporate Sensors: Add a light sensor for automated control.
  • Enable Voice Control: Use a Bluetooth app with voice input for hands-free operation.

These upgrades make your Bluetooth LED control system more dynamic.

Conclusion

You’ve mastered Bluetooth LED control with HC-05 using Arduino, from wiring to coding and app integration. This project lays the foundation for home automation swap LEDs for relays to control appliances. Follow the 10 steps, leverage the Bluebot app, and experiment with enhancements. Start building today and share your projects in the comments!

Download BlueBot Controller App and start your journey today!

Home Page