In this experiment, we will learn to check distance in the serial monitor using ultrasonic.

Components Used: 

  • 1 x Arduino Uno ( You can use other boards also )
  • 5 x Jumper Wires M-M
  • 1 x Ultrasonic Sensor
  • 1 x Breadboard

    Description

  • The principle of ultrasonic distance measurement is the same as that of RADAR.
  • The Ultrasonic module has two Transducers, one for  Transmit & the other for Receive. Both are fixed on a single PCB with the control circuit so that it can be easily used in your Robo projects. Ultrasonic distance sensor provides precise, non-contact distance measurements from about 2 cm to 400cm. Ultrasound is a high-frequency sound of frequency 40 KHz (we can’t hear this frequency, but animals can).

    MIN REQUIRED:20

Procedure

  1. Take Breadboard.
  2. Fix the Ultrasonic onto the breadboard.
  3. now Connect the pins of ultrasonic sensor as follows:
  4. PIN 2 of Arduino to TRIG of Sensor module.
  5. PIN 3 of Arduino to ECHO of Sensor module.
  6. 5V of Arduino to Vcc of Sensor module.
  7. GND to GND.
  8. Connect Arduino to your Laptop/PC by USB Cable. ( we use A to B USB cable for Arduino which is also used in printers )
  9. Open Arduino IDE ( You can download it from here or you can use online platform Arduino Web editor )
  10. Type the code Below given.
  11. Check program and then upload it.
LINES OF CODE