Wiring the breadboard

Each ultrasonic sensor uses two wires, so a level shifter for the left-hand side and the right-hand side are needed. Ensure that the whole robot is switched off before proceeding any further.

The signal on one side is out and the other is in, so I2C safe bidirectional level shifters will leave the least room for problems. Here is a simplified view of the connections to illustrate how it works:

Simplified view of wiring distance sensors

In the simplified view, first note that the ground pins are connected. The 5V actually also supplies the 3V side, so you do not need to connect this to the Pi as an additional step. The ...

Get Learn Robotics Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.