Skip to main content

Arduino Systems: Simple Bluetooth Door Lock

HELLO THERE!!

   How are you guys? As usual, I hope everyone is fine and in good mood always. This week, I would like to share with you guys a simple system I made through out the weekend, a simple bluetooth door lock. Without further wasting our time, let's get straight to requirements of the system.

HARDWARE:
1. ARDUINO UNO
2. HC-06 BLUETOOTH MODULE

3.SERVO MOTOR

4.DOOR LATCH/DOOR LOCK( I used the door lock as shown in the image below)
5.THIN GAUGE WIRE/THIN STEEL WIRE/ KEYCHAIN RING


SOFTWARE:
1. ARDUINO IDE
2.MIT APP INVENTOR




CIRCUIT ASSEMBLY:

  What  I did first is to tie or attach the servo motor to the latch as shown in the image below
.

After tying in the servo with the latch, the servo must be put in a suitable position( preferably in the middle of the latch) so that the open/close motion can be achieved properly. The connection of the servo with other peripherals of the circuit is shown below:


CODING THE ARDUINO:

 I would like to divide this into two parts:
a)MIT app inventor 
b)Arduino

  a)MIT app inventor

      I had used this online software to design and code the interface for my door lock project. By designing the interface, I can control the door lock by using my smart phone via bluetooth connection.

The Interface of the door lock controller
        
The code block that is used to code the interface
 From the code block shown:
i) Listpicker is used to list out all the options ( in this case bluetooth connection). So, before picking, the listpicker will list out all available connections. After picking, the listpicker will set the bluetooth connection to the selected connection from the list
ii) When button is clicked, whatever in the test box will be sent to the other side of the bluetooth connection

b)Arduino Coding

The arduino code(including the comments) are shown below:


#include<Servo.h> // include server library
Servo ser; // create servo object to control a servo
int poser = 0; // initial position of server
String openup, closedown;//string variables


void setup() {
  Serial.begin(9600); // Serial comm begin at 9600bps
  ser.attach(7);// server is connected at pin 7

  openup = String("open");//string variable consists of the string shown
  closedown = String("close");

}

void loop() {
  while(Serial.available()) //read while data is present
  {
    
    String value = Serial.readString(); //value read string from MIT
    Serial.println(value);
    if (value == openup)//if the string received is open
    {
     int pos =- 50;//position - 50
     ser.write(pos);//servo will move accordingly
     delay (15);
  }
  if (value == closedown)//if the string received is closed
    {
     int pos =+ 50;//position +50
     ser.write(pos);//servo will move accordingly
     delay (15);
       
  }
  
  }
}


    Upload the code to the Arduino and test it out!!. Connect your smartphone to the Arduino via bluetooth and start controlling the door lock!!You know what's cool? You can also use the Voice to Arduino code (http://halim930112.blogspot.my/2016/02/voice-to-arduino.html) from my instructables(i'll try putting this experiment to my instructables also) to control the door lock!! This means you can control your door lock by voice control!!

A demonstration video for this system is shown below:



Well, that's all from me for this week guys. I hope to see you guys next week. Till then, HAPPY TINKERING.



Comments

Popular posts from this blog

Arduino and Multi Function Shield: Pots,LEDs and buzzers

HELLO THERE!!!!!    How are you guys? I hope everyone is fine and in good mood always. This week, I continue my tinkerings with the Multi Function Shield. In this experiment, I used the potentiometer in the shield to control the LEDs in the shield. Without further wasting time, let's jump in straight to the experiment!! HARDWARE 1.ARDUINO UNO  2.MULTI-FUNCTION SHIELD SOFTWARE: 1. ARDUINO IDE CIRCUIT ASSEMBLY    The circuit assembly is fairly simple. Just attach the multi function shield on top of Arduino properly. Please attach the shield properly as failure to do so would cause the shield  not to function as intended. CODING THE ARDUINO: Let's refer to the multi-function shield image below: Referring to the image of the shield, it can be seen that the potentiometer (blue object near buttons) is connected to pin A0 (analog 0)     int pot = A0; //declaring the pot ...

Arduino Beginner Experiments: Arduino and Light Blocking Sensor

HELLO THERE!!!     How are you guys? I hope everyone is fine and in a good mood always. This week, I would like to share with you guys my experiment on Arduino and Light Blocking Sensor. The objective of this experiment is to receive feedback from the sensor ( Digital and Analog) What is Light Blocking Sensor?      A linear hall sensor is a type of sensor which responds when the sensor is blocked out from light. The sensor is different for LDR's as LDR's responds to the amount of light it received while the light blocking sensor responds if the light is blocked out or not from the sensor.It can be used for both digital and analog measurements. HARDWARE: 1.Arduino UNO 2. Light Blocking Sensor SOFTWARE: 1.Arduino IDE CIRCUIT ASSEMBLY   Let's refer to the image of the blocking sensor below: The Connection of the Sensor to the Arduino is shown below: SENSOR  ----->       ARDUINO Signal   ...

Arduino Tinkering : Controlling multiple LED with multiple potentiometers

HELLO THERE!!!!            How are you guys? I hope everyone is fine and well always. For this week's post, I would like to share with you guys a simple tinkering on Arduino, LED, and potentiometers. The objective of the experiment is to light up different amount of LED's with different intensity by controlling two potentiometers. Before starting, of course, we need to know what items are needed. The items needed are: 1. Arduino UNO   2. 4 to 5 LEDs 3. 2 Potentiometers The software used in this experiment is: 1. Arduino IDE. Now that all the hardware and software are obtained, let's go to the schematics of the circuit. The circuit is quite simple actually. The long legs of the LED's were connected to PWM pins while the shorter legs were connected to ground. The potentiometers however have three legs. The middle leg is connected to the analog pins (A0, A1) while the other two legs were connected to 5V and GND respect...