For this week’s assignment, I chose to build a Smart Door Alert System using Arduino UNO, an IR sensor, a push button, a buzzer, and an LED. This system detects motion near a door and activates an alarm (buzzer & LED), which stays ON until manually reset using a push button.
I got inspired by one of my friend's homes, where I saw a similar system in action. It was impressive how a simple setup could enhance security and automation. Seeing how practical and useful it was, I wanted to replicate and improve it using my own approach. I was also inspired by similar projects but with a different setup of an alert system using Ultrasonic sensors as shown in the video included.
The real-world use case – Home security and automation are important today.
The simplicity yet effectiveness – A small circuit can have a big impact.
My curiosity for IoT and smart home devices – I love integrating tech with daily life!
Software:
Tinkercad which is a free, web-based application that allows users to create 3D designs, circuit simulations, and code-based projects.
Arduino IDE a software platform used for writing, compiling, and uploading code to Arduino boards. I used it to upload the code to my Arduino Uno.
Electronic components
Breadboard – A platform to connect all components without soldering.
Jumper Wires – Connects the components and ensures proper electrical flow.
Arduino Uno – Acts as the brain of the system, processing LDR sensor data and controlling the servo motor.
USB Cable.
IR sensor – Used in my project to sense movement near the door and trigger the alarm system (buzzer & LED). It works by sending IR signals and detecting reflections from objects.
Push button – Used to reset the alarm system by turning OFF the buzzer and LED when pressed. It provides a way to stop the alert after detecting motion.
Buzzer – Provides an alert or emergency signal when activated.
LED – Acts as a visual alarm indicator, turning ON when motion is detected and OFF when reset by the push button.
Resistor – A 10KΩ pull-up resistor is used with the push button to ensure a stable HIGH signal when not pressed.
Enclosure:
Cardboard – Serves as the framework for the Smart Door Alert System, offering a lightweight yet sturdy enclosure that can be easily integrated with a door. .
Glue Gun – Bonds the cardboard pieces securely, ensuring a firm and stable build.
Cutter – Helps precisely cut the cardboard into required shapes for a clean and professional look.
Breadboard
Arduino Uno
Jumper wires
USB Cable
Cardboard
Glue Gun & glue sticks
IR Sensor
Push Button
Buzzer
LED
Cutter
Wiring on TinkerCAD
Code on Arduino IDE
Breadboard wiring
Necessary holes for the system parts
Final Testing
I began by selecting the necessary components, including an Arduino UNO, IR sensor, push button, buzzer, LED, and resistors. Using Tinkercad, I simulated the wiring connections to ensure the correct setup before physically assembling the components.
I programmed the system using Arduino C in the Arduino IDE. The code was written to detect motion using the IR sensor, trigger the buzzer and LED, and allow the push button to reset the alarm. I tested and debugged the code using the Serial Monitor in Arduino IDE to verify sensor readings and ensure smooth operation.
A) Defining pins & variables:
🔹 #define is used to assign names to pin numbers, making the code more readable.
🔹 alarmActive keeps track of whether the alarm is ON or OFF.
🔹 lastButtonState stores the previous state of the push button to prevent unintended multiple presses (debouncing).
B) Setup Function – Initialising Components:
🔹 pinMode(IR_SENSOR, INPUT); – Sets the IR sensor as an input device to detect motion.
🔹 pinMode(BUTTON, INPUT_PULLUP); – Uses an internal pull-up resistor to ensure a stable HIGH signal when the button is not pressed.
🔹 pinMode(BUZZER, OUTPUT); & pinMode(LED, OUTPUT); – Configures the buzzer and LED as output devices.
🔹 Serial.begin(9600); – Initialises serial communication for debugging (displays status messages in the Serial Monitor).
C) Loop Function – Detecting Motion & Controlling Alarm:
🔹 Reads sensor inputs:
digitalRead(IR_SENSOR); – Reads motion status from the IR sensor.
digitalRead(BUTTON); – Checks if the push button has been pressed.
D) Motion Detection & Alarm Activation:
🔹 Since some IR sensors output LOW when detecting motion, the condition motion == LOW ensures the alarm is triggered when motion is detected.
🔹 If the alarm is not already active (!alarmActive), it turns ON and prints "Motion detected! Alarm ON." in the Serial Monitor.
E) Push button & Resetting the alarm:
🔹 Button Press Detection:
The push button is normally HIGH due to the pull-up resistor.
When pressed, it becomes LOW
(buttonState == LOW).
The lastButtonState variable ensures the alarm only resets on the first button press (prevents multiple triggers).
🔹 Debounce Delay (delay(300);) prevents unintended multiple button activations.
F) Controlling the Buzzer & LED Based on Alarm State:
🔹 Ternary Operator (? :) is used to turn ON/OFF the buzzer and LED:
If alarmActive == true, it sets the buzzer and LED to HIGH (ON).
If alarmActive == false, it sets them to LOW (OFF).
Once the code and circuit simulation worked correctly, I wired the actual components on a breadboard, ensuring all connections matched the simulated design. I tested the system multiple times to check for stability, adjusting resistor values and sensor placement for optimal performance.
For the final prototype, I designed a lightweight yet sturdy cardboard enclosure to house the components. The enclosure was measured, cut, and assembled to allow space for the IR sensor, push button, buzzer, and LED to be visible and accessible.
A) Cut the cardboard pieces (Base, Front, Top, Sides, and Back) with necessary holes for the IR sensor, push button, LED, and power cable with the following dimensions:
Base: 15cm × 10cm
Front Panel: 15cm × 10cm (cut a hole for the IR sensor)
Top Panel: 15cm × 10cm (holes for the push button & LED)
Side Panels: Two pieces of 10cm × 10cm
Back Panel: 15cm × 10cm (cut an opening for the power cable)
B) Assemble the box using glue/tape, ensuring all components fit properly.
C) Mount the components (IR sensor, push button, LED, buzzer, Arduino, and breadboard) in their designated positions.
D) Connect the wiring, keeping the setup neat and ensuring USB access for power.
After assembling everything, I conducted multiple tests to ensure the system functioned as intended. Adjustments were made to sensor sensitivity, wiring stability, and button responsiveness before finalizing the project.
The development and implementation of the Smart Door Alert System involved multiple stages, including circuit design, coding, assembly, and enclosure fabrication. The project was carefully planned to ensure that all components functioned correctly and were securely housed.
The circuit was carefully placed inside the enclosure, with all wires neatly routed.
Multiple tests were conducted to ensure the system worked correctly—detecting motion, activating the alarm, and resetting properly when the button was pressed.
Final adjustments were made to improve stability and usability, ensuring the system could be easily placed near a door.
Final Look
Title of Media
IR Sensor Behavior: Initially, the IR sensor logic was inverted, meaning it triggered at the wrong times. I had to research how different IR sensors work and adjust the code accordingly.
Push Button Debouncing: The push button was triggering multiple times instead of resetting the alarm correctly. I learned about debouncing and implemented a delay-based solution.
Push Button Wiring Challenge: When embedding the push button into the cardboard enclosure, I realized that the space left for its legs was too small for proper wiring. To solve this, I cut two wires, stripped their copper ends, and directly connected them to the button’s legs instead of using the terminals. This workaround ensured a secure connection without affecting functionality.
Push button wiring
Title of Media
Title of Media
Title of Media