Arduino Bluetooth Slide Lock

Make a Arduino smart slide lock that can be controlled via Bluetooth!

Step 1: Parts

What you'll need:
Arduino Uno/Nano: uno (Elegoo clone): uk, us - nano (Elegoo clone): uk, us

Breadboard Jumper Wires: uk, us

Slide lock: uk, us

HC05 Arduino Bluetooth module: uk, us

Servo Motor: uk, us

Step 2: Wiring

Now you need to wire the circuit.

Servo:

Brown/Black -> GND

Red -> 5V

Yellow -> Digital 9

Bluetooth Module:

RXD -> TX (pin 1)

TXD -> RX (pin 0)

GND -> GND

VCC -> 3.3V

NOTICE: While RXD and TXD are plugged into the Arduino, you will not be able to upload code. When you need to upload code, disconnect these wires, upload the code and then reconnect them.

Step 3: Test

To make sure all the components are working, try the sweep servo sketch on the Arduino and try pairing a device with the Bluetooth module (the passcode is 1234). If everything is good, attatch the servo to the lock with tape or glue.

Step 4: Code

#include Servo myservo;

int pos = 0;

int state;

int flag=0;

void setup() {

myservo.attach(9);

Serial.begin(9600);

myservo.write(65);

delay(1000); }

void loop() {

if(Serial.available() > 0) {

state = Serial.read();

flag=0; }

// if state = '0' the servo will lock the door

if (state == '0') {

myservo.write(9);

delay(500);

Serial.println("Door Locked"); }

else if (state == '1') {

myservo.write(60);

delay(500);

Serial.println("Door Open"); } }

Step 5: Controlling the Lock

Download the app Bluetooth Terminal for Android or an equivalent for whatever device you have.

Pair the Bluetooth module with your device (pass: 1234)

In Bluetooth Terminal, select the menu icon in the top right corner and click "Connect a device - Insecure".

Enter 1 to open the door and 2 to lock it.

Step 6: Fix the Lock to the Door

Now all you have to do is fix the lock to the door!

Make sure that everthing works and that you can get inside.

I reccomend adding a powerbank which is constantly connected to mains to power the device in case there is a power cut and you still need to open the lock.

Have fun (:

Share

    Recommendations

    • Trash to Treasure

      Trash to Treasure
    • Organization Contest

      Organization Contest
    • Remix Contest

      Remix Contest

    Discussions

    0
    None
    audreyobscura

    3 days ago

    Do you think the tape will wear out over time?