Convert digital signal from TTL 5V to Raspberry Pi GPIO 3.3V

Thread Starter

LordOfThunder

Joined Jun 27, 2018
32
Hello!

I am a Ph.D. student in particle physics and for our experiment we need to convert a 5V TTL digital signal (16-bits actually) coming out of a Phillips 726 converter and read it using the GPIO pins of a Raspberry Pi 4. We do not need bidirectional communication. We just need to read this 16-bits number that comes in the form of 16 parallel TTL signals. The number changes every 2.5 seconds or so, so high speed is not really an issue here.
We are going to order all the parts and chips from the Adafruit website. I think we have basically three options:
  1. A simple divider made of resistors
  2. The 74LVC245 Chip
  3. The TXB0108 Chip
I am leaning towards the 74LVC245 Chip, do you think it is the best choice too? If not why?
The output of the Phillips 726 has the following specs:
TTL Output One TTL output per channel, LEMO style connector; sources 45 mA to drive 50 ohm load or 1000 standard TTL loads, sink current of 100 mA; able to drive 100 standard TTL loads. 3.5 nsec rise and fall times.

Thank you
Giorgio
 

ericgibbs

Joined Jan 29, 2010
9,301
hi HOT,
Use a 3K3 and 2k divider as down level shifter ie: 5V > 3,3V
eg; 2k to the 5V signal and the bottom of the 3k3 to 0v,, take off ~3.3V at the junction.

E
 

Lo_volt

Joined Apr 3, 2014
91
As a second layer of protection, I will often add a zener diode to clamp the voltage at the input to 3.3 volts. This is helpful if there's a voltage spike on the input or if the lower divider resistor opens.
V_Divider w-Zener.PNG
 

Attachments

Analog Ground

Joined Apr 24, 2019
269
You may want to think about terminating the signals in the characteristic impedance of the cables to prevent overshoot and undershoot of the signal when it changes. The data rate may be slow but the signal edges look to be fast. You don't want the RPi inputs levels to be exceeded when the signal changes (both high and low). If this happens, the RPi input protection circuitry will turn on and you will get unwanted current spikes into the IC. If the cables have a 50 ohm impedance, like typical coaxial cables with the Lemo connectors, use 50 ohms at the RPi end. Now, it looks like the 726 TTL output is set to provide 45 mA into a 50 ohm load. This gives a level of about 2.25 volts which is fine for going directly into an RPi. So, I am suggesting terminating the signals with just 50 ohms and not a two resistor divider. If the cabling is short enough, then you can consider the other approach but it all depends on the cable length and characteristics.

In general, I would use some sort of line receiver before going into the RPi and not go directly into the RPi.

Edit: I am not an RPi expert and it looks like 2.25V gives no margin for an input high level. See the link below. A conservative design would use a 50 ohm line termination and a receiver before going into the RPI.

http://www.mosaic-industries.com/embedded-systems/microcontroller-projects/raspberry-pi/gpio-pin-electrical-specifications
 
Last edited:

Thread Starter

LordOfThunder

Joined Jun 27, 2018
32
@Lo_volt Thanks you for the additional info.

@Analog Ground I understand what you mean only partially. I understand the idea of terminating the lLEMO cables to avoid ringing of the signal ... but I do not understand what you mean by line receiver. I am not by any means an expert in electronics. I tried to google up "line receiver" but the top results were all about differential line receivers such as RS485 (that is not our case).
The cable that we are going to use is 50ohm male-male LEMO coaxial cable of about 50 cm of length.
If you could draw a simple circuit diagram (even only the logical blocks is fine), it would help me understand better. Thank you anyway for the hints.
 

ericgibbs

Joined Jan 29, 2010
9,301
hi LOT,
I would recommend that you try the simple resistor divider method first, no zener diode, check the circuit performance
E
 

Analog Ground

Joined Apr 24, 2019
269
I recommend the 74LVC245 you mention in your initial post. It has a "TTL compatible" input with a 3.3V power supply. The 74vhct541 you found uses a 5V power supply and puts out a signal above the RPi input range which you are trying to avoid. If you go with the voltage divider input method, be sure to check out what happens to the 726 module TTL output when not terminated in 50 ohms. It is specified for 50 ohm termination and does not use what we think of as a standard TTL driver.
 

Reloadron

Joined Jan 15, 2015
4,857
Lately everyone wants to convert one way or the other, 5.0 to 3.3 or 3.3 to 5.0. Considering it's less than a buck ($1.00) a channel I would be thinking about having a few of these laying around. Not to say using a voltage divider isn't practical but it's a simple Bi-Directional Logic Level Converter.

Ron
 
Lately everyone wants to convert one way or the other, 5.0 to 3.3 or 3.3 to 5.0. Considering it's less than a buck ($1.00) a channel I would be thinking about having a few of these laying around. Not to say using a voltage divider isn't practical but it's a simple Bi-Directional Logic Level Converter.

Ron
There's also a comparable Adafruit board. I thought that I looked at these a year or two ago and figured out that the Adafruit one was somehow better, but I sure can't remember now why I thought that, and they look conceptually the same to me now. Maybe I compared it to a different SparkFun product back then? Not sure.

Anyway, lots of good options, and I think the concept that both of these circuits work on is really clever - the compatibility with I2C pullups is an interesting detail.

https://www.adafruit.com/product/757
 
Top