I know there is a post from 2015 on this subject, to save people reading through all of the earlier posts, I thought it might be best to start again.
So I am helping someone build a robot, they have got a PI zero, explorer Phat, two 50;1 micro motors etc. That side is ok.
we want to use a HC-Sr04 range sensor. As this is a 5 volt device I thought we could connect to the 5volt input / outputs on the explorer hat.
we are using input 1 for the echo and output 1 for the trigger with the following gpiozero code.
from gpiozero import DistanceSensor
from time import sleep
sensor = DistanceSensor(echo=23, trigger=6)
print('Distance: ', sensor.distance * 100)
Echo is on gpio23 and trigger on gpio 6 as per the explorer hat documentation.
When we do get a reading it is in correct.
I notice in the technical documentation for the board there is a comment about the outputs sinking current to ground when turned on and having to connect device to a voltage supply and then to the output pin.
does anyone know how this relates to the distance sensor, e.g. i have got to wire the sensor up differently, I am confuse at the moment.
If we connect the sensor direct to the PI using a potential divider on the echo pin as per the GPIO example, then it works.