ONLINE
turning ideas into real things_
// TECHNICAL ARTICLE
← Back to Blog

My Third ESP32 Project Finally Lets Me Measure the Real World

Aug 06, 2026 • Wasim Shakir • software-engineering, esp32, projects, iot, career-change
My Third ESP32 Project Finally Lets Me Measure the Real World
my first ever Range finder project using ESP32

my first ever Range finder project using ESP32

A few weeks ago, if someone had told me I’d be measuring distances with a tiny microcontroller and an ultrasonic sensor, I probably would’ve laughed.

Most of my programming experience has been in web and mobile development. My work usually stayed inside a screen — buttons, APIs, databases, and user interfaces. Hardware was something I admired from a distance.

But recently I decided to make a career shift.

I wanted to understand how software talks to the physical world.

That decision led me to the ESP32.

This week, another small package arrived at my desk.

Inside was the HC-SR04 Ultrasonic Range Finder Sensor.

It isn’t an expensive sensor, and it certainly isn’t the most advanced one. But for someone learning embedded systems, it’s one of those components that opens the door to a completely different way of thinking.

Instead of rendering a webpage or processing a request, my code would now send out sound waves, wait for them to bounce back, measure the time taken, and calculate the distance to an object.

That sounded pretty amazing.

Setting it up was surprisingly straightforward.

The HC-SR04 has just four pins:

  • VCC
  • GND
  • TRIG
  • ECHO

The ESP32 sends a tiny 10-microsecond pulse through the Trigger pin.

The sensor emits an ultrasonic sound wave that’s completely inaudible to us.

When that sound hits an object, it reflects back to the sensor.

The Echo pin stays HIGH for exactly the amount of time it takes for the sound to travel to the object and return.

All my ESP32 has to do is measure that pulse duration.

From there, calculating the distance is simple.

float distance_cm = duration / 58.0;

Seeing that line of code print actual distances to the Serial Monitor felt oddly satisfying.

Of course, nothing worked perfectly on the first try.

I spent more time than I’d like to admit checking jumper wires, moving cables around, wondering why the sensor kept saying “Out of Range,” and questioning whether I had connected something incorrectly.

That’s probably my favorite part of learning embedded systems so far.

Unlike software, hardware immediately tells you when you’ve made a mistake.

A loose wire.
A wrong GPIO.
Power connected incorrectly.

Everything matters.

And honestly, I enjoy that challenge.

This project also reminded me that simple projects aren’t “too basic.”

Every beginner project teaches a concept that larger systems depend on.

Today’s lesson was measuring pulse widths.

Tomorrow it might be PWM.

Then interrupts.

Then communication protocols like I²C, SPI, or UART.

Eventually those small lessons become the building blocks for robotics, automation, drones, smart home devices, and industrial IoT systems.

There’s no shortcut around the fundamentals.

One thing I really like about documenting this journey publicly is that I can look back months later and see exactly where I started.

Maybe a year from now I’ll be working with FreeRTOS, CAN Bus, custom PCBs, or writing embedded software professionally.

When that day comes, I want to remember that it all started with blinking an LED… and measuring the distance between a sensor and my hand.

This is Project #03 in my ESP32 Beginner to Pro series.

If you’re also getting into embedded systems, maybe this repository can help you follow along.

GitHub Repository:

ESP32 Beginner to Pro
https://github.com/wasim-shakir5/ESP32-Projects-Beginner-to-Pro

Project 03:
https://github.com/wasim-shakir5/ESP32-Projects-Beginner-to-Pro/tree/main/03-Distance-Measurement

The journey has only just begun, and I’m looking forward to seeing where it takes me.

#software-engineering # esp32 # projects # iot # career-change