We will be building the following circuit on our breadboards. Similar to our HC-SR04 example and circuit in Figure 11.5, we need to use a voltage divider since our Hall-effect sensor outputs 5-volt logic, which we need to shift down to 3.3 volts:
Figure 11.10 – Hall-effect sensor circuit
You will notice that the output of this circuit is dualistic and will depend on which sensor you are using:
- For a non-latching switch or latching switch type Hall-effect sensor, you will connect the circuit directly to GPIO 21 since the sensor will output a digital HIGH/LOW signal.
- For a ratiometric type Hall-effect sensor, you will need to connect the sensor to your Raspberry Pi via your ADS1115 analog-to-digital converter since the sensor outputs a varying analog voltage.
I have not included the ADS1115 wiring in Figure 11.9 or in the following stepped breadboard layouts. We have already seen how to connect an analog output...