Private Lock Box With Pin Code - Bluetooth Activated Lock
by TechMartian in Circuits > Arduino
2862 Views, 9 Favorites, 0 Comments
Private Lock Box With Pin Code - Bluetooth Activated Lock
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
Measure the size of the box that you want and mark it on a piece of foam board.
Cut
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
Glue the sides of the box together except for the lid with a hot glue gun
Glue Hinge
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
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
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
Glue hinges of the Lid onto the box with hot glue.
That's it for the box!
Wiring
* 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
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
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!
Enjoy your privacy with your new private lock box!