دق دق الباب
For this week’s assignment, my idea is to build an Automatic Door System. The door opens from the outside using an IR sensor, and from the inside with a push button. When activated, the LED light also turns on.
I was inspired by the children’s song “أنثى السنجاب”, where the fox keeps trying to enter the squirrels’ home. This gave me the idea of creating a fun and useful smart door.
Software: Tinkercad for circuit wiring simulation, Arduino IDE for programming.
Hardware Components: Arduino UNO, IR Sensor (for detecting people outside), Push Button (for opening from inside), Servo Motor (to act as the door), LED (to indicate when the system is active).
Materials & Tools: Breadboard, jumper wires, USB cable, and resistors.
Concept Development
I first sketched the idea of the circuit on paper, identifying the necessary components: an IR sensor to detect presence outside, a push button for manual opening inside, a servo motor to act as the door mechanism, and an LED to indicate door status.
Simulation and Wiring Diagram
Before implementing the circuit physically, I used online tools like Tinkercad to simulate the connections. This step allowed me to confirm which pins on the Arduino UNO would be used:
IR sensor connected to a digital input pin.
Push button with an internal pull-up resistor.
Servo motor connected to a PWM-enabled pin.
LED connected with a resistor to a digital output pin.
Programming the Logic
The Arduino C code was written to handle the inputs and outputs:
The Servo library is included to control the servo motor.
Pin definitions:
irPin → IR sensor (opens the door from outside).
buttonPin → Push button (opens the door from inside).
ledPin → LED (indicates door status).
In the setup, the servo is attached to pin 9 and starts in the closed position (90°).
In the loop, the code checks the IR sensor and button:
If the IR sensor detects an object → the door opens for 5 seconds, then closes.
If the button is pressed → the same sequence happens.
Otherwise → the door remains closed.
The functions openDoor() and closeDoor() control both the servo angle and the LED status.
I collected all the electronic parts required:
Arduino UNO as the main controller.
IR sensor for detecting presence from outside.
Push button for manual opening from inside.
Servo motor to act as the door mechanism.
LED as a status indicator.
Breadboard and jumper wires for quick prototyping.
A cardboard box to serve as the physical model of the door system.
To represent the actual door, I used a cardboard box as the prototype housing.
I cut out a rectangular section on one side of the box to serve as the door flap.
The servo motor was fixed to the inside wall of the box so that it could rotate and move the door flap.
The IR sensor was placed on the outside of the box to detect someone approaching.
The push button was positioned on the inside for manual control.
The LED was also placed where it was visible, so it would clearly indicate the door status.
This gave the project a realistic “mini door” look and made the demonstration more engaging.
Using a breadboard, I connected the components to the Arduino:
IR sensor → digital pin 4.
Push button → digital pin 3 with internal pull-up.
LED → digital pin 8 with a resistor.
Servo motor → pin 9 for PWM control.
The breadboard and Arduino were also placed inside the cardboard box to keep the setup compact.
The Arduino IDE was used to write and upload the program.
The logic controlled the servo based on sensor/button inputs.
The LED switched on whenever the door was open.
Serial communication provided debugging feedback.
I tested the IR sensor’s sensitivity to ensure it detected movement reliably outside the box.
I checked the button inside the box for proper manual operation.
Servo motor angles were adjusted so the cardboard flap opened smoothly at 0° and closed firmly at 90°.
The delay time (5 seconds open) was tested and fine-tuned.
Yes, I asked for feedback during the development of my assignment. At first, my idea was to use an ultrasonic sensor to detect presence outside the door. However, it did not work well for this function due to its limited accuracy and sensitivity in close ranges.
I discussed this issue with my friend John, and he suggested replacing the ultrasonic sensor with an IR sensor, which is more suitable for short-range detection and provides a faster response. I built upon his idea by redesigning the circuit to include the IR sensor instead, which significantly improved the performance and reliability of the system.
When I got stuck, I faced a problem with the cardboard door flap. The piece I had cut out from the cardboard box was too thick and heavy for the servo motor, and as a result the servo could not move it properly or smoothly. At this point, I had to pause and reconsider my design.
I did some quick research on the weight limitations of small servo motors and realized that using a lighter material or reducing the size of the moving part would solve the issue. I replaced the heavy cardboard door with a lighter and thinner piece of cardboard, cut to a more suitable size. After this adjustment, the servo was able to move the door smoothly and consistently.
A key challenge here was balancing the design of the door so that it looked realistic but was still within the capabilities of the servo motor. A mistake that others can avoid is not checking the weight and size of the door flap early in the design process. Using materials that are too heavy for the servo will cause strain, inconsistent movement, and potential damage to the motor. Choosing lightweight cardboard or other thin materials ensures much better results.
I can definitely use the skills and knowledge I acquired this week in my final project, especially since the servo motor is one of the core components in my design. Through this assignment, I learned how to properly control the servo using Arduino code, set the right angles for opening and closing, and manage timing with sensors and buttons.
These skills will help me implement precise movements in my final project, making the mechanism more reliable and efficient. I also gained experience in troubleshooting issues such as load limitations and material choice, which will be very useful when designing and fabricating a functional prototype.
In addition, I learned how to integrate multiple components (sensors, servo, and LED) together in one system, which is directly relevant to creating a more advanced smart device for my final project.