0
\$\begingroup\$

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: Circuit for sensor and Raspberry Pi

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

Pull up resistsor 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!

\$\endgroup\$
3
  • \$\begingroup\$ google 3.3v level shifter \$\endgroup\$
    – jsotola
    Commented Feb 25, 2018 at 20:00
  • 1
    \$\begingroup\$ 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. \$\endgroup\$ Commented Feb 25, 2018 at 20:39
  • 1
    \$\begingroup\$ I’m voting to close this question because has been long abandoned with critical detail missing: both a voltage divider and a pull-up are mentioned, but values are given for only one, and the two are likely incompatible. Additionally there appears to be a VIH violation on the trigger which has not been investigated. \$\endgroup\$ Commented May 14, 2020 at 3:18

2 Answers 2

1
\$\begingroup\$

I'm not an electronics expert but I think the problem is as you say. 3.3V is not enough to activate the triggering of the sensor. For this you can use a N channel mosfet transistor like the schematic. In principle, any N-channel mosfet with a Vgs(max) < 3V should work.

You can also try a commercial circuit like this one: Logic Level Converter

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
0
\$\begingroup\$

schematic

simulate this circuit – Schematic created using CircuitLab

(poor man's level shifter)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.