Using a single bi-directional pin with HC-SR04 Ultrasonic Sensor | Cypress Semiconductor
Using a single bi-directional pin with HC-SR04 Ultrasonic Sensor
I'm encountering a problem when attempting to integrate the HC-SR04 ultrasonic sensor using a Psoc4 Pioneer Kit 044. The HC-SR04 has a 4 pin interface: vcc, gnd, trigger, and echo. The trigger pin sends a 10us pulse triggering the sensor to send its 40khz ultrasonic pulse. The echo pin receives a digital pulse from the sensor proportional to the distance detected by the sensor.
I have successfully interfaced the HC-SR04 sensor with an Arduino using 3 pins by tying echo and trigger to the same pin. Within the Arduino firmware, the pin is set to an output for the trigger and then set to an input to receive the pulse.
I have 8 sensors that I would like to interface with the Psoc4 so I really need to achieve the same 3 pin interface as there are other components in this design. I have successfully configured the Psoc4 to interface with the HC-SR04 using separate trigger and echo pins. The firmware triggers the pulse on the trigger pin and a counter detects the echo pulse.
What I am unable to do is to combine the trigger and echo pins onto a single pin. When I connect them, the 10us pulse never happens. It looks like the echo pin is pulling the trigger pin to ground. I have tried all of the pin output options to no success. I expect that if the Arduino can do this, it should be possible with the Psoc4 -- event if there needs to be some external components.
Basically, I have two questions:
1. Can/How should the pin interface be implemented to allow both the echo and trigger pins of the sensor to be tied to a single Psoc4 pin?
2. How can single sensor solution be expanded to support 8 sensors?
I have attached the HC-SR04 datasheet. Unfortunately, it doesn't provide much in terms of electrical specs.