For this week’s assignment, my idea is to build a Bluetooth-enabled Arduino electronic safe. The safe can be unlocked with a secret code entered on the keypad and wirelessly via a phone/PC GUI through a Bluetooth module, making it both practical and interactive. I care about this idea because it blends security concepts with smart home technology, showing how everyday objects can be automated and enhanced with wireless control. I was inspired by online Arduino safe projects like Wokwi and tutorials that demonstrate how servo locks and keypads can be integrated into real-world applications. The addition of wireless control modernizes the project and connects it to IoT trends, making it both educational and useful.
Source: Wokwi
For this assignment, I used Tinkercad to design and simulate my circuit before physical implementation.
Tinkercad allows me to test the connections, components, and logic virtually, which helps in identifying errors early and saves time and materials before moving to real hardware.
Software/Machines/Materials Used
For this assignment, I used the Arduino IDE to write, compile, and upload the code that controls the smart safe system.
Why I Used It
The Arduino IDE provides an easy-to-use platform for coding in Arduino C, testing logic, and directly uploading programs to the Arduino UNO board. It also includes a built-in serial monitor that helps with debugging and verifying communication between components, which makes it ideal for developing and refining embedded system projects like this one.
Used an Android application (Arduino Bluetooth Controller) to communicate with the Arduino board via Bluetooth module (HC-05).
Configured the app to pair with the Bluetooth module by entering the default PIN (1234 or 0000).
The app sends specific text commands to the Arduino through the serial connection.
On the Arduino side, the program uses Serial.read() to receive these commands and control the safe mechanism accordingly.
Provides a wireless and user-friendly interface, eliminating the need for manual buttons for secure control.
Components and Their Roles
Arduino Uno (Microcontroller – “Brain”)
Acts as the central controller of the entire smart safe.
Reads password inputs (via Bluetooth Serial).
Sends signals to servo, buzzer, LCD, and RGB LED.
Breadboard
Provides a reusable platform for connecting components without soldering.
Jumper Wires
Connect Arduino pins to breadboard and components.
Arduino USB Cable
Uploads code to Arduino and supplies power when connected to a PC.
9V Power Adapter (External Power Source)
Ensures stable power for all components, especially servo and LCD (which draw more current).
RGB LED (Red, Green, Blue)
Provides a visual for lighting different colors (LED commands from Bluetooth).
330 Ω Resistors (for RGB LED)
Limit current through each LED channel to prevent damage.
Servo Motor (Locking Mechanism)
Physically locks/unlocks the safe door by rotating to 0° (locked) or 90° (unlocked).
Buzzer (Alarm System / “Mouth”)
Emits sound when:
Wrong password (alarm).
Lock engages (short click).
Provides audible alerts.
16×2 I2C LCD Display
Displays system status messages:
“Enter Code”, “Access Granted”, “Access Denied”, “New Code Saved”.
I2C interface reduces wiring to just 2 pins (SDA, SCL).
Bluetooth Module (HC-05)
Enables wireless communication between Arduino and smartphone.
Used to send password digits and LED color commands via Bluetooth terminal app.
DC–DC Adjustable Step-Down Power Supply Module (Buck Converter)
Converts the 9V adapter voltage down to a stable 5V.
Prevents overvoltage damage to sensitive 5V components.
Ensures reliable operation of servo motor (which draws higher current) and Bluetooth module (which is voltage-sensitive).
Serial (Bluetooth / PC)
Digits (0–9) → used for entering the 4-digit password.
Characters (R, G, B, Y, C, M) → commands to control the RGB LED.
User password entry
A 4-digit string typed through Serial.
lockDoor() → Servo at 0° (locked
unlockDoor() → Servo at 90° (unlocked)
lockDoor() → Short beep (“click”) when locking.
alarm() → Repeated ON/OFF beeps (5 times) when wrong password entered.
Commands from Serial:
R → Red
G → Green
B → Blue
Y → Yellow (Red + Green)
C → Cyan (Green + Blue)
M → Magenta (Red + Blue)
turnOffRGB() turns LED off at startup.
Startup → “Safe Door System” → then “Enter Code:”
Password entry → Displays **** instead of real digits
Correct password → “Access Granted” → then “Enter New Code:”
Wrong password → “Access Denied”
New code saved → “New Code Saved”
Prints messages like:
"System Ready. Type 4 characters..."
"Password entered: XXXX"
"Access Granted" / "Access Denied"
"New password set: XXXX"
"LED: RED", "LED: BLUE", etc.
Inputs = Password digits + RGB commands (via Serial/Bluetooth)
Outputs = Servo motion, buzzer sounds, RGB LED colors, LCD messages, Serial feedback
Opened Wokwi Arduino Simulator.
Choose Arduino UNO as the microcontroller.
LCD 16x2 I2C
Connected SDA → D19, SCL → D18, VCC → 5V, GND → GND.
Servo Motor
Control wire → Pin 9,
Power → 5V,
Ground → GND.
Buzzer
Positive → Pin 8,
Negative → GND.
RGB LED (common cathode)
Red → Pin 3,
Green → Pin 4,
Blue → Pin 5,
Common cathode → GND.
Copied the Arduino code into Wokwi’s IDE.
Ran simulation → Observed LCD messages, servo movement, LED color changes, and buzzer sounds (visual indicator in Wokwi).
Change Button Configuration to (R, G, B, Y, C, M)
And for Serial Monitor: Just enter the code
I used an Arduino UNO board as the controller, and connected each component according to the design:
16x2 I2C LCD Display
SDA → D18
SCL → D19
VCC → 5V
GND → GND
DC-DC Step Down Converter
Vin → Vin Arduino
GND → GND (Arduino)
Vout → Breadboard (Servo, Bluetooth VCC)
GND → Breadboard (Servo, Bluetooth GND)
Servo Motor (Lock mechanism)
Signal → Pin 9
VCC → Vout (From DC-DC Step Down Converter)
GND → GND (From DC-DC Step Down Converter)
Buzzer
Positive → Pin 8
Negative → GND
RGB LED (common cathode)
Red → Pin 3
Green → Pin 4
Blue → Pin 5
Common cathode → GND (with current-limiting resistors for each color)
Bluetooth / Serial Communication
Initially tested via USB Serial Monitor.
Later extended to HC-05 Bluetooth module for wireless password entry.
TX (HC-05) → RX (Arduino Pin 0)
RX (HC-05) → TX (Arduino Pin 1)
VCC → Vout (From DC-DC Step Down Converter)
GND → GND (From DC-DC Step Down Converter)
Opened Arduino IDE.
Connected Arduino UNO via USB.
Compiled and uploaded the code successfully.
Opened Terminal to test commands and password input (Arduino Bluetooth)
System Boot-up
LCD displayed “Safe Door System”.
RGB LED remained off.
Servo locked at initial position.
Password Entry (Serial/Bluetooth)
Entered a 4-digit code via Serial Monitor or mobile Bluetooth app.
LCD displayed **** instead of the real digits for security.
Correct Password
LCD showed “Access Granted”.
Servo rotated 90° (door unlocked).
User prompted to enter a new password → saved automatically.
Wrong Password
LCD showed “Access Denied”.
Buzzer alarm sounded (5 beeps).
Servo remained locked.
RGB LED Commands
Sent letters (R, G, B, Y, C, M) via Serial/Bluetooth
LED lit up in respective colors.
Reset Prompt
After each action, LCD returned to “Enter Code:”.
The work of AI was not the majority. It helped me to deal with the issues I faced during testing my code and to make it a more organized code.
Password Change Feature
After entering the correct code, the system now asks the user to set a new 4-digit password.
The variable waitingForNewCode acts as a flag to know if the next input is a login attempt or a password update.
Masked Password Input on LCD
Instead of showing the digits, the LCD shows * characters for each entered digit, improving security.
What is "state management"?
A state is simply "what situation your system is in right now."
In my safe door project, the system has two different situations (states):
Normal login mode → waiting for the user to enter the current password.
Password update mode → waiting for the user to enter a new password.
A flag is a variable (often boolean: true/false) used to signal something about the system’s current state.
In my code, the flag is:
bool waitingForNewCode = false;
This means:
false → system is in normal login mode.
true → system is in password update mode.
Better Separation of Functions
Created helper functions:
recvCode() → handles password input.
Flowchart is AI-Assisted
(I gave it the Full Code and asked to generate a FlowChart)
Issue:
At first, my LCD display and Bluetooth module were not working together smoothly. Whenever I tried to power everything directly from the Arduino, the LCD would sometimes flicker, and the Bluetooth connection would drop unexpectedly.
Suggestion from a peer:
One of my teammates suggested that instead of powering all components directly from the Arduino’s 5V pin, I should use an external regulated power source and separate the load by using a breadboard power rail. They also advised me to check the baud rate of the Bluetooth module to make sure it matched the Arduino’s Serial communication.
Solution:
I applied this advice by connecting the Bluetooth module and servo motor to a DC-DC step-down converter to stabilize the voltage and reduce the load on the Arduino. I also adjusted the baud rate in the code to ensure stable communication. After that, both the LCD and Bluetooth worked perfectly together without interference. And the LCD alone was connected to the 5V from the Arduino.
Contribution:
I helped my peers by showing them how to use the I2C scanner to detect the LCD address (0x27) and explained how to modify their code if they had a different module.
How peers helped me:
They helped me identify the power distribution problem and suggested an alternative wiring method that made the whole system more stable.
When I first connected the servo motor and HC-05 Bluetooth module directly to the Arduino UNO’s 5V pin, the system became unstable:
The servo motor jittered or didn’t rotate properly.
The Bluetooth module disconnected randomly.
The LCD sometimes flickered due to voltage drops
This happened because the Arduino UNO cannot supply enough current for both the servo (which can draw up to 1A under load) and the Bluetooth module.
To solve this, I introduced a DC-DC buck converter:
Input: 9V (from adapter/battery).
Output: Regulated 5V for the servo and Bluetooth module.
Shared the GND of Arduino and external supply to maintain a common reference.
Now, the Arduino only powers the logic components (LCD, internal circuitry), while the high-current devices (servo + Bluetooth) get stable power from the DC-DC module.
I researched the issue online when I noticed servo vibrations and Bluetooth disconnections.
I found discussions on Arduino forums and YouTube tutorials, where hobbyists recommended separating servo power and using a buck converter for stable current delivery.
This was confirmed by datasheets that showed Arduino UNO’s onboard regulator provides only ~500mA max, which isn’t enough for servo + Bluetooth.
Do not power servos directly from Arduino UNO’s 5V pin if the servo is under load; it can reset or damage the board.
Always use a common ground when using an external power supply with Arduino.
Check the current requirements of each module before wiring—Bluetooth and servo together exceed what Arduino can supply.
Test with Wokwi first, but remember simulations don’t show power issues, so always cross-check with datasheets.
Final Reflection:
The biggest challenge was power distribution. By pausing, researching, and applying a DC-DC step-down converter, I ensured the system worked reliably without resets or unstable behavior. This step was critical for moving from simulation (Wokwi) to successful real implementation.
This week, I learned how to properly wire and power a servo motor in an Arduino-based system. At first, I connected the servo directly to the Arduino UNO, but I discovered that it caused power instability because the servo requires higher current than the Arduino can supply. By researching and testing, I implemented a DC-DC step-down converter to provide a stable 5V power line for the servo, while keeping a common ground with the Arduino.
In my final project, I will also be using a servo motor as part of the system. The knowledge I gained this week is directly applicable:
I now know the correct way to wire the servo motor so it operates smoothly without affecting other components.
I understand the importance of separating power supplies for high-current devices and ensuring a common ground reference.
I gained confidence in debugging power-related issues, which will save time when building the final project.
The coolest thing I learned this week was how to build and program a robotic arm. I was really interested in working on this project because it combined mechanical design, electronics, and coding in a practical way. Seeing the robotic arm respond to our inputs and perform tasks was not only exciting but also showed me how different engineering skills can come together in one system.
Another thing that I will never forget from this week is that our team became the Winner of the Hackathon. This achievement meant a lot to me because it validated the effort and creativity we put into the project. It also boosted my confidence in my ability to work in a team, solve problems under time pressure, and apply my engineering knowledge in a competitive environment