2
\$\begingroup\$

I'm fairly new to TTL logic. I have a PWM output 0-3.3V that I need to convert to a TTL 5V logic as the sensor only accepts a TTL signal.

Is there an IC that would do this or a circuit I can build?

\$\endgroup\$
4
  • \$\begingroup\$ Look up 'logic level shifter' \$\endgroup\$ Commented Jul 12, 2021 at 12:48
  • \$\begingroup\$ One simple way would be a single transistor level shifter to 5V and then invert the PWM logic \$\endgroup\$
    – ChrisD91
    Commented Jul 12, 2021 at 12:48
  • 2
    \$\begingroup\$ What sensor it is and what are the input parameters for it? Since you say it has TTL input, it would already imply it does not need 5V input level as 3.3V is enough fot a TTL input, so edit the sensor to post just to be sure that whether you can connect it directly or need level translation. \$\endgroup\$
    – Justme
    Commented Jul 12, 2021 at 13:17
  • \$\begingroup\$ Which sensor is it? Generally a PWM is used to simulate an analog voltage between a high and a low. It CAN be used for switching on and off, but generally a sensor gets fed Vcc and a ground and then you use the output from it as needed. \$\endgroup\$
    – Kate Moon
    Commented Jul 13, 2021 at 1:03

2 Answers 2

6
\$\begingroup\$

Check the specification of your 'TTL' input. Two items to look for:

  • Is it truly 'TTL' or is it 'CMOS' 5V?
  • Does it have a pull-up to 5V? (measure with a voltmeter to check.)

If it is truly 5V TTL, it will have an input-high specification of just 2.0V. If there's no pull-up to 5V you're in luck: your 0-3.3V signal will just plug and play, without translation.

If however the input is 5V 'CMOS', it will have an input-high level of about 2/3 Vcc, or 3.3V. There's no margin left so your 3.3V swing input won't work. In this case you'll need a level translator.

In either case, if your 5V input has a pull up, even if it accepts 'TTL' level, there will be a leak path between the pull-up and your 3.3V supply. You'll need a translator to break the leak path.

The no-brainer way: use a buffer IC that accepts the smaller swing and makes a bigger one.

  • 74HCT125, powered by 5V. Accepts 3.3V logic, makes 5V push-pull swing.
  • 74LVC07 open-drain, powered by 3.3V and pulled up with 5V on the receiving end. Makes 5V swing with pull-up.

There's other solutions but I think these will be the most straightforward and robust.

\$\endgroup\$
2
  • \$\begingroup\$ "You'll need a translator to break the leak path." - or put a resistor to ground to pull the voltage down to 3.3V. \$\endgroup\$ Commented Jul 12, 2021 at 20:51
  • 1
    \$\begingroup\$ That's provided you know the pull-up value, if it's even a resistor at all. Better to just stick a buffer in and be done with it. \$\endgroup\$ Commented Jul 12, 2021 at 21:03
3
\$\begingroup\$

I have a PWM output 0-3.3V and I need to convert it to a TTL 5V logic

Almost certainly your 3.3 volt signal will be just fine connected to TTL. The TTL lower voltage threshold for a logic 1 signal is around 2 volts and, the upper voltage threshold for logic 0 is about 0.8 volts.

Hence if your input signal goes from 0.5 volts to 2.5 volts (there or thereabouts) it will meet TTL input levels with some small clearance. Clearly, a 3.3 volt level and something close to 0 volts won't have a problem.

enter image description here

\$\endgroup\$
3
  • \$\begingroup\$ Hi Andy, thank you for the above explanation. That makes sense thank you. Just to give me insight in what I'm doing the PWM signal is a speed signal going into a sensor that accepts TTL. If I need the 5V maximum acceptable voltage, can I use something like SN74AC00N as the sift register? \$\endgroup\$
    – user290842
    Commented Jul 12, 2021 at 13:11
  • \$\begingroup\$ No, an AC family chip would be wrong type, it is not guaranteed to work. \$\endgroup\$
    – Justme
    Commented Jul 12, 2021 at 13:49
  • \$\begingroup\$ @user290842 I'm not sure you are taking on-board what I said - you only need to have a logic signal that exceeds TTL specs by a clear margin for this to work. Something that will accept TTL levels requires a high level of 2 volts or above and, a low level of 0.8 volts or below (as per the left side of the diagram in my answer). On the RH side is a TTL driver output that produces a minimum of 2.7 volts for logic 1 and a maximum of 0.4 volts for logic 0 - does your output device exceed those limits is what you need to ask yourself. \$\endgroup\$
    – Andy aka
    Commented Jul 12, 2021 at 13:54

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