The idea of this week's assignment is a Smart Greeting Door System.
Review:
The Smart Greeting Door System is an automatic door that opens when someone comes near and displays a welcome message. It also closes automatically, In addition to the RGB that has different colors depending on the door's status, Also it can be controlled via Bluetooth using a mobile app.
I have used the TINKER CAD platform for simulating the electronic circuit, and be sure that every components working before start the actual circuit to avoid any damage.
That one help to write the code, and program the Arduino.
That give access to control the door using your mobile.
Pencil.
Cutter blade.
Scissors.
Glue gun.
Screws & nuts
cardboard
BT-Module
16x2 lcd display
Arduino Uno (The brain of the project)
Ultrasonic Sensor (HC-SR04) (To detect people near the door)
Servo Motor (SG90) (To open and close the door)
16x2 I2C LCD Display (To show welcome and goodbye messages)
Bluetooth Module (HC-05) (To control the door with a mobile app)
RGB LED (To indicate door status: Red = Closed, Green = Open, Blue = Standby)
Jumper Wires (To connect everything)
Breadboard (To organize connections)
First I Used the TINKERCAD platform to simulate the circuit .
I used the Arduino Uno as a power source
I used the Ultrasonic sensor for the distance that has four pins, and connect left side with the V5, the other side to GND, Echo to pin 3 of the Arduino, and the Trig to pin 2 . (Input)
I insert LCD to Display Messages, First wire to GND, second to V5, and the SDA to Analog pinA4, and the SDL to Analog pin A5. (Output)
There is servo also to move the door, so the lid gets open, as reflection to the read of the ultrasonic sensor. connect the Brown wire to GND, Red wire to V5, and the Orange one to pin 4. (Output)
I insert RGB to light in different colors depending on the door status. connect the Red Pin to Pin 5, Green Pin to Pin 6, Blue Pin to Pin 7 . (Output)
There is a BT-Module, that will allow to control the door using the smart phone, the RX need a voltage divider so I used two resistors one end will be connected to the common GND and the other is connected to pin 9, TX is connected to pin 8, GND to the common GND at the breadboard, Finally the Vcc pin to the common V5
First I upload These from the libraries that add extra functions to Arduino.
LiquidCrystal_I2C.h: Controls the LCD display to show messages.
Servo.h: Allows the servo motor to move.
SoftwareSerial.h: Helps with Bluetooth communication.
Start to Defining Components and Pins .
Inside the Void Setup, I defined the output pins and the inputs as below
Set up the ultrasonic sensor:
TRIG_PIN (Trigger) is set as an OUTPUT .
ECHO_PIN (Echo) is set as an INPUT.
Set up the RGB LED:
RED_PIN, GREEN_PIN, and BLUE_PIN are all OUTPUTs to control the LED depending on the door status.
Attach the Servo Motor:
The servo is an output "SERVO_PIN" and set to 0 degrees (which means the door starts as closed).
Set up the LCD Display:
The LCD is an output also and initialized, the backlight is turned on, and the message "Have a Good Day!" is displayed.
Start Bluetooth Communication:
Bluetooth. Begin(9600); starts the Bluetooth module, allowing communication with a phone.
long measureDistance() - Measures the Distance Using the Ultrasonic Sensor
Measures the time taken for the echo to return, then converts time to distance (cm) using duration * 0.034 / 2. If no object is detected, it returns 999 cm.
void openDoor() - Opens the Door When Someone is Near
Move the servo motor to 180° (this means opening the door).
Clear the LCD screen and show the message "Welcome!".
Change the RGB LED to green (setRGB(0, 255, 0); → full green, no red, no blue).
Wait 3 seconds before closing the door.
Move the servo motor back to 0° (which closes the door).
Clear the LCD and show "Goodbye!" for 2 seconds.
Turn the RGB LED red (setRGB(255, 0, 0); → full red, no green, no blue).
Reset the LCD message back to "Have a Good Day!".
Turn on the blue LED (standby mode).
void setRGB - Controls the RGB LED Colors
(int r "for red brightness", int g "for Green brightness", int b "for Blue brightness")
Inside the Void Loop,
Check Distance:
If the sensor detects something closer than 40 cm, the door opens.
Wait 3 seconds, then close the door.
Check Bluetooth Input:
If the Bluetooth module receives a command, it reads the letter:
'O' → Open the door
'C' → Close the door
Repeats Forever:
This loop keeps running so It will work continuously for nearby people or Bluetooth commands.
1. Ultrasonic Sensor (HC-SR04) (Input ):
left side with the V5
Right side to GND
Echo to pin 3of the Arduino
Trig to pin 2
2.Connect the LCD Display (I2C Module):
VCC → 5V
GND → GND
SDA → A4
SCL → A5
3. Servo Motor (Digital Pin 4):
Brown wire to GND
Red wire to V5
Orange one to pin 4 .
5.RGB LED:
Red Pin → Pin 5
Green Pin → Pin 6
Blue Pin → Pin 7
5. Bluetooth Module (HC-05):
VCC → 5V
GND → GND
TX → Pin 8
RX → Pin 9
6. Arduino Power:
Connect the Arduino’s GND to the breadboard’s negative rail.
Connect the 5V pin to the breadboard’s Positive rail
Start ↓
Measure Distance (Ultrasonic Sensor) ↓
Is distance < 40cm?
→ Yes →
Open Door (Servo Motor) → Display "Welcome!" on LCD → Wait 3 sec, Turn on → green light.
→ No → Loop back to Measure Distance ↓
Close Door (Servo Motor)
↓ Display "Goodbye!" on LCD, Turn on → Red light
↓ Reset LCD to "Have a Good Day!" Turn on → Blue light
↓ Check Bluetooth Command
↓ Is command received?
→ 'O' → Open Door
→ 'C' → Close Door
→ No → Loop back to Start
The ultrasonic sensor continuously measures the distance in front of the door.
If an object (person) is detected within 40cm, it triggers the next step.
The servo motor rotates to open the door.
The LCD displays "Welcome!".
The RGB LED turns green to indicate an open door.
The system waits for 3 seconds to allow the person to pass.
The servo motor rotates back to close the door.
The LCD shows "Goodbye!" for a short time, then resets to "Have a Good Day!".
The RGB LED turns red, indicating the door is closed.
The system checks for Bluetooth commands from a mobile app.
If the command 'O' is received, the door opens.
If the command 'C' is received, the door closes
I placed all the needed components on the breadboard
Wrote the code using Arduino IDE
Strat to check it before placing it in the cardboard.
I made a simple closed box , and made apart of it "Door" loose so it can be moved simply using servo, which I placed near to it.
I made holes to insert the Ultrasonic sensor in the front of the box's body.
I used the nuts and screws to fix LCD the l inside the box.
I decide to fix the other parts to be in the back side of the box, such as Arduino and the breadboard.
Automated video
Bleutooth controller video
The Smart Greeting Door System is an automated door that detects nearby people and displays a welcome or a goodbye message.
✔ Automatic door control using an ultrasonic sensor and servo motor.
✔ LCD display shows greetings like "Welcome!" and "Goodbye!"
.
✔ Bluetooth control allows opening/closing via a mobile app.
✔ RGB LED indicator changes color based on door status.
Bt module was not blinking and not showing among the available Bluetooth devices, so I couldn't pair with, also was not responding any action through using the app.
Code for the LCD, so I got stuck a while with the messages that I want to display.
Fixed Bluetooth Issue.
I re-wired the module again, as there were missing step( Found that the vcc and the GND both connected to GND common and that made it not showing among the available Bluetooth devices in the phone)
Moved Bluetooth RX to pin 8 and TX to pin 9 to avoid conflicts.
For the code I added Debugging (Serial.print), to make sure that the Arduino receives command from the app.
Shows "Bluetooth Ready..." when Bluetooth is initialized.
Displays "Bluetooth Received: O" when a command is received.
For the part related to the code o the LCD
To be honest I used AI tool to help me with that part, I asked CHATGPT to share with me how to setup the code for the LCD to display when the door gets opened "Hello", Closed "Goodbye", Stand status "Have a good day".
With no doubt, the skills and knowledge that I learned this week will help me to design and build the electronic circuit and coding it using Arduino, In addition to be able to control the project using smart phone.
This week was the most exciting week that I have spent during the diploma until now. I hope that the following weeks will be more exciting than this week. I really have learned a lot of things that I will mention in the next points:
Understanding the concept of Arduino.
Learning how to power every single component connected to the Arduino
Learning how to power multiple components on the same circuit in different state using code .
Understanding the basic of programing.
Be able to write code on the Arduino IDE.
Be able to control the project through Smart phone by applying the BT-module.