It's time to build our HC-SR04 circuit. A schematic of our circuit is shown in the following figure. This wiring will be suitable for both an HC-SR04 or HC-SR04P module:
Figure 11.6 – HC-SR04 (5-volt logic ECHO pin) circuitÂ
As a reminder, the HC-SR04 module (or an HC-SR04P wired like this to a 5-volt source) is a 5-volt logic module, and hence you will notice the voltage divider in the circuit created by the two resistors to convert 5 volts into 3.3 volts. If you need a refresher on voltage dividers, we covered them in detail in Chapter 6, Electronics 101 for the Software Engineer.Â
Let's build this circuit on our breadboard:
Figure 11.7 – HC-SR04 circuit breadboard layout (part 1 of 2)
Here are the steps to follow to create the first part of your breadboard build. The step numbers match the numbers in black circles in Figure 11.7:
- Place a 1kΩ resistor (R1) into your breadboard.
- Place a 2kΩ...