# Issues using an Ultrasonic Sensor with Raspberry Pi

I am conducting a project which needs to use a precise ultrasonic sensor but I am having trouble working it with the raspberry pi. The sensor I’m using is the Senscomp 600 series; the manual isn’t available online but I’ve posted a few relevant pages here. I realize the sensor works on 5V logic but I figured a 3.3V signal would be enough to set the Trig port to logic 1 (as it was enough for another 5V logic sensor I’ve used in the past) and I could simply use a voltage divider to bring the output Echo signal down from 5V to 3.3V. However after connecting the circuit it does not seem to work. The issue could be that the sensor requires a higher Trig voltage (it says +4V in the manual so maybe that’s the minimum), in which case how could I increase my signal voltage? I’m not very familiar with this, but I’ve read of people using a transistor to output a 5V signal using a GPIO pin and the 5V pin.

Alternatively the issue might be my set-up. The manual calls for a pull-up resistor to be established to a 5V power supply, but since the logic is 3.3V for Raspberry Pis, I have the Echo pin pulled up to 3.3V. Here is a diagram of my circuit:

I am pretty new to circuits, but as I understand it, the echo pin with a pull resistor acts like this:

when the Switch (in this case the echo pin from the sensor) is open, the MCU (in this case the Raspberry Pi) will read VCC (logic 1), and when the Switch is closed, the MCU will read 0V (logic 0). If this is how it works, pulling up to 3.3V should work perfectly find for the raspberry pi (I think).

Also note that I have the sensor connected to an external 5V power supply and is not drawing power from the raspberry, as is suggested in the manual. The python code I’m using measures the time from when Trig is set to True, to when Echo is measured to be True, then multiplies it by the speed of sound. Any advice on what I could try would be much appreciated. As always, thank you very much!

• google 3.3v level shifter – jsotola Feb 25 '18 at 20:00
• The problem here is that you do not know what the problem is. You need to find a way, such as using a scope, or even a series capacitor to couple into the sound card of your computer to determine if the ultrasonic module is transmitting and signalling an echo, or not. A little web searching will show it is generally believed that 3.3v inputs are sufficient to trigger these modules. Additionally consider that Linux-based (or otherwise multitasking) software environments as typically run on the Raspberry Pi tend to have issues with precise timing. – Chris Stratton Feb 25 '18 at 20:39