Week 7
Smart Parking System
Ideation
Tell us about your assignment's idea for this week. Why do you care about this idea? What inspired you? (Please include images or links to sources of inspiration)
This week’s assignment was to design and program a smart device that performs a certain function.
I chose to make smart parking because I watched a video about it, I liked the idea, and decided to simulate it
https://www.youtube.com/watch?v=6gccSyp_uJQ&t=346s
https://techatronic.com/automatic-car-parking-system-project-using-arduino/
Tool Chain
Which software/machines/materials did you use in the assignment? Why?
Software:
Tinkercad: to build the virtual circuit
Arduino IDE: to upload the code to the Arduino board
Electric Components:
Breadboard, jumpers to connect the component
1 servo motor: to control the movement of cars in & out
1 Ultrasonic distance sensor: to detect the cars coming out of the garage
1 IR sensor: to detect the cars entering the garage
LCD 16*2 (I2C): to display the available slots
Arduino Uno: to read the input signals from the IR & ultrasonic sensors, and control the movement of the servo motor & LCD output messages
Buzzer: to add sound effects
Others:
Cardboard - scissors- ruler - tape
Design/Preparation Process
Explain the design and/or preparation process of your assignment. How did you use the tool or software to design and/or prepare your assignment before fabrication/implementation?
Designing the virtual circuit on Tinkercad
I bring the following components on Tinkercad
Input components: IR sensor & ultrasonic sensor
Output components: LCD, servo motor & buzzer
Then, I build the virtual circuit without coding
Development/Implementation Process
Explain the development/implementation process of your assignment. How did you use the machine/tool to manufacture or implement the design of your assignment?
Building the physical circuit
I use the same list of virtual components, except for the PIR sensor, I used the IR sensor which has the same function
Firstly, I test the wiring & function of each component individually, then the whole circuit was built
-I Followed this tutorial to test the LCD I2C:
Vin of LCD was connected to the positive rail on the breadboard,
GND of the LCD was connected to the negative rail on the breadboard,
SDA of the LCD was connected to the A4 pin on the Arduino
SCL of the LCD was connected to the A5 pin on the Arduino
- I followed this tutorial to test the ultrasonic sensor & to calculate distance:
VCC of the ultrasonic sensor was connected tothe positive rail on the breadboard,
GND of the ultrasonic sensor was connected to the negative rail on the breadboard,
Trig pin of the ultrasonic sensor was connected to pin 8 of the Arduino
Echo pin of the ultrasonic sensor was connected to pin 10 of the Arduino
- This tutorial for controlling the buzzer tone:
The negative wire was connected to the negative rail on the breadboard, & the positive wire was connected to pin 9 on the Arduino board
- And this tutorial for the IR sensor:
VCC of the IR sensor was connected to the positive rail on the breadboard,
GND pin of the IR sensor was connected to the negative rail on the breadboard,
OUT pin of the IR sensor was connected to pin 5 of the Arduino
- Servo motor:
VCC of the servo was connected to the positive rail on the breadboard, GND pin of the servo was connected to the negative rail on the breadboard, and OUT pin of the servo was connected to pin 3 of the Arduino
- Buzzer
GND pin of the buzzer was connected to the negative rail on the breadboard,
the remaining pin was connected to pin 9 of the Arduino
Programming the smart parking system using Arduino IDE software
The first part includes the used libraries & the definition of the components' pins & the variables
This part includes the setting of pins as input or output, starting communication with the serial monitor, the orders that execute only one time such as the initial value of the servo motor & the initial message of the LCD screen
This part tests the input values of the IR & ultrasonic sensors. Also, clears the trigger response of the ultrasonic sensor, & calculates the input distance. For more information, check this tutorial:
https://howtomechatronics.com/tutorials/arduino/ultrasonic-sensor-hc-sr04/
This part controls the entrance of cars according to the input IR value
a car can enter the parking only if there is an available slot inside the parking, then the gate will open by changing the value of the servo motor, a welcome message will be displayed on the LCD screen and the number of available slots will decrease by 1
If there is no available slot, the gate will not open, and a message will display on the screen indicating that the parking is full and the buzzer will produce a sound effect
This part controls the exit of cars from the parking by the ultrasonic sensor value only if one or more cars are inside the parking, the gate will open by changing the value of the servo motor, a message will be displayed on the LCD screen and the number of available slots will increase by 1
This part resets the displayed message on the screen
Click here to find the code file.
Finally, It was tested using the serial monitor & uploaded successfully on the Arduino UNO board
Making the enclosure & Mounting the Components
A cardboard box was used to host this circuit, then the system was tested
Overcoming Challenges
What kinds of challenges or problems did you face while doing the assignment, tutorials, or exercises? How did you solve them? Did you ask for help from an instructor or peer? Please provide a link to the tutorial or article that you used to solve your problem (if any)
LCD was displaying only the first character, I searched Google and found that I installed an older version of the library (1.1.1). I've just installed the latest version (1.1.2) and it worked successfully
I learned from this tutorial (https://forum.arduino.cc/t/how-to-display-variables-on-i2c-lcd/617026) how to display variables on LCD I2C
There is no IR sensor on Tinkercak, so I used PIR instead
Final Project
How can you use the skills and knowledge that you've acquired this week in your final project?
We learned Arduino code structure, how to write Arduino C code syntax correctly & debugging skills