You are on page 1of 8

Assignment 2: Security System on Arduino

Foundations of Computer Systems


Anshul Rana and Vedika Agarwal
Code Setup:
1. In the setup function, initialize the serial communication and set the baud rate. Also
initialize all the user ids, manager user id and manager password
2. For user authentication, prompt the user for their ID and password, and check the
EEPROM for a match. If a match is found, allow access. If not, deny access.
3. For manager authentication, prompt the manager for their ID and password, and check
the EEPROM for a match. If a match is found, allow access. If not, deny access.
4. For adding a new user, prompt the manager for the desired ID and password, and store
this password in the memory block next to this user in the EEPROM memory. If user id
entered is already in use, we prompt the user about the same.
5. For deleting an existing user, prompt the manager for the ID of the user they wish to
delete, and remove that user's password from the EEPROM by setting it to 0. If user id
entered is not in use, prompt the user regarding the same.
6. For changing an existing password, prompt the manager for the user id whose password
is to be changed and ask for the new password. Write the corresponding memory block in
the EEPROM with this new password. If user id entered is not in use, prompt the user
regarding the same.
7. In the loop function, check for serial input and parse it to determine the user's intent (e.g.
adding a new user, deleting an existing user, or attempting to authenticate as user or
manager).

Choice of User ID and Password:


We had 1024 bytes available to us on the EEPROM memory. We had to figure out how many
bytes to allocate to each user for their ID and password to make an optimal security system.
As we are aware, each byte can store an integer between 0-255 or the ASCII code of one letter.
We decided to allocate 4 bytes for each user: 2 for user id and 2 for password using short int for
both. This enabled a total of 255 users and 1 manager while utilizing all the space available.
If we chose 1 byte for user id and 1 byte for password, this would enable only 255 users (since 1
byte can only store up to the number 255) and hence 512 bytes total would be in use, leaving half
of the space unused and thus, unoptimized.
If we chose more bytes for password to increase security, this would drastically decrease the
number of users on the security system. Hence, we designed the system such that to login users,
for the password, it only checks the block of memory next to the block of memory storing the
user id for that particular user. Hence, even if multiple users have the same password, only if
they enter both the correct user id and password combination are they logged in.
Demonstration:
1. Manager Login:

2. Adding a User:

3. Logging in as a User:
4. Changing Password:

5. Deleting User:
Appendix: Code
____________

You might also like