This Arduino project demonstrates how to use an ESP32 development board with an HC-SR04 ultrasonic sensor to measure distance and display the results on a 0.96-inch OLED display. The HC-SR04 sensor uses sonar to calculate the distance to an object by measuring the time it takes for an ultrasonic pulse to travel to the object and back.
- Real-time distance measurement
- OLED display for easy readout
- Arduino IDE compatible
- ESP32 development board
- HC-SR04 ultrasonic sensor
- 0.96-inch OLED display
- Jumper wires
- Connect the components as per the provided schematic.
- Install the necessary libraries in the Arduino IDE.
- Upload the provided code to the ESP32.
- Observe the distance measurements displayed on the OLED screen.
The Arduino sketch (main.ino
) contains the code for reading the sensor data and displaying it on the OLED display.
ckt.png