Garage Sensor
Print Profile(1)

Description
Arduino Parking Assistant
An Arduino-based parking assistant that uses an ultrasonic sensor to measure your car's distance from a wall or obstacle. Based on the measured distance, it lights up one of three LEDs (green, yellow, red) to help you park safely and accurately.
Features
- Ultrasonic distance measurement using HC-SR04 sensor
- Three-level LED indication:
- Green LED: Safe distance
- Yellow LED: Getting close
- Red LED: Stop!
- Automatic timeout: LEDs turn off after 30 seconds of inactivity
Installation Instructions
***CODE IS ON GITHUB***
1. Install Arduino IDE
- Download the Arduino IDE for your operating system.
- Follow the installation instructions for Windows, macOS, or Linux.
- Connect your Arduino board to your computer via USB.
2. Set Up the Project
- Clone or download this Repository from Github.
- Open main.cpp in the Arduino IDE.
- Select your Arduino board and port from the Tools menu.
- Click Upload to flash the code to your Arduino.
Hardware Required
- 1 × Arduino Uno (or compatible) $16.17 USD
- 1 × HC-SR04 Ultrasonic Sensor $4.63 USD
- 3 × LEDs (Red, Yellow, Green) $6.09 USD
- 3 × 220Ω resistors $0.1 USD
- Jumper wires $0.1 USD
- Breadboard $3 USD
Total = $30.09 USD
Schematic Diagram
Below is a schematic diagram showing how to wire the components:
[HC-SR04] [Arduino UNO] VCC ------> 5V GND ------> GND TRIG ------> Pin 9 ECHO ------> Pin 10 [LEDs] Green ------> Pin 2 (with 220Ω resistor to GND) Yellow ------> Pin 3 (with 220Ω resistor to GND) Red ------> Pin 4 (with 220Ω resistor to GND)
Distance Calculation
The HC-SR04 ultrasonic sensor measures distance by sending out an ultrasonic pulse and timing how long it takes to receive the echo. The distance is calculated using the formula:
distance in cm = duration * 0.034(The speed of sound) / 2
- duration is the time of pulse
- 0.034 isnt the speed of sound, The speed of sound is 343 m/s but we want the distance in cm to I lowered the decimal places
- Divide by 2 Because we only want one way time.
- The sensor emits a pulse via the TRIG pin.
- The ECHO pin goes HIGH for the duration it takes the pulse to travel to the object and back.
Usage
- As you approach the sensor, the LEDs indicate your distance:
- Green: Far (safe)
- Yellow: Getting close
- Red: Very close (stop)
- If the distance category changes, the corresponding LED lights up.
- If no change is detected for 30 seconds, all LEDs turn off automatically.
License
You shall not share, sub-license, sell, rent, host, transfer, or distribute in any way the digital or 3D printed versions of this object, nor any other derivative work of this object in its digital or physical format (including - but not limited to - remixes of this object, and hosting on other digital platforms). The objects may not be used without permission in any way whatsoever in which you charge money, or collect fees.












Comment & Rating (9)