keyless door entry via bluetooth technology
TRANSCRIPT
![Page 1: Keyless Door Entry via Bluetooth Technology](https://reader033.vdocuments.mx/reader033/viewer/2022042602/55c68602bb61eb8c118b45c7/html5/thumbnails/1.jpg)
MOBILE PAYMENTS, E-COMMERCE SECURITY, AND CRYPTOCURRENCY - 30319
PROJECT
DATE CLIENTJUNE 10TH, 2015
KEYLESS DOOR ENTRYVIA BLUETOOTH TECHNOLOGY BY MATT WEPPLER
![Page 2: Keyless Door Entry via Bluetooth Technology](https://reader033.vdocuments.mx/reader033/viewer/2022042602/55c68602bb61eb8c118b45c7/html5/thumbnails/2.jpg)
ProblemWe live in an increasing & ever evolving mobile world.
Yet some things are taking longer than other to catch up.
![Page 3: Keyless Door Entry via Bluetooth Technology](https://reader033.vdocuments.mx/reader033/viewer/2022042602/55c68602bb61eb8c118b45c7/html5/thumbnails/3.jpg)
Implementation
Bluetooth technology (NFC to follow)
Mobile app Android (iOS to follow)
Arduino (prototyping kit), microcontroller, bluetooth radio, servo
Existing single cylinder deadbolt lock.
![Page 4: Keyless Door Entry via Bluetooth Technology](https://reader033.vdocuments.mx/reader033/viewer/2022042602/55c68602bb61eb8c118b45c7/html5/thumbnails/4.jpg)
HARDWARE
![Page 5: Keyless Door Entry via Bluetooth Technology](https://reader033.vdocuments.mx/reader033/viewer/2022042602/55c68602bb61eb8c118b45c7/html5/thumbnails/5.jpg)
HardwareSingle Cylinder Deadbolt
Mobile Phone w/Integrated Bluetooth
Arduino
Bluetooth Module
Servo
![Page 6: Keyless Door Entry via Bluetooth Technology](https://reader033.vdocuments.mx/reader033/viewer/2022042602/55c68602bb61eb8c118b45c7/html5/thumbnails/6.jpg)
ANDROID APP
![Page 7: Keyless Door Entry via Bluetooth Technology](https://reader033.vdocuments.mx/reader033/viewer/2022042602/55c68602bb61eb8c118b45c7/html5/thumbnails/7.jpg)
Android AppScan for device(s)
Pair with device(s)
Lock/Unlock deadbolt
![Page 8: Keyless Door Entry via Bluetooth Technology](https://reader033.vdocuments.mx/reader033/viewer/2022042602/55c68602bb61eb8c118b45c7/html5/thumbnails/8.jpg)
Diagram
![Page 9: Keyless Door Entry via Bluetooth Technology](https://reader033.vdocuments.mx/reader033/viewer/2022042602/55c68602bb61eb8c118b45c7/html5/thumbnails/9.jpg)
Write the Android appOpen a socket to the bluetooth radio
public void openBTSocket() throws IOException { mBTSocket = mBTDevice.createRfcommSocketToServiceRecord(uuid); mBTSocket.connect(); mOutputStream = mBTSocket.getOutputStream(); mInputStream = mBTSocket.getInputStream(); listenForIncomingBTData(); Toast.makeText(getApplicationContext(), “Ready to send commands", Toast.LENGTH_SHORT).show(); }
public void listenForIncomingBTData() { ... commandResult.setText(data); ... }
public void sendLockCommandToBTHW(View view) throws IOException { mOutputStream.write(msg.getBytes()); Toast.makeText(getApplicationContext(), "Lock Command Sent", Toast.LENGTH_SHORT).show(); }
public void sendUnlockCommandToBTHW(View view) throws IOException { mOutputStream.write(msg.getBytes()); Toast.makeText(getApplicationContext(), "Unlock Command Sent", Toast.LENGTH_SHORT).show(); }
![Page 10: Keyless Door Entry via Bluetooth Technology](https://reader033.vdocuments.mx/reader033/viewer/2022042602/55c68602bb61eb8c118b45c7/html5/thumbnails/10.jpg)
![Page 11: Keyless Door Entry via Bluetooth Technology](https://reader033.vdocuments.mx/reader033/viewer/2022042602/55c68602bb61eb8c118b45c7/html5/thumbnails/11.jpg)
Write the Arduino sketch
int UNLOCK_POSITION = 0; int LOCK_POSITION = 90;
int btRxPin = 10; // bt RX-‐I pin <-‐-‐> arduino d10 pin (green jumper) int btTxPin = 11; // bt TX-‐O pin <-‐-‐> arduino d11 pin (yellow jumper) int servoPin = 9; // servo pin <-‐-‐> arduino d9 pin (yellow jumper) int servoPos = UNLOCK_POSITION;
void listenForCommands() { if (btSerial.available()) { handleBluetoothCommand(); } else if (Serial.available() > 0) { handleSerialCommand(); } else { //Serial.println("UNKNOWN HANDLER"); } }
Setup variables to store some key values.
Listen for input from a paired bluetooth device.
![Page 12: Keyless Door Entry via Bluetooth Technology](https://reader033.vdocuments.mx/reader033/viewer/2022042602/55c68602bb61eb8c118b45c7/html5/thumbnails/12.jpg)
Handle a “LOCK” command
Handle an “UNLOCK” command
void lockHardware() { if (servoPos != LOCK_POSITION) { for (servoPos = 0; servoPos < LOCK_POSITION; servoPos++) { servo.write(servoPos); delay(5); } servoPos = LOCK_POSITION; } }
void unlockHardware() { if (servoPos != UNLOCK_POSITION) { for (servoPos = LOCK_POSITION; servoPos > UNLOCK_POSITION; servoPos-‐-‐) { servo.write(servoPos); delay(5); } servoPos = UNLOCK_POSITION; } }
![Page 13: Keyless Door Entry via Bluetooth Technology](https://reader033.vdocuments.mx/reader033/viewer/2022042602/55c68602bb61eb8c118b45c7/html5/thumbnails/13.jpg)
![Page 14: Keyless Door Entry via Bluetooth Technology](https://reader033.vdocuments.mx/reader033/viewer/2022042602/55c68602bb61eb8c118b45c7/html5/thumbnails/14.jpg)
Support frame to hold the Lock & Electronics
![Page 15: Keyless Door Entry via Bluetooth Technology](https://reader033.vdocuments.mx/reader033/viewer/2022042602/55c68602bb61eb8c118b45c7/html5/thumbnails/15.jpg)
…and now the moment we’ve all been waiting for
![Page 16: Keyless Door Entry via Bluetooth Technology](https://reader033.vdocuments.mx/reader033/viewer/2022042602/55c68602bb61eb8c118b45c7/html5/thumbnails/16.jpg)
Challenges Faced
No experience developing with bluetooth technologies.
No Arduino experience, but the community is very helpful.
Servos… I went through 3 of them (stripped the gears)
Prototype Costs $$$
![Page 17: Keyless Door Entry via Bluetooth Technology](https://reader033.vdocuments.mx/reader033/viewer/2022042602/55c68602bb61eb8c118b45c7/html5/thumbnails/17.jpg)
Android Wear (coming soon).
![Page 18: Keyless Door Entry via Bluetooth Technology](https://reader033.vdocuments.mx/reader033/viewer/2022042602/55c68602bb61eb8c118b45c7/html5/thumbnails/18.jpg)