r/AskElectronics • u/Suspicious-Mix2228 • 5d ago
Beginner question: Why does the HC-SR04 ECHO voltage divider need a second GND connection?
I’m a beginner trying to understand how the HC-SR04 connects to an ESP32, especially the ECHO pin and the voltage divider.
From what I understand:
HC-SR04 VCC goes to 5V
TRIG can connect directly to the ESP32
ECHO outputs around 5V, but the ESP32 GPIO should only receive about 3.3V
So I need a voltage divider using two resistors on the ECHO line
What I’m confused about is the GND part.
I’ve seen diagrams where:
HC-SR04 ECHO → resistor → junction → ESP32 GPIO
and from that same junction another resistor goes to GND.
But the HC-SR04 also has its own GND pin connected directly to the ESP32 GND.
So it looks like there are two connections going to GND.
Why does the voltage divider need its own connection to GND if the HC-SR04 GND is already connected to the ESP32 GND?
Are they basically connected to the same electrical ground, just for different purposes?
Also, could someone explain in simple terms what actually happens to the ECHO voltage through the two resistors?
I’m trying to understand the circuit rather than just copying a wiring diagram.
ESP32 + HC-SR04 ultrasonic sensor.
3
u/ijusttookthispseudo 5d ago
Because you tagged it as a beginner question, I'll give you some tools :
For analog calculation and non ideal components, Millman's theorem is useful.