Introduction:
Sensors are the unsung heroes of physical computing, enabling our devices to interact meaningfully with the world. In this post, I recount my experience using an ultrasonic sensor to explore distance measurement.
Focus on the Ultrasonic Sensor:
The HC-SR04 ultrasonic sensor is particularly intriguing. It works by emitting sound waves and timing their echo—a process that transformed my understanding of how technology can "sense" its environment.

Wiring the Ultrasonic Sensor:
For this setup:
- Trigger Pin: Connect to digital Pin 5.
- Echo Pin: Connect to digital Pin 4.
- Power and Ground: Ensure VCC is linked to 5V and GND to ground.
Creating a clear wiring diagram was immensely helpful in visualising the process.
Basic Code Example:
I developed a simple sketch to:
- Trigger the Sensor: Send a brief pulse.
- Read the Echo: Capture the returning signal.
- Calculate Distance: Use the speed of sound to convert time into distance.
Understanding the code made the experience not just technical but truly enlightening.