BlueBot Door Lock Controller: Secure Your Projects with Smart Automation

The BlueBot Door Lock Controller is an innovative and customizable solution for controlling door locks, servo motors, and LEDs. Designed for project purposes, this smart controller allows users to manage their locks and devices securely with Bluetooth commands. In this blog, we’ll explore the functionality of the BlueBot Door Lock Controller, delve into its code implementation, and explain how you can customize it for your needs.

BlueBot Door Lock Controller a customizable Bluetooth enabled system for secure door lock control. Learn how to use, modify, and enhance

What Is the BlueBot Door Lock Controller?

The BlueBot Door Lock Controller is a Bluetooth-enabled system that allows users to lock and unlock devices like servo motors or relays. When the lock icon is pressed on the app, a pop-up window prompts the user to enter a password. Once the correct password is entered, the app sends the appropriate command (“LOCK” or “UNLOCK”) to the controller. Additionally, the password and commands can be changed in the settings, making it a versatile tool for various projects. Please note that this system is for demonstration purposes only and should not be used in real-world security applications.

How to Download the BlueBot Controller App

To get started, download the BlueBot Controller App from the official source:

Make sure you have a Bluetooth-enabled smartphone to pair with your project.

Features of the BlueBot Door Lock Controller

  1. Bluetooth Connectivity: Seamlessly communicate with the controller using an app on your smartphone.
  2. Password-Protected Access: Ensures that only authorized users can send lock and unlock commands.
  3. LCD Display Feedback: Real-time status updates displayed on an I2C LCD screen.
  4. Servo Motor Control: Trigger servo motors to rotate for locking or unlocking mechanisms.
  5. Customizable Commands and Passwords: Users can change the commands (“LOCK”/“UNLOCK”) and the password in the settings.
  6. Dual Motor Support: The controller can trigger a servo motor, LED, or any other type of motor connected to the system.

Code Overview for the BlueBot Door Lock Controller

Below are two sample codes demonstrating how to implement the BlueBot Door Lock Controller for different hardware configurations.

Code Example 1: Servo Motor Door Lock System

#include <SoftwareSerial.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h> // Include the Servo library

// Define Bluetooth module RX and TX pins
SoftwareSerial bluetooth(2, 3); // RX, TX

// Define pins for the servo motor
#define SERVO_PIN 6 // Pin to control the servo motor

// Lock state variable
bool isLocked = true;

// Initialize the I2C LCD (address 0x27, 16 columns, 2 rows)
LiquidCrystal_I2C lcd(0x27, 16, 2);

// Create a servo object
Servo lockServo;

void setup() {
  // Initialize serial communication for debugging
  Serial.begin(9600);

  // Initialize Bluetooth communication
  bluetooth.begin(9600);
  Serial.println("Bluetooth Door Lock System Initialized");

  // Attach the servo to the defined pin
  lockServo.attach(SERVO_PIN);

  // Initialize the lock mechanism
  lockDoor(); // Start with the lock engaged

  // Initialize the LCD
  lcd.begin();
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("System Ready");
  delay(2000);
}

void loop() {
  // Check for incoming Bluetooth commands
  if (bluetooth.available()) {
    String command = bluetooth.readStringUntil('\n');
    command.trim(); // Remove extra spaces or newline characters

    if (command == "LOCK") {
      lockDoor();
    } else if (command == "UNLOCK") {
      unlockDoor();
    } else {
      Serial.println("Invalid command received");
    }
  }
}

// Function to lock the door (servo rotates to 90 degrees)
void lockDoor() {
  lockServo.write(90); // Rotate the servo to 90 degrees
  isLocked = true;
  sendFeedback("LOCKED"); // Send feedback to the phone
  updateLCD("Door Status:", "LOCKED");
}

// Function to unlock the door (servo rotates to 0 degrees)
void unlockDoor() {
  lockServo.write(0); // Rotate the servo to 0 degrees
  isLocked = false;
  sendFeedback("UNLOCKED"); // Send feedback to the phone
  updateLCD("Door Status:", "UNLOCKED");
}

// Function to send feedback to the phone
void sendFeedback(String message) {
  bluetooth.println(message); // Send the message via Bluetooth
  Serial.println("Feedback sent: " + message); // Print to serial monitor for debugging
}

// Function to update the LCD display
void updateLCD(String line1, String line2) {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print(line1); // Display the first line
  lcd.setCursor(0, 1);
  lcd.print(line2); // Display the second line
}

Code Example 2: Relay-Based Door Lock System

#include <SoftwareSerial.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Define Bluetooth module RX and TX pins
SoftwareSerial bluetooth(2, 3); // RX, TX

// Define pins for the lock mechanism
#define LOCK_PIN 13 // Pin to control the lock (e.g., servo or relay)

// Lock state variable
bool isLocked = true;

// Initialize the I2C LCD (address 0x27, 16 columns, 2 rows)
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
  // Initialize serial communication for debugging
  Serial.begin(9600);

  // Initialize Bluetooth communication
  bluetooth.begin(9600);
  Serial.println("Bluetooth Door Lock System Initialized");

  // Initialize the lock mechanism pin
  pinMode(LOCK_PIN, OUTPUT);
  lockDoor(); // Start with the lock engaged

  // Initialize the LCD
  lcd.begin();
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("System Ready");
  delay(2000);
}

void loop() {
  // Check for incoming Bluetooth commands
  if (bluetooth.available()) {
    String command = bluetooth.readStringUntil('\n');
    command.trim(); // Remove extra spaces or newline characters

    if (command == "LOCK") {
      lockDoor();
    } else if (command == "UNLOCK") {
      unlockDoor();
    } else {
      Serial.println("Invalid command received");
    }
  }
}

// Function to lock the door
void lockDoor() {
  digitalWrite(LOCK_PIN, HIGH); // Engage the lock
  isLocked = true;
  sendFeedback("LOCKED"); // Send feedback to the phone
  updateLCD("Door Status:", "LOCKED");
}

// Function to unlock the door
void unlockDoor() {
  digitalWrite(LOCK_PIN, LOW); // Disengage the lock
  isLocked = false;
  sendFeedback("UNLOCKED"); // Send feedback to the phone
  updateLCD("Door Status:", "UNLOCKED");
}

// Function to send feedback to the phone
void sendFeedback(String message) {
  bluetooth.println(message); // Send the message via Bluetooth
  Serial.println("Feedback sent: " + message); // Print to serial monitor for debugging
}

// Function to update the LCD display
void updateLCD(String line1, String line2) {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print(line1); // Display the first line
  lcd.setCursor(0, 1);
  lcd.print(line2); // Display the second line
}

How to Customize the BlueBot Door Lock Controller

1. Change Password

Modify the password in the app settings to enhance security and adapt to your project requirements.

2. Update Commands

Switch from the default “LOCK” and “UNLOCK” commands to custom commands suitable for your application.

3. Add More Devices

Use the Bluetooth communication protocol to control additional devices like LEDs, relays, or other motors.


Applications

  1. Smart Home Automation: Control door locks and security systems remotely.
  2. Project Demonstrations: Showcase IoT and automation concepts effectively.
  3. Education: Teach Bluetooth and embedded systems integration in a practical way.

Download BlueBot Controller App and start your journey today!

Home Page