Let's measure the distance using Ultrasonic Sensor
INTRODUCTION
This tutorial will browse you through connecting an Ultrasonic Sensor and measuring the distance
What is an Ultrasonic Sensor?
An Ultrasonic sensor is a device that can measure the distance to an object by using sound waves. It measures distance by sending out a sound wave at a specific frequency and listening for that sound wave to bounce back. By recording the elapsed time between the sound wave being generated and the sound wave bouncing back, it is possible to calculate the distance between the sonar sensor and the object.
Materials Required,
Ultrasonic sensor, arduino board, 4 female to male jumper cables
- Arduino Uno Board
- (1x) Ultrasonic Sensor
- (4x) Female to Male Jumper Cables
Setup :
- Connect VCC on Ultrasonic Sensor to 5V pin on Arduino Board.
- Connect GND on Ultrasonic Sensor to GND pin on Arduino Board.
- Connect TRIG on Ultrasonic Sensor to pin 3 on Arduino Board.
- Connect ECHO on Ultrasonic Sensor to pin 2 on Arduino Board.
- Connect Arduino Board to PC via USB
- Upload the following code.
- Open the Ardunio Serial Monitor. Open Arduino IDE-> Tools-> Serial Monitor
Arduino Code |
👍👍👍
ReplyDeleteAwesome
ReplyDeleteVery helpful post. Thanks bro
ReplyDelete