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

#### 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:
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,517
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

#### LordOfThunder

Joined Jun 27, 2018
32
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
Thank you for the quick answer. So the simplest option is good enough in your opinion.

#### Lo_volt

Joined Apr 3, 2014
97
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.

#### Attachments

• 6.8 KB Views: 1

#### Analog Ground

Joined Apr 24, 2019
305
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:

#### 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,517
hi LOT,
I would recommend that you try the simple resistor divider method first, no zener diode, check the circuit performance
E

#### LordOfThunder

Joined Jun 27, 2018
32
hi LOT,
I would recommend that you try the simple resistor divider method first, no zener diode, check the circuit performance
E
I agree. I was already getting ready to do that. I just wanted to understand what Analog Ground was suggesting in detail.

#### ericgibbs

Joined Jan 29, 2010
9,517
hi,
Ref the zener, check the datasheets for their internal capacitance, if pulse edges are a concern.
E

#### Analog Ground

Joined Apr 24, 2019
305
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.

#### Analog Ground

Joined Apr 24, 2019
305
hi,
Ref the zener, check the datasheets for their internal capacitance, if pulse edges are a concern.
E
Good point. I see one series of zeners where the capacitance for the low voltage parts is 100 pF to 200 pF. You won't have to worry about overshoot. It will be filtered out!