Open Smart Rich Shield – Arduino Vault

Open Smart Rich Shield is a beginner-friendly shield for Arduino Uno. It can also be used with Arduino Mega. This shield gives you easy access to a 4 digit 7 segment display, 4 LEDs, 2 buttons, LDR,  Temperature Sensor, Voltage sensor, IR sensor, and a buzzer. Controlling a 4 digit 7 segment display can be difficult. Open Smart Rich Shield library makes it easy for its users. The shield contains a TM1637 driver IC to make the display control facile.

There are 2/3 Open Smart Rich Shield libraries. The one I have used could be downloaded from here.

Download Arduino and LDR Proteus Libray also. The Arduino code that has been used to operate the system can be found here. If you have downloaded all the files mentioned above you are ready to go.

Features of this project:

  • The vault door is locked or not is sensed by the LDR sensor. If the door is open then it won’t take code input. First, you have to lock the door.
  • The shield has two keys. The first key is used to change the number and the second key is used to confirm it and store it.
  • The red led indicates the wrong password. Green led indicates the right password.

If you look at the shield you can see that the LDR is front faced so we can not place the LDR inside the vault. To solve this problem, we place the finger on the sensor to make the system understand that the vault door is open. If we uncover it then the system reads as the door is closed and locked.

Open Smart Rich Shield – Arduino Vault Code Explanation:

I have divided the code into sections to explain easily. Each function is a section. So we have four sections here:

  • void Setup(): Used to declare the setup parameters.
  • void Loop(): The main function where the Arduino by default runs in an infinite loop.
  •          bool matchpassword(): This is a function that has been used to compare user input with the stored password.
  • char numberToCharConversion(int j): This function does two things at a time. First checks if the system is in “Normal” or “setPassword” mode. If it’s in the “normal” mode then convert integer variable “ j ” to character type and stores in the “dataStr” character array. In the case of “setPassword” mode stores in the “password” character array.

So how it works then?

1. The first condition for the project is, when you put your finger on the LDR, it indicates that the door is opened and it should not receive code input unless the door is closed and locked. The “threshold” variable at line 11 sets the LDR reference point. If it is greater than 300 that means there is enough light ( no finger on the LDR)  and when it is less than 300, it means the LDR is covered by a finger ( it’s dark).

So, the code starts from this condition at line 39. Then it turns the “GREEN_LED” as an indicator that the safe door is close and locked. The display shows “___”. You can set it as you like or keep it blank. 

      

2. Then you get to decide if you want to input the password or change it. I have defined two modes, “Normal” and “setPassword”. You can choose between the two using the “input_button”. If you press the “input_button” once then it goes into the “Normal” mode. If you press and hold the “input_button” for more than 3 seconds it goes into the “setPassword” mode. Line 42 has been used to stop Arduino from doing anything until you press the “input_button”. After that, the timer starts. It has been used to count how long you are pressing the button. Line 42, stops Arduino until you release “input_button”. The rest you can understand. Let’s say, you have chosen “setPassword” mode. Line 49 clears the previously stored password. Line 47 turns the “Yellow_LED” on, which indicates you are in the “setPassword” mode. The rest you can understand.

3. “digitNumber” refers to how many digit you want to enter as input. The “ while “ loop runs 4 times as the working digit is 4. Line 60 to 85 generates “ cyclic number “ ex. 1 > 2 > 3 > 4 > 1 and goes on and also displays it on the display.  Line 64 to 72 for user input or “Normal” mode. Line 74 to Line 82 is for the “setPassword” mode.

Here you can see, we are using “password []” character array. Because when we are changing password, we are making changes into the array that contain “Main Pasword”.

4. Then Line 87 freezes Arduino until you press “input_button” to change the digit or “confirm_button” to confirm it. If somehow, the LDR value is changed which denotes a force entry without entering password, “goto” statement sends the code  to the forcedOpen section in Line 157. It will be discussed letter. If you press confirm, the program sends the integer “j” to the numberToCharConversion() function mentioned at the start.

5. Line 108 to 154 does the password matching operation. If it is in the “Normal” mode, and the password is correct, then clears the used input array to make it ready for the next input.

6. If the password is wrong, then also clears the used input array and blink “RED_LED” for 5 sec. It also counts login attempt. If you enter the wrong password for more than 3 three times it sends you to the “forcedOpen” label.

7. From line 140 to 154, If you are in the “setPasword” mode, then it blinks the “Yellow_LED” 3 times to indicate that the password has successfully changed.

8. Line 156 to 180 is the condition when the safe door is open or “forcedOpen” condition. It plays the buzzer, blinks the “red_LED” 5 times. In the case of 3 failed logins, send a message to the reception through the serial monitor. Line 179 freezes the processor until there is enough light or you remove the finger from the LDR.

If you have any questions regarding this project please ask in the comment section.

Watch How to Build Arduino Vault in Proteus on Youtube:

 

The proteus library for the open smart rich shield is not available but you can build it easily into proteus from the circuit diagram.