Smart Cabinet Lock

Project Description

The project depicts a Smart Cabinet Lock System. This is a user-friendly security solution designed to safeguard your personal belongings. This system offers remote access control, enabling you to lock and unlock your cabinet or drawer from anywhere. The system will be equipped with an LED that automatically illuminate the drawer's contents when opened and turn off when closed, providing convenience and energy efficiency. A unique feature of this system is its ability to count the number of times the drawer is opened or closed in a day, providing valuable insights into usage patterns. Additionally, the system is programmed to send alerts for any unusual activities.

Hardware Description

This is the component list of the setup:



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 Arduino sketch needed to be done.
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.
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.


Software Architecture

I used Arduino IDE to program the ESP32 controler. I also based my approapch based on the example project in the 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.

#define DB_QUERY_INTERVAL 3000 //wait 3 seconds between each query
#define DOOR_UNLOCK_TIME 10000 //unlock the door for 10 seconds
Firabase Fields


  • 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


Web App

The web app was created using HTML, CSS and JavaScript.

Users can chose to activate/deactivate the Home Away mode.


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 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

iothings/proiecte/2023/smartlock.txt · Last modified: 2024/01/16 11:17 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