ULTRASONIC SENSOR
HC-SR04
To get TURL-X to see we use an ultrasonic sensor called the HC-SR04.
The HC-SR04 is a sensor that measures distance to objects without touching them — like a tiny radar.
The HC-SR04 is basically a mini bat “eye”:
- It sends out a quick, silent ‘squeak’ (ultrasonic sound wave — way too high-pitched for humans or dogs to hear).
- The sound bounces off whatever is in front (a wall, your hand, a box, etc.) like an echo.
- The sensor listens for that echo coming back.
- It times how long the sound took to go there and back.
- Since sound travels at a known speed (about 343 meters per second in normal air), the Arduino can do quick math:
Distance = (time for round trip × speed of sound) ÷ 2 (Divide by 2 because the sound went to the object and back.)
So if the echo comes back super fast → object is close.
If it takes longer → object is farther away.The sensor can measure from about 2 cm (almost touching) up to 400 cm (about 4 meters), with pretty good accuracy (±3 mm).