Ultrasonic Sensor
Here will be explained how to use a distance sensor. I may be look hard or difficult to start using the so called sonar sensor, but it is easier as it looks.
How an Ultrasound Sensor
An ultrasound sensor is composed of two main elements, the sender and the receiver. The sender sends waves (around 40 KHz.). Wenn these waves find an obstacle (a wall for example), bounce and return and the receiver catches these waves. The time it takes a wave to return is directly proportional to the distance (between 2 and 50 cm.)
Measuring Distance
The integration of an utrasound sensor using an Arduino boar is simple, just wire the circuit as shown in the picture, download the code and test using the terminal from the Arduino IDE (programming environment). For more details, please watch the video. The code is available in the video. Thanks.