Ultrasonic Sensor

In this tutorial, we are going to learn about the Ultrasonic Sensor and read its distance using the serial monitor!

About the Sensor

The ultrasonic distance sensor uses ultrasonic waves - a very high-pitched sound that we cannot hear to measure the distance it is from an object.

It is in a transceiver configuration, where both the transmitter and receiver are on the same sensor.

One of the uses of the ultrasonic distance sensor is in the automotive industry. They are usually used as reverse warning sensors but are increasingly used in self-driving vehicles.

Using the Sensor

The ultrasonic sensor we are going to use is the HC-SR04, which is commonly used in Arduino circuits:

Note: We are using the 4 pin sensor instead of the 3 pin version, which can be found by typing ultrasonic sensor in the component search bar.

Let us go into TinkerCAD and create a new circuit. We are going to assemble it like this:

We are going to program the Arduino such that the ultrasonic distance sensor will output the distance measured into the serial monitor. The code blocks have been extensively simplified by TinkerCAD and it just looks like this:

This is what you will see when you start the simulation:

Let's build this circuit on the SSTuino and try it out! This is what it looks like on the SSTuino:

Let's share your work! Record and post a video onto Instagram with the hashtag #sstuino!

Resources and Going Further

⬅️ BackNext ➡️