Project showcase
Smart BT Door Lock (Simple Arduino)

Smart BT Door Lock (Simple Arduino) © GPL3+

This is a simple project made with Arduino Uno R3. The aim is to control a door lock without keys but using a smart phone instead.

  • 10,609 views
  • 1 comment
  • 22 respects

Components and supplies

Apps and online services

About this project

Code

smart lockArduino
download it!
#include <Servo.h>
/*0-lock position,170-open position*/
Servo lock;

void setup() 
{
 lock.attach(2);
 Serial.begin(9600);
 lock.write(0);
 delay(500);
 }
void loop() 
{
  int i;
  int s=1;
  start:
  int a;
  if(Serial.available()>0)
  {
    a=Serial.read();
    if(a==9&&(s==1))
    {
     for(i=0;i<=170;i++)
     {
       lock.write(i);
       delay(7);
     }
     Serial.print("OPEN");
     s=0;
    }
    if((s==0)&&(a==5))
    {
      for(i=170;i>=0;i--)
    {
       lock.write(i);
       delay(7);
    }
    Serial.print("LOCKED");
    s=1;
      }
  }
  goto start;
}

Schematics

connection
After connecting the Bluetooth module, connect the servo:

SERVO CONNECTION
1. Orange --- Arduino Pin 2
2. Red --- Arduino 5v
3. Brown --- Arduino GND
F9k2he0j8agpxgs medium 4ttlwkchig

Comments

Similar projects you might like

Smart BT Lock with Custom Number

Project tutorial by jegatheesan

  • 4,201 views
  • 2 comments
  • 22 respects

Coolest Door Lock Ever

Project tutorial by Vivek Gupta

  • 2,943 views
  • 0 comments
  • 9 respects

Grovey sLocks - Access Control Through A Smart Door Lock

Project tutorial by gerrikoio

  • 998 views
  • 0 comments
  • 6 respects

Password Based Door Lock

Project tutorial by Rishabh

  • 13,712 views
  • 6 comments
  • 27 respects

Keypad operated door lock

Project tutorial by andrea

  • 4,400 views
  • 1 comment
  • 5 respects
Add projectSign up / Login