Table of Contents

Having Fun with Ultrasonic Sensors

Example Description
Learn to Interface an ultrasonic sensor with Arduino, use ultrasonic sensor to measure distance and much more

Ultrasonic Sensor and It’s working

An ultrasonic sensor is an electronic device that measures the distance of a target object by emitting ultrasonic sound waves, and converts the reflected sound into an electrical signal.

How does it work?

Ultrasonic waves travel faster than the speed of audible sound (i.e. the sound that humans can hear). Ultrasonic sensors have two main components: the transmitter (which emits the sound using piezoelectric crystals) and the receiver (which encounters the sound after it has traveled to and from the target). It works by emitting a sound wave that travels through the air and bounces back to the sensor if it encounters an obstacle or object.

Circuit Diagram

Code

  1. From event  drag when flag clicked 
  2. From  control drag forever block.
  3. From  look  drag  say()
  4. From sensor pellet of Arduino drag get ultrasonic sensor distance trig() echo()

Script

Output