Password System on Cortex-M3 Dev Board

Motivation

Through EiE, I have been exploring embedded systems, specifically the SAM3U2 CORTEX-M3.

“(EiE) is an extracurricular initiative at post-secondary engineering schools that delivers dynamic and relevant hands-on embedded systems training from an industry perspective. 

I had mastered the basic functionality of the board and the microcontroller, and was given the choice of taking on an assignment that would be used to test the skills I had acquired thus far. I chose to complete a password system. The goal of the project is to create a system which can recognize a correct password through the onboard push buttons and light up the appropriate LEDs to indicate its current status. The password also needed to be reprogrammable up to 10 digits by using a button combination.

Design

Below is a diagram I devised illustrating how the password system should function.

Implementation

The first step was to create a place to store the password entered by the user both for unlocking attempts and for programming a new password. Here, three arrays are used to accomplish the task. One will hold the password itself, and another will act as an input buffer for button-presses. The final array will act as a temporary storage space for a newly programmed password before it is verified.

If a user enters a password, the resulting button input is stored in the buffer and checked up against the actual password before unlocking. Otherwise, a warning message is flashed and the buffer is cleared. If a user enters the code unlocking the programming state, the candidate password is monitored for length and copied into the password array. The result of these array comparisons determines the current state machine function the system is running and what state machine function to transition to next.

After the core implementation was complete, more specific LED indicators, ASCII display messages, and unique buzzer frequencies were added to each state of the password system.

Demonstration

Here is a video demonstration walking through the proper functionality of the password system. The source code is available on Github as well.