Building the project!
It's now time to connect the ultrasonic sensor with the RasPi board. The ultrasonic sensor works on a 5V power supply. Fortunately, we have the 5V supply pin on the RasPi board. We can provide the 5V supply from RasPi to the ultrasonic sensor. However, in reply, the ultrasonic sensor generates a 5V echo signal as an output to RasPi.
Tip
It is always recommended that you connect the ground terminals of the devices first and then the voltage supply terminals. This should be followed with almost all the electronic devices we connect with development boards such as RasPi.
As you have read in Chapter 2, Meeting the World of Electronics, we know that our RasPi needs the 3.3V level on the GPIO pins to operate safely. So, how do we connect them? It is a serious matter. In this regard, Kirchhoff will help us. With the help of Kirchhoff's current and voltage laws, we can divide the voltage into two parts. If we divide the 5V supply into 3.3V and 1.7V, we can use the echo...