An Arduino-based Distance Meter using HC-SR04 Ultrasonic Sensor and I2C LCD. Features a dynamic buzzer alarm that beeps faster as objects get closer.
- Accurate Sensing: Range within 2 to 334.75, not crossing 334.75, tested!
- Dynamic Buzzer: Buzzer sounds as the object came closer.
- Arduino Uno
- HC-SR04 Ultrasonic Sensor
- I2C LCD Display (16x2)
- Piezo Buzzer
- Breadboard & Jumper Wires
| Component | Arduino Pin |
|---|---|
| Ultrasonic Trig | Pin 9 |
| Ultrasonic Echo | Pin 13 |
| Buzzer (+) | Pin 8 |
| LCD SDA | A4 |
| LCD SCL | A5 |
| All VCC | 5V |
| All GND | GND |
- Clone this repository or download the
.inofile. - Install the
Adafruit_LiquidCrystallibrary in your Arduino IDE. - Upload the code to your Arduino Uno.
- Open the Serial Monitor or check the LCD for readings.
আমরা map() ফাংশন ব্যবহার করেছি বিপ-সাউন্ডের বিরতি সেট করতে:
int wait = map(distance, 2, 100, 50, 500);
- 2cm distance = 50ms delay (Fast beep)
- 100cm distance = 500ms delay (Slow beep)


