Differences

This shows you the differences between two versions of the page.

Link to this comparison view

iothings:proiecte:2023:smartlock [2024/01/16 00:27]
cristina.mustatea created
iothings:proiecte:2023:smartlock [2024/01/16 11:17] (current)
cristina.mustatea removed "datasheet"
Line 1: Line 1:
-=== Smart Cabinet Lock ===+==== Smart Cabinet Lock ====
 ---- ----
 Student: Cristina-Amalia Mustățea\\ Student: Cristina-Amalia Mustățea\\
 Master: SCPD\\ Master: SCPD\\
 Git Repo: https://​github.com/​cozzoo/​SmartLock.git\\ Git Repo: https://​github.com/​cozzoo/​SmartLock.git\\
-Video Demo:\\ +Video Demo:https://​drive.google.com/​file/​d/​1CLmVIQDFO4Gkl8qLKqH47F718Nh1zUgw/​view?​usp=sharing\\ 
-Slides: https://​docs.google.com/​presentation/​d/​15u2QfCTyhC0O2Ejqf5nhIk7VQ9atWrWkD72XmPtRX9A/​edit?​usp=sharing\\+Slides: https://​docs.google.com/​presentation/​d/​1a5u2QfCTyhC0O2Ejqf5nhIk7VQ9atWrWkD72XmPtRX9A/​edit?​usp=sharing\\
 ---- ----
 === Project Description === === Project Description ===
Line 16: Line 16:
   * Power Source - rated 12V & 2A\\   * Power Source - rated 12V & 2A\\
   * 12V White LED   * 12V White LED
-  * L289N Motor Driver Module ​(datasheet): https://​www.handsontec.com/​dataspecs/​module/​L298N%20Motor%20Driver.pdf\\+  * L289N Motor Driver Module: https://​www.handsontec.com/​dataspecs/​module/​L298N%20Motor%20Driver.pdf\\ 
 +  * Prototyping board, soldering and jumpers 
 +  * One 50kOhm resistor
  
-{{ :​iothings:​proiecte:​2023:​smartlock.png?​direct |}}+{{ :​iothings:​proiecte:​2023:​smartlock.png?​direct&​700 ​|}}
 \\ \\
 ---- ----
 +=== Project Setup ===
 +I used a simple plastic storage container with 2 drawers to be able to easily create my prototype. I also chose this model to be able to drill through the plastic and arrange my components to it's design is more pleasant. \\
 +I hid the ESP controller, the LED and the motor driver under this top lid. I wanted to be able to still access the board in case modifications to the [[https://​github.com/​cozzoo/​SmartLock/​blob/​main/​ESP32Sketch/​SmartLock-ESP.ino | Arduino sketch]] needed to be done.
 +{{ :​iothings:​proiecte:​2023:​20240105_172522.jpg?​direct&​300 |}} \\
 +In the back of the container, I have the input for the 12V power source, as well as the Reed sensor which registers whether or not the door has been opened. The initial Reed sensor broke after I initially added it. I has a spare 3-pin module. After connecting it I saw it worked without a problem, so I chose to leave it as it was.
 +{{ :​iothings:​proiecte:​2023:​20240105_172530.jpg?​direct&​300 |}} \\
 +Finally, the lock was mounted so that it would rest against the drawer and not let it open, unless the command from the user has been received.
 +{{ :​iothings:​proiecte:​2023:​20240105_172527.jpg?​direct&​300 |}} \\
 +----
 +=== Software Architecture ===
 +I used Arduino IDE to program the ESP32 controler. I also based my approapch based on the example project in the [[smartlock#​Other Resources | Other Resources]] section. \\
 +Each query to Firebase is done every 3 seconds so as not to overload the DB and potentially create lag due to many requests. \\
 +\\
 +The lock is designed to be normally closed. So when sending an "​open"​ command, we actually drive the lock and maintain it in that state for 10 seconds, so users can have enough time to open the drawer and take what they need.
 +<​code>​
 +#define DB_QUERY_INTERVAL 3000 //wait 3 seconds between each query
 +#define DOOR_UNLOCK_TIME 10000 //unlock the door for 10 seconds
 +</​code> ​
 +== Firabase Fields ==
 +{{ :​iothings:​proiecte:​2023:​firebasefields.png?​direct&​300 |}} \\
 +  * **door_open_counter**:​ monitors how many times the door has been opened;
 +  * **door_unlock**:​ the command received from the user's input through the web app. It is then send from Firebase to the controller;
 +  * **home_away_mode**:​ when the user sets this mode, they can receive notifications when the container has been opened, although it was not meant to be.;
 +  * **home_away_triggered**:​ we monitor the state of the mode;
 +  * **switch_state**:​ monitors the state of the Reed sensor
 +== App Architecture ==
 +{{:​iothings:​proiecte:​2023:​webapp.drawio.png?​direct&​700|}}\\
 +== Web App ==
 +The web app was created using HTML, CSS and JavaScript.\\
 +\\ Users can chose to activate/​deactivate the **Home Away** mode.
 +{{ :​iothings:​proiecte:​2023:​homeaway.png?​direct |}} \\
 +{{:​iothings:​proiecte:​2023:​hoverunlock.png?​direct|}} \\
 +{{:​iothings:​proiecte:​2023:​hoverlocked.png?​direct|}}
 +\\ **Unlock** commands are possible with just the press of a button.
 +----
 +=== Conclusions ===
 +I enjoyed making this prototype. I also learned a lot about the ESP32 controller and the interconnectivity it has with other platforms. It is cheap and reliable, while delivering suitable functionalities for an IoT project. ​
 +----
 +=== Further Work ===
 +I was also interested of using the [[https://​cordova.apache.org | Cordova]] framework to transform the web app to a native Android APK file. So users can also have access to some nicer features, inherent to mobile devices. This would bring the project closer to an actual physical implementation,​ which could potentially be marketed, improved, and shrunk down (maybe integrated, as well). ​
 +----
 +=== Other Resources ===
 +Followed this tutorial to create my initial web app: https://​randomnerdtutorials.com/​esp32-firebase-web-app/#​install-nodejs.
 +----
 +=== Bibliography ===
 +https://​firebase.google.com \\
 +https://​firebase.google.com/​docs/​database/​web/​read-and-write#​web-namespaced-api_3
 +
iothings/proiecte/2023/smartlock.1705357667.txt.gz · Last modified: 2024/01/16 00:27 by cristina.mustatea
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0