Part 9 of 15
Distance sensor HC-SR04
Measures distance with sound, just like a bat
In your kit: 1×🔎 What is it?
This sensor sends out a little sound that you cannot hear. The sound bumps into something and comes back. The sensor measures how long that takes. This way your Arduino knows how far away something is: from 2 cm to about 4 meters.
🔌 This is how you connect it
- Trig (send) to D9
- Echo (receive) to D10
- Vcc to 5V
- Gnd to GND
Wiring diagram
| From | To |
|---|---|
Arduino UNO · 5V |
Distance sensor HC-SR04 · Vcc |
Arduino UNO · GND |
Distance sensor HC-SR04 · Gnd |
Arduino UNO · D9 |
Distance sensor HC-SR04 · Trig |
Arduino UNO · D10 |
Distance sensor HC-SR04 · Echo |
✨ What can you do with it?
- A parking sensor
- A distance meter
- A barrier gate that opens by itself
💡 Tip
The two "eyes" are the speaker and the microphone. Point them straight at what you want to measure.
Projects with this part
Codey Online is a product of OTRONIC