Distance measurement Device using Ultrasonic sensor and LCD I2C display
Here’s an Arduino code that displays the distance readings from an ultrasonic sensor (HC-SR04) on an I2C LCD display in both inches and centimeters.
Components Needed:
- Arduino Uno
- Ultrasonic Sensor (HC-SR04)
- I2C LCD Display (16x2)
- Jumper wires
- Breadboard
Wiring:
- Ultrasonic Sensor:
- VCC to 5V
- GND to GND
- Trig to Pin 9
- Echo to Pin 8
- I2C LCD Display:
- VCC to 5V
- GND to GND
- SDA to A4
- SCL to A5
Video Link: - Click Here For Video
Distance measurement Device using Ultrasonic sensor and LCD I2C display simple Circuit: -
Arduino IDE Program
-----------------------------------------------------------------------------------------------------------------------------
Explanation:
- Ultrasonic Sensor: The HC-SR04 sensor sends an ultrasonic pulse and listens for its echo. Based on the time it takes for the pulse to return, the distance is calculated.
- Distance Calculation:
- Distance in centimeters =
(duration * 0.0343) / 2
- Distance in inches =
distanceCm / 2.54
- Distance in centimeters =
- LCD Display: The distance is shown on the I2C LCD in both centimeters and inches.
Libraries Required:
LiquidCrystal_I2C
: This is required for the I2C LCD. You can install it through the Arduino Library Manager.
Let me know if you'd like any adjustments!
Share, Support, and Subscribe!!! 1. PRO KAM EXPLAINED 2. Knowledge KAM 3. PRO KAM Follow us on 1. Facebook 2. Instagram 3. Pinterest 4. Blogspot 5 Twitter If you have any other ideas to make me design, you can describe them in the comment section and if I can, I will make a designing video on it. So I am waiting #prokam #pro #IDM #Solutions #Hack
0 Comments