Private Lock Box With Pin Code - Bluetooth Activated Lock

by TechMartian in Circuits > Arduino

2812 Views, 9 Favorites, 0 Comments

Private Lock Box With Pin Code - Bluetooth Activated Lock

IMG_20170827_142956.jpg

We all have some personal items we want to hide away from our pesky annoying siblings. Or maybe it's just me, but I've always felt like I want some privacy or at the very least have the peace of mind of knowing that someone's been snooping around.

I've devised a cheap and clever solution for all of us you simply want a little private box to protect our collectibles and keep things private! This is a bluetooth activated locked box with a pin code security system that will lock out for 5 minutes if the wrong password is entered, making it safe, secure, and private!

Measure and Outline

2016-08-25 08.11.21.jpg

Measure the size of the box that you want and mark it on a piece of foam board.

Cut

r+lRveJMRxWeN6a1ka6wCg_thumb_8f7.jpg

Cut the outlines on the foam board. For the dollarama type of foam board I find it easiest to do a 75% score and then snap it, then cut the paper on the other side.

Glue Box

IMG_2270.jpg

Glue the sides of the box together except for the lid with a hot glue gun

Glue Hinge

IMG_2273.jpg

Glue the two hinges on the lid of the box with a hot glue gun. Make sure that the orientation is correct by rotating the hinges or following the image shown above. Use a generous amount of hot glue to make it stick well.

Lock Mechanism

IMG_2278.jpg
IMG_2282.jpg

Glue two pieces of popsicle sticks perpendicular to each other, the glue it onto a servo horn to make the lock/hooking mechanism.

Then, glue this servo onto the front side of the box as shown in the picture.

Lid Handle

IMG_2281.jpg
IMG_2280.jpg
IMG_2279.jpg
IMG_2283.jpg
IMG_2284.jpg

Glue a handle like shown not he picture using popsicle sticks and a hot glue gun. Since the lid also acts as a double for the lock to hook onto, push the popsicle stick through to make the lid double sided.

* Make two small cuts on the top of the lid and insert the popsicle through.

* Then glue two perpendicular pieces onto the top and bottom pieces of the popsicle sticks sticking through the lid.

Glue the Lid Hinge

IMG_2276.jpg

Glue hinges of the Lid onto the box with hot glue.

That's it for the box!

Wiring

IMG_20170827_132427.jpg
IMG_20170827_132432.jpg
IMG_20170827_132416.jpg
IMG_20170827_141320.jpg
IMG_20170827_141405.jpg

* Connect the white pin of the servo motor to pin 9 on the Arduino.

* Connect the red pin of the servo motor to the 5V pin on the Arduino.

* Connect the black pin of the servo motor to the GND pin on the Arduino.

* Connect the barrel jack adaptor to the Arduino and glue the 9V battery onto the Lid.

Code

Screen Shot 2017-08-29 at 12.14.18 AM.png
Screen Shot 2017-08-29 at 12.14.20 AM.png

Change the board name of your Arduino 101, I called mine Tech Martian. Then, upload the following code onto the Arduino.

#include <CurieBLE.h>
 #include <Servo.h>
BLEPeripheral blePeripheral;  // BLE Peripheral Device (the board you're programming)
BLEService ledService("19B10000-E8F2-537E-4F6C-D104768A1214"); // BLE LED Service
//set BLE characteristic
       BLEUnsignedCharCharacteristic switchCharacteristic("19B10001-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite);
const int servoPin = 7;
const int passCode = 22;
Servo servo1;
 void setup()
{
  //attach servo
  servo1.attach(servoPin);
  
  // set advertised local name and service UUID:
  blePeripheral.setLocalName("Tech Martian");
  blePeripheral.setAdvertisedServiceUuid(ledService.uuid());
  // add service and characteristic:
   blePeripheral.addAttribute(ledService);
   blePeripheral.addAttribute(switchCharacteristic);
   // set the initial value for the characeristic:
    switchCharacteristic.setValue(0);
   // begin advertising BLE service:
   blePeripheral.begin();
   servo1.write (90);
 }
void loop() 
{
  // listen for BLE peripherals to connect:
 BLECentral central = blePeripheral.central();
 // if a central is connected to peripheral:
  if (central)
  {
   // while the central is still connected to peripheral:
    while (central.connected())
    {
      // if the remote device wrote to the characteristic,
      // use the value to control the LED:
      if (switchCharacteristic.written())
      {
          // any value other than 0, turn on the LED
         if (switchCharacteristic.value() == passCode) 
         {  
         servo1.write (90);     
         } 
      //else lockout for 5 minutes
       else 
      {                              
        servo1.write (180); 
        delay(5*60*1000);     
      }
      }
     }
    }
  }

App

Screenshot_20170827-010506.jpg
Screenshot_20170827-140711.png
Screenshot_20170827-140719.png
Screenshot_20170827-140732.png
Screenshot_20170827-140729.png
Screenshot_20170827-140800.png
Screenshot_20170827-140818.png

Download nRF Master Control. Connect to the your Arduino 101 board, the name of which you chose int he previous step.

* Connect to your Arduino 101 Board.

* Click the Upload Button

* Enter your password

Enjoy!

IMG_20170827_141519.jpg

Enjoy your privacy with your new private lock box!