The HC-SR04 is a pretty cool piece of equipment. It’s one of the few sensors that you actually enjoy testing when you start getting into electronics and Arduino. From what I understand there are two versions, one with three pins and one with four. In this guide we will test the four pin version, in which the trigger (out) and echo (in) signals are in different pins.
Connecting the HC-SR04
For this guide we will use an Arduino UNO R3. Connect the sensor’s trigger pin to Arduino’s digital pin 2 and the echo pin to Arduino’s digital pin 3. Then connect the VCC pin to Arduino’s 5V out and the ground pin to the GND. That’s it!