CherryLock is a project for Students' Council in Technikum Mechatroniczne nr 1. It's a system that unlocks the door when corect tag is read by scanner located on the wall. Thanks to it, only certain people can enter the SU (Samorząd Uczniowski/Students' Council) on their own. CherryLock also enables users to open the door remotely using standalone button, placed inside the room. Usage (successful tag opens and button presses) is logged on the SD card. I'm in process of developing a app (CherryLock Manager) that allows administrators to check on logs, add and remove new people from database and a few more things.
Here's flowchart explaining that:
Yep, that's it. It's that easy to use! It uses only one tag for adding/removing alllowed tags to the system on the fly.
Access card ID's and other stuff is stored on internal EEPROM of the Arduino. Be careful when you adapt it for your own purpose - EEPROM has a limited write cycles, roughly about 100 000. It's better to add all allowed tags at once, before implementing CherryLock. Also, be careful when it comes to deleting stuff - that also eats those write cycles, even more efectively than the standard addition of the tag! The way that deletion works is by shifting all data placed after the chosen value by 4 bytes to the left (it's more like copying right to left and then setting last 4 occupied adresses's values of memory mapping to 0, but let's call it shifting). See, it can hurt those poor write cycles :(
EEPROM on Arduino UNO has 1024 bytes of space. In this section I will explain what belongs to where. First, let's start with basics. Adress space of EEPROM is 0-1023 - each adress belonging to each byte. My notation is simple:
[45]
referes to adress 45,[45:4]
referes to 32-bit (4-byte) word, starting from adress 45.
So, now when notation is explained - here's the mapping:
[0] |
Number of cards added. Used to determine where to search for card's ID's. |
[1] |
Contains 42, if the master card is defined. If other value is contained, then after restart system will ask you to define master card. |
[2:4] |
Master card's ID. |
[6:4] |
List of access cards' ID's. There's space for 253 cards. |
Work in progress
Arduino Pin | Signal |
0 | Serial RX |
1 | Serial TX |
2 | Wireless Open Button |
3 | Wipe Button |
4 | Relay Enable |
5 | Blue LED |
6 | Green LED |
7 | Red LED |
8 | MFRC522 MOSI |
9 | MFRC522 MISO |
10 | MFRC522 SCK |
11 | SD MOSI |
12 | SD MISO |
13 | SD SCK |
A0 | MFRC522 SS |
A1 | MFRC522 RST |
A2 | SD SS |
A3 | [Reserved for SD Full LED, to be done] |
A4 | SDA (Now used only for RTC) |
A5 | SCL (Now used only for RTC) |