The distance sensor (HC-SR04) is used to measure distance using ultrasonic waves.

The sensor sends pulses of ultrasonic waves, which bounce off an object and come back to the sensor. The time taken by the ultrasonic waves to return to the sensor tells how far the object is from the sensor.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/f2005791-35d7-442f-9bd3-c0a2ade12f2f/Sensor_Ultrasonic.png

Did you know? Bats use the same principle to detect obstacles and food when they fly!

Examples:

  1. Water Tank Monitor: sensor measures water level of the tank to alert when it is full or empty.
  2. Smart Traffic Light: sensor detects when vehicles are nearby to accordingly change traffic signal light.
  3. Parking Sensor: sensor detects when vehicles are parked too close to a gate or wall to alert the driver.
  4. Automatic Light- LDR based: sensor detects when an object is close enough to switch on a light.

Units:

Pin:

The port named "Ultrasonic Sensor" on the SNT Kit PCB, where:

Wire:

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b0e02942-b1c2-43b6-80be-9ebd588c6502/Input_Distance_sensor-01.jpg