Smart Parking System (Distance limitation)
The task this week is to design and program a smart device that performs a certain function or solve a problem using Arduino UNO to read signals from multiple input components (Sensor, Switch, or variable resistor) to control multiple action components (Motor, Buzzer, LED and others.
actually, I am a person who loves cars and while thinking about the idea of this Assignment I found a very funny video In front of me
which is https://www.youtube.com/watch?v=c_u8oPMBGEI
Despite this video is funny, it inspires me because most people face this problem, especially women to decide the allowable distance limit for them from the back wall to avoid accidents.
So I decided to make a simple design from carboards for a wall and put some ultrasonic sensors to limit the distance for the car while parking by sound indication and RGB Led .After parking process, the user will use pushbutton to switch ON a white LED that verifies the parking action is done correctly.
And while searching i found this resource ,too. https://create.arduino.cc/projecthub/hoozi/smart-parking-system-144012
Arduino UNO
Breadboard
TinckerCad
Arduino IDE
Crocodile wires
Cutter
CardBoard
Buzzer
Ultrasonic Sensor
Jumpers
ON/OFF Switch
RGB LED
Arduino cable
I started my assignment by designing the circuit on TinkerCad software.
This circuit undergoes two phases:
First Testing the distance through ultrasonic sensor and take an action.
I connected the RGB and I assigned :
Green light to indicate safe zone for the user to park (the distance range is greater than 10 cm and smaller than or equal 50 cm).
Blue Light to indicate that the parking distance is Prefect at that happens at distance equal to 10 cm.
Red Light to indicate a warning as the distance is smaller than 10 cm and in this case the buzzer works.
In this phase input is Ultrasonic sensor and output is Buzzer and RGB light.
Verification Test
Second Verify the parking by a push button and a white LED; when the user presses the push button, a verification massage for the parking will appear and the white light will appear for a second indicating that the parking process is done correctly .
In this phase input is the push button and output is the white LED.
Tinkercad Circuit and Simulation
Circuit Connections
The circuit connections process was done through some steps :
Connecting the Ultrasonic sensor ( First input ) and that is done by connecting the VCC,GND,TRIG and ECO pins to the Arduino.
Connecting The RGB LED to represent each distance with a light color which will be an indication to the system user of its distance limitation; RGB pins are connected as follows : 3 to an analog Arduino pins and 1 to the Ground.
Connecting Buzzer to an Arduino pin and a Ground ( the code state that the buzzer will be active when the distance is smaller than 10 cm which indicates a danger and the red light will appear with a warning massage.
Connecting the white LED and the Push button to work as a verifying message when the user park correctly and press the push button the white led light and verification message appear.
Circuit Recorded Video
Pictures While Testing Circuit
Arduino Code
pins declaration number and setup
Enable Trig and Echo pins then write the first testing zone (safe zone )
Check if the distance is prefect to equal exactly 10
Warning mode and buzzer works id distance is smaller than 10 cm
CardBoard Design and Testing
I started to make the box design
Then I Arranged the components to fit the box design using ( see the final video after the design )
I put the delay after the ultrasonic trigger pin to be 2000 millisecond and the program did not work correctly; when I searched I found I should make this delay time very short to be with microseconds.
https://www.c-sharpcorner.com/UploadFile/167ad2/how-to-use-ultrasonic-sensor-hc-sr04-in-arduino
https://forum.arduino.cc/t/my-code-said-state-is-not-declared-in-this-scope/570279
The codes in those links Guide me to solve my problem.
I learnt how to deal with sensors as an input and in my project I will use DHT11 temperature and humidity sensor.