0
\$\begingroup\$

I'm trying to use an ultrasonic sensor with a Raspberry Pi. The ultrasonic sensor's echo is 5V, but the Raspberry Pi's GPIO pins can only handle 3.3V inputs. I ended up getting an 8 channel logic level converter to convert the 5V signal to 3.3V since I have three ultrasonic sensors I need to do this for and wanted to avoid a mess of resistors.

I believe I have set everything up correctly, but I am unable to get the 5V echo to convert into a 3.3V signal. I have verified that the ultrasonic sensor is working. If I skip the voltage conversion and allow the 5V echo to go straight to the GPIO pin, I can see the distance is being measured correctly.

I created a diagram showing my current approach. The ultrasonic is connected to ground and a 5V power. It receives a 3.3V trigger signal and provides a 5V echo signal. The 5V echo signal goes to B2 and should be coming out A2.

I tried connecting OE to 3.3V, 5V, and ground, but none of those combinations work. I have also verified that the A side is supposed to be receiving the lower voltage and the B side is supposed to be receiving the higher voltage.

Research

Here is an example I found about the usage:

Example wiring for bidirectional 3.3V to 5V conversion:
VA: 3.3V power +
VB: 5V power +
GND: Ground (-) from the two power supplies (3.3V and 5V power supplies )
A1 to 3.3V pin (such as from Raspberry Pi)
B1 to 5V pin (such as from Arduino)
When A1 has a high 3.3V signal, B1 will output the same signal at 5V and when B1 has a high 5V input, A1 will output the same signal at 3.3V ( No direction control required because this product is bidirectional! )

Here is a very helpful Youtube video

Here is another (less helpful) Youtube video

Additionally, I found this post which seemed relevant, but I'm not very familiar with electronics and wasn't sure if the issue in that question was the same.

I would really appreciate any advice. Thanks!

Diagram for a single ultrasonic sensor

\$\endgroup\$
1
  • 1
    \$\begingroup\$ For this purpose you should simply use a resistive divider. \$\endgroup\$ Nov 8 '20 at 3:49
1
\$\begingroup\$

I’ve had nothing but trouble with bi-directional level shifters and would advise using unidirectional shifters whenever possible. Bidirectional devices try to determine which side is driving and which is the load, but in my experience can easily be destabilised if the load side has any significant capacitance, which can cause it to present a low impedance when switching at high speed.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks for the response. Would you be able to recommend any product specifically? \$\endgroup\$ Nov 8 '20 at 3:48
  • \$\begingroup\$ Most certainly, I’ve used a 74LVC2T45 on a recent project. \$\endgroup\$
    – Frog
    Nov 9 '20 at 4:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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