A neat section of code in the iLocker is the portion that allows the user to change the combination. The user must use pushbutton navigation to select “Change Code” in the menu. Upon selecting this option, the program prints “Enter the Combination” to the LCD screen, followed by a reading of the current combination digit, the current combination entry, and the current status of the iLocker (‘Waiting…’).
This display is the same as that if you were simply trying to unlock the iLocker. It will give the same status indicators, except if you enter the correct combination, it will bring up a new display that says “Enter New Combination”. At this time, the user can input a new combination using the same process outlined for entering a combination normally. Once the user has enter four digits successfully, the program will automatically re-write to the EEPRROM with the entered value at the address location 0x00. This will then allow the user to unlock the device with the new password, even if the device restarts or resets in the event of a power failure. A portion of the code responsible for storing the new combination in EEPROM is shown below.
We used a potentiometer as our input for the iLocker. A 10k-Ohm potentiometer is wired to the A3BU’s onboard 3.3V and GND for power. The output of the potentiometer is wired to the ADC0 header pin on the board. This allows the potentiometer to vary input voltage to the A3BU analog to digital converter as it is turned. These variations of voltage are used to decide the combination entry. In addition to the potentiometer, a green LED is wired in series with a 220 Ohm resistor while voltage is supplied by the PA0 pin on the board. This LED is used as a lock status indicator. The LED shows a solid color for a correct combination, and flashes for an incorrect combination.
The concept of the iLocker came from old-school dial combination locks where the user turns the dial to select a sequence of numbers. If this sequence of numbers is correct, the lock opens; if not, the lock remains locked. Team Whirlaway decided to take this design into the world of microprocessors. The concept for our project is to use a potentiometer as the combination dial. Using the analog input from the potentiometer to the A3BU, the LCD displays each number selected by the potentiometer. The microprocessor compares the input combination to the correct combination and informs the user of the lock/unlock status. If the combination is correct, the LED located on the breadboard will turn on and stay a solid color. If the combination is incorrect, the LED will flash on and off. The user is able to change their combination by selecting the option in the main menu. If this project were to be further developed, a solenoid could be added to the circuit to act as a lock.