@ELECTRONOOBS
6 hours ago
Make a bluetooth app and open your door with it and Arduino. Download STL files for free
by: ELECTRONOOBS on 2026-05-26
The scheamtic is the same as in the other example. The only thing that is different is that we've connected this HC-05 bluetooth module to our Tx and Rx pins of the arduino which are pin 1 and 0. Remember to connect the UART pins cruced. That means that the Rx pin from the module goes to the Tx pin of the arduino and viceversa.

Just mount this new schematic and upload the next code. The system will work in the same way but now whenever the app button is pressed the door will open or close. Is like the App is the key to this door. You have to download the next app and upload it to your smartphone and install it. The app will send a "c" when close and a "o" when open. In the arduino code we receive that and move the servo motor.

Install the app. Open bluetooth setting on your smartphone. Start the Arduino with the bluetooth module connected. Search for new devices on your phone. Connect using 0000 or 1234 password. Now open the app and connect to the new devie. Pres the lock to open or close the door. The next code is the one for the bluetooth connetion as well.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>
#include <Keypad.h>
LiquidCrystal_I2C lcd(0x3f, 20, 4);
Servo myservo;
// Variables & Pins
int mot_min = 90;
int mot_max = 180;
int character = 0;
int activated = 0;
char Str[17] = " -*** "; // 16 chars + null terminator
int buzzer = 11;
int external = 12;
int internal = 13;
// Keypad Config
const byte ROWS = 4;
const byte COLS = 4;
char hexaKeys[ROWS][COLS] = {
{'1','4','7','*'}, {'2','5','8','0'}, {'3','6','9','#'}, {'A','B','C','D'}
};
byte rowPins[ROWS] = {5, 4, 3, 2};
byte colPins[COLS] = {9, 8, 7, 6};
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void setup() {
Serial.begin(9600);
myservo.attach(10);
pinMode(buzzer, OUTPUT);
pinMode(external, INPUT);
pinMode(internal, INPUT);
lcd.init();
lcd.backlight();
resetSystem();
}
void loop() {
// Android Bluetooth / Serial Input
if (Serial.available() > 0) {
char received = Serial.read();
if (received == 'o') openDoor(" ANDROID OPEN");
if (received == 'c') resetSystem();
}
// Emergency / Inside Buttons
if (digitalRead(external)) {
openDoor("INSIDE OPEN");
}
if (digitalRead(internal) || (activated == 2 && customKeypad.getKey() == 'B')) {
resetSystem();
}
// Keypad Input Logic
char customKey = customKeypad.getKey();
if (customKey && activated == 0) {
// Keypress Audio Feedback
analogWrite(buzzer, 200);
Serial.println(customKey);
if (character < 5) {
Str[6 + character] = customKey;
character++;
if (character < 5) {
showScreen(" PASSWORD", Str);
} else {
activated = 1; // 5th character entered, ready to verify
}
}
delay(100);
analogWrite(buzzer, LOW);
}
// Password Verification
if (activated == 1) {
// FIXED: Changed assignment Str[10]='A' to comparison Str[10]=='A'
if (Str[10] == 'A' && character == 5 && Str[6] == '3' && Str[7] == '0' && Str[8] == '0' && Str[9] == '7') {
openDoor("ACCEPTED");
} else {
showScreen("PASSWORD ERROR", " TRY AGAIN");
analogWrite(buzzer, 150);
delay(3000);
analogWrite(buzzer, LOW);
resetSystem();
}
}
}
// --- HELPER FUNCTIONS FOR EFFICIENCY ---
void showScreen(const char* line1, const char* line2) {
lcd.clear();
lcd.setCursor(0, 0); lcd.print(line1);
lcd.setCursor(0, 1); lcd.print(line2);
}
void playBuzzer() {
int tones[] = {240, 200, 180, 250};
for (int i = 0; i < 4; i++) {
analogWrite(buzzer, tones[i]);
delay(250);
}
analogWrite(buzzer, LOW);
}
void resetSystem() {
myservo.write(mot_min);
activated = 0;
character = 0;
strcpy(Str, " -*** ");
showScreen(" PASSWORD", Str);
}
void openDoor(const char* initialMsg) {
myservo.write(mot_max);
showScreen(initialMsg, "");
activated = 2;
playBuzzer();
delay(1000);
showScreen(" WELLCOME", " ELECTRONOOBS");
delay(1000);
showScreen(" DOOR OPEN", " ELECTRONOOBS");
}
So, upload this code. The "customKeypad.getKey()" function will read the pressed key. The function will read just one key at a time and if you keep pushing the button it won't start reading more keys. You can see in the code that first we use the "internal" and "external" pins to open/close the door using the two push buttons. Then we read the pressed key and start editing the password "characters". When the all the 4 charracters were inserted we check if those are the same as the one that we want. If they are we open the door with the servo. If not, we give an error.
To change your password just go to the line from the photo below and change each of the four Str values. In this example the password is 3007. The "A" character will be the "OK" and the "B" will be the "close".
Now that everything is ready, turn on the Arduino and start typeing your password. Press "A" for OK when all the 4 characters were inserted. To close the door press "B". I hope you'll enjoy this tut.
@ELECTRONOOBS
6 hours ago
Leave a comment
Please login in order to comment.