The moment has finally arrived! It is time to reveal the result of what we have been working on for many weeks now, an interactive locker that fits into the environment at DTU!
Design of the cabinet
Above you can see the CAD rendering of the locker, which we would have made into a functioning prototype sans corona. On the aesthetic side of things, we have worked on achieving a feel that is coherent with the visual identity of DTU campus Lyngby. That means following the design guide for typography and iconography.
The whole thing should be manufacturable with the materials available in DTU skylab, with as few “out of the house” components as possible. The electronics panel is accessible from the back, where there is room for a power rail in the bottom. We are using the RFID reader on the front for maintenance opening of the locker, using the master key as described in the code bits.
For more details, including hardware integration, see the post detailing the build a little further.
Using the Locker
To illustrate the use of the locker, we have created two storyboards. In both user scenarios, the user begins by discovering a free locker, putting the items of their choice into it, and closing the cabinet. Afterwards, the user has two different options for locking the cabinet; They can use an app, or they can use their student ID card or credit card. If they use a card, they will scan the card on the card reader, and the OLED screen will display information concerning the time the locker will automatically open. When the user wants to unlock the cabinet, they simply scan their card again.
If they use the app, the user will scan the QR code on the door, which will direct them to an app where they are required to enter email, name and a password of their choice. They will then receive an email with a confirmation of their chosen code, and a time for when the locker is unlocked. When the user wants to attain their belongings again, they go on the app and enter their name and password.
The locker has a time limit of 6 hours. The locker will automatically unlock after this time. The janitor, or whoever is in charge of the lockers at DTU, has a “master key”. This is a chip that will open any locker at any time.
Coding the damn thing
Because of corona and complications with components, we were forced to make some alterations in the hardware. Instead of an actual lock, we have used an LED to simulate when the lock is open (light on) or locked (light off). We have in addition to this integrated a button, to simulate when the cabinet is open (button unpressed) or closed (button pressed). More high level info on this page.
NodeRed
The first coding activated when a user signs in, is the detection of whether the app or the card login option is chosen. In the blog post Login via nodeRed we have described some of the process of developing this part of the code. One of the usability features that we wanted to implement, was that the locker should be able to detect whether the cabinet is closed, before the user locks it. We have therefore added a loop that is activated when a user has signed in, and detects whether the door is open or closed. If the door is open, a message is printed in the app that reminds the user to close the cabinet. Another important functionality is that it is impossible for a user to overwrite another user's reservation of the locker. We have solved this by creating two different app interfaces - a sign-up interface when the payload NODEREDSIGNUP is 0, and a login interface when the payload is 1.
The MCU fetches information about the weather forecast every five minutes. There is a specific function for this in the code, that gets called every five minutes. The OLED-screen then displays three different weather forecasts, when nothing else of interest is being displayed on the screen (such as information about reading the card).
OLED
The OLED-code has been structured using a switch case. What the OLED should display in different situations is specified in the OLED-function. Each situation is given a case, so that it will be easier to call the oled function with a specific case. This will minimize the amount of oled-lines in other parts of the code. We only have to choose a case for the OLED.
RFID
The RFID scanner constantly scans for new RFID chips in its range. If it finds one we save its UID (Unique IDentifier). This value will be stored as the user’s way of entry. A boolean changes value to let the locker know that it is now in locked mode. If another card goes by the RFID scanner, during this locked mode, the locker will check if its UID is the same as the stored value. If it is, the locker will open, if not the locker will remain closed and display a message on the OLED. Furthermore if the locker is in locked mode because of the RFID sensor, it will send a message to NodeRed via MQTT to let it know.