Alright, so recently I decided to use sensor for different applications. Sensors are a great way to hear, see, and even feel things that we as humans can’t see or hear. This post is the first in a long series to come about making, circuits, and the discovery of the world of things around use.

My latest project was to use an ultrasonic sensor to detect distance. This can have many applications, below you can find a GIF of the components:

Components

So what are the components I used to make this happen:

The sensor has 4 main pins:

How does an ultrasonic sensor work?

You do know that a bat is blind right, so how does this blind genius catch its prey? it simply has an ultrasonic built-in sensor.

echolocation

First it triggers a sound signal to scavenge for preys. Once the sounds signal hits the poor un-lucky prey, it returns back to the bat. The bat then does some built-in biological calculations and knows exactly where the prey is.

The biological calculations are based on the below equation:

All what it needs to do is calculate the Round-Trip-Time (RTT), then divide by two to get the time to reach prey. Then the freaking genius bat just needs to plug this value of time, in the distance equation above to get the distance. If you are asking how does it know that the speed of sound is constant and has a value of 343m/s? well, besides being a genius, it happens to know how to use Google.

The code can be written in any pi-friendly language.

Have a nice Day!