I chose to set up a Python script to implement the door lock logic. The source code is available on GitHub. The script has a straightforward (somewhat simplified) cycle of:
- Setting up the external hardware through the GPIO
- Loading the list of accepted card/tag IDs
- Checking if there's a card to be read
- If there is a card, check it against the list of accepted ones
- If authorized, blink the LEDs for feedback and open the door
The script is deployed through resin.io, which allows some practical benefits. First, we can observe the logs from the lock script through an online dashboard and see entry attempts including tag IDs. This is handy when adding a new ID to the system as no additional equipment is needed: just scan and check the logs. Second, new card/tag IDs are authorized through adding environment variables in the dashboard (setting a series of variables such as CARD_1 , CARD_2 , ... containing the IDs), so no additional programming is required!
There are additional settings, such as how long to keep the door open, or how fast to blink the LEDs.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.