The main purpose of this project is to develop your Arduino programming skills. The assumption is that you have already worked through the tutorials under Embedded programming and Fusion 360.
For this safety box you will use a pin pad to create a password that needs to be correct before the box open. There are two main parts to this project: The program and the locking mechanism. The first step before creating the program is to understand how the key pad you will be using works.
Keypad Membranes
The 1x4 Keypad
The first step is to make sure you understand which pin on the ribbon of the key pad is which digit. For this you need a multimeter to measure the continuity when the button is pressed.
The most important thing is to determine which pin is common. This pin can either go to 5V or ground. Then the other side of the 10kOhm pull down resistor goes to the opposite. In the image below the 5V is common.
To read the value into our microcontroller we need to convert on/off value to a voltage using a voltage divider. Then we can use the digital input to read the value.
Make sure you agree with the pinouts.
The first step is to make sure you understand which two pins on the ribbon of the key pad is which digit. For this you need a multimeter to measure the continuity when the button is pressed.
Map the rows (R1 to R4) and columns (C1 to C4) to the output on the ribbon (Pin 1-8).
How are you going to read the switch value into the Arduino program?
To create a program in Arduino C we develop it in two parts:
Read three buttons which represent our password
Add to Array
Check if password correct
Turn a servo horn when password correct
Use the Keypad library in Arduino for handling the keypad. This will simplify scanning and detecting key presses
Define Keypad Pins and Keymap. 4x4 membrane code
Change passwords to use characters instead of integers
Use the library to create a keypad object
Keypad key = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS)
Replace the custom buttonWait() function with a new function that reads key presses from the keypad:
Replace the for loop with the new buttonWait()
Here is the code from the last part if you were struggling, you should follow the tutorials so you understand what you are doing - LINK
Start by understanding the size and layout of your components:
Measure the Arduino board, membrane keypad (4x4 or 1x4), servo, and other parts. (Measurements are on a picture above but double check)
Decide on the arrangement of the components, considering how the housing will be mounted (e.g., wall-mounted or desktop).
Sketch the housing's footprint using the rectangle tool, ensuring it's slightly larger than the largest component for clearance.
Extrude the base to create a solid foundation (e.g., 3-5mm thick).
Draw walls around the base, leaving space for openings like the keypad or cable pass-throughs, and extrude these walls to the desired height.
Sketch cutouts on the walls for:
The membrane keypad (front wall).
Cable access, Arduino ports, or ventilation.
Openings for the lock mechanism (servo or motor arm).
Use the cut extrude tool to create these openings.
Inside the housing, add supports like mounting posts for the Arduino or ledges to secure the keypad.
Sketch and extrude a lid slightly larger than the top of the housing.
Add features for attaching the cover, such as screw holes, snap-fit joints, or tabs.
Refine the overall design by using the fillet tool to round sharp edges and checking clearances with the Inspect tool.