The assignment revolves around building and Program a smart circuit using an Arduino UNO which reads a signal from an input component to control an action component.
This week, my assignment is to build a password-protected gate lock system using Arduino, inspired by a project I found on Instructables. The idea is simple but so practical—just like a secret agent's high-tech vault, but for everyday use. I came across this concept while browsing Instructables, and it immediately caught my attention. It combines some of my favorite things: electronics, coding, and simple solutions that can be applied in multiple ways.
ware used for research gathering ideas
Simulating the entire circuit before physically building it.
Rewriting and uploading the code to the Arduino.
The microcontroller controls the entire system.
To display messages.
It handles the physical movement of the gate, controlled by the Arduino.
For entering the password to unlock the gate.
to make quick electrical connections between components
For connecting the Arduino with the keypad, LCD, and servo motor.
temperature and humidity sensor
To differentiate between the system's response to the user
For the external appearance
The inspiration for the project came from Instructables, where I found a guide to build a password-protected lock system using Arduino. I knew I had to modify it to suit my component as I don't have a 4x4 Keypad.
Before jumping into the physical build, I used Tinkercad to simulate the circuit. This allowed me to:
Test how the keypad, LCD, and servo motor would interact with the Arduino.
Ensure all components are connected properly to avoid wiring issues later on.
Simulate the password entry system—making sure that the keypad input triggered the correct actions (opening the gate when the right password was entered and displaying messages on the LCD).
Once the circuit was good to go in Tinkercad, I shifted to the Arduino IDE for coding:
I wrote the code to handle password input, servo control, and LCD messages.
The program waits for a password, compares the entered password to the stored one, and either grants access by rotating the servo or displays an error on the LCD.
I added the ability to change the password using a button, giving the project a real-world feel where users can customize the password.
Arduino Code
After finalizing the design and code in Tinkercad, I replicated the circuit on a breadboard:
I connected the 4x3 keypad to the Arduino Uno, following the pin layout from the simulation.
The LCD display was hooked up using the I2C module, which simplified the wiring as it only required two data lines instead of multiple.
I wired the micro servo motor to the Arduino to control the gate's opening and closing mechanism.
Before combining everything, I tested each component individually to ensure everything worked properly:
LCD Testing: I uploaded a simple "Hello World" code to the Arduino to check if the LCD was displaying correctly.
Servo Motor Testing: I uploaded a basic servo control code to verify the servo rotated smoothly in response to the signals from the Arduino.
Keypad Testing: I tested the keypad by uploading code that would display the key presses on the serial monitor, ensuring the Arduino could read input from the keypad correctly.
Once all components were working individually, I uploaded the full code for the system:
The code controlled the password input via the keypad, displayed messages on the LCD, and triggered the servo motor based on the correct or incorrect password input.
For the physical gate, I used cardboard as my material. I manually cut the cardboard pieces using a cutter:
The design was simple: a basic gate structure with a rotating part controlled by the servo motor.
I glued the cardboard pieces together using hot glue.
After the cardboard gate was ready, I attached the servo motor to the gate. I mounted the Arduino, LCD, and keypad onto the cardboard structure, securing everything with hot glue and double faces for stability.
I tested the final setup by entering the default password (123) to open and close the gate, ensuring the system responded correctly to both the correct and incorrect inputs. Adjustments were made to the timing and functionality as needed.
This simple setup was easy to fabricate using cardboard and worked smoothly with the tested components!
Testing each component
Final Result
Video
I ran into a problem because the tutorial I was following used a 4x4 keypad, but I only had a 4x3 keypad. This meant the tutorial’s code was set up for 16 keys, while my keypad only had 12. So, I had to make some changes to the wiring and code to match my keypad.
Solution:
I went into the code and removed the extra row and column references. This involved tweaking the wiring to match my 4x3 keypad and adjusting the code to handle fewer keys. After some trial and error, I got everything working smoothly.
The servo motor wasn't working as expected. I initially powered it directly from the Arduino, but that didn’t provide enough juice, so the servo wasn’t responding properly.
Solution:
I realized the Arduino couldn’t supply enough power for the servo. To fix this, I used a 9V adapter to power the servo directly, giving it the extra power it needed to function properly. After that, the servo worked smoothly!
The backlight on my LCD display was super dim, so the words were practically invisible. I tried to adjust the potentiometer to fix the contrast, but it was so corroded that the screwdriver couldn’t even budge it.
Solution:
Since I couldn’t fix the potentiometer, I went to San3a Academy, and with Orabi's help, I ended up replacing the entire LCD. After swapping it out, everything worked perfectly, and the display was nice and clear!
At first, I made the cardboard base too small, which became a real problem when I tried to fit all the wires and the Arduino inside. It was like trying to fit a giraffe into a compact car—just wasn’t going to happen!
Title of Media
The skills I gained this week, like troubleshooting hardware issues, adapting code for different components, and designing flexible setups
Coding adjustments: Modifying the code for the 4x3 keypad taught me how to tailor code for specific hardware, which is key for any custom project.
Power management: Learning how to properly power the servo with a 9V adapter instead of relying on the Arduino will help me avoid similar power issues in the future.
Efficient layout design: Ensuring I have enough space for all components, like with the cardboard base, will guide me in designing a more organized and spacious setup for my final project.
Component swapping: Replacing the faulty LCD showed me how to handle hardware failures quickly, a handy skill for dealing with unexpected challenges during the final project.