5V TTL to 3.3VCMOS interface

Discussion in 'General Electronics Chat' started by jkj123, Dec 15, 2008.

  1. jkj123

    Thread Starter Member

    Nov 5, 2008
    22
    0
    Hi,
    I am using a microcontroller working on 5V, which is directly connected to a sensor working on 3.3v for data communication(recieve and transmit at 38.kkbps). Even though the sensor is 5V tolerant, I ought to provide a protection circuitry because the sensor fails randomly. May be the Vcc goes to 5.5V.
    Can somebody give an idea about how to connect a mixed 3.3v and 5V different systems? Is there any IC available for level shifting from 5V to 3.3V?

    Thanks
    Jaison
     
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
  3. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    See the attached for one way to convert the signal levels.

    If you don't mind the logic being inverted, you could just use a single transistor (ie: Q1, R1, R2 for a one-way conversion)
     
    bbiandov likes this.
  4. jkj123

    Thread Starter Member

    Nov 5, 2008
    22
    0
    i already have a 3.3V regulator for sensor.
    But I connect Rx and Tx lines (5V) directly to sensor Rx and Tx lines (3.3V).
    I need the interface here between these two to translate the level from 5v to 3.3v and vice versa.
    the transistor circuit is good. but it wont sure my data speed requirement of 38400bps.
    Please give me a better solution, i think may be its available in IC form. But i didnt get it from internet.

    Thanks
     
  5. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    4
    Could you post the sensort part #?
     
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I re-ran the simulation using 100kHz. There's about a 90nS delay in turn-on, and about a 300nS delay in cutoff. That's really not too bad.
    Why don't you try the transistor solution first? It's simple and very inexpensive. The delays I mentioned are less than 2% of your bitrate frequency.

    Make absolutely certain you use 100nF (0.1uF) bypass capacitors across the supply to the emitters.

    The problems you're experiencing may be a lack of bypass caps on your IC's, or poor signal routing.
     
  7. jkj123

    Thread Starter Member

    Nov 5, 2008
    22
    0
    Part No. is UF_SFM3020OP finger print sensor.
    Thank you so much SgtWookie. OK the transistor may do it. I will have to try it.
    Do we need any low capacitance across base and GND.
    Can you tell me which transistor I should use ? Normal BC547 will do?

    Thanks
     
  8. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    4
    Maybe you should try to pinpoint the cause of the failure accurately first. The H_RXD input is 5V tolerant and most microcontroller (which one are you using?) will operate correctly with 3.3V input level happily (check the datasheet carefully). For example, I had a project using a PIC16F running at 5V that talks to another 3.3V chip without a level converter. The 16F will interpret anything above 2V as logic high at 5V supply, unless the pin is a schmitt trigger.

    Make sure you have enough decoupling caps, good regulation for both the 5V and 3.3V supplies and proper ground arrangement.
     
    Last edited: Dec 16, 2008
  9. davebee

    Well-Known Member

    Oct 22, 2008
    539
    46
    Some 3.3 volt parts will be destroyed at 5 volts, so I would suggest reading the spec sheet very carefully before just connecting your part to 5 volts.

    Some 3.3 volt parts have internal overvoltage protection diodes, so all you need is a series resistor of maybe 1K to 2.2K going from the 5V out to the 3.3V in to limit the current to what the diodes can handle. But don't do this unless the part is specified that it allows overvoltage up to maybe a few ma of current.

    What I've done on a few level-conversion projects is to use a 74HCT14 Schmidt trigger IC.

    Since the HCT14 triggers at about 2.5 volts, it will do the 3.3 to 5 volt conversion
    directly - connect your 3.3 volt logic to an input and take 5V logic from that gate's output. You can either accept the inverted logic of using one gate, or you could use a second gate of the HCT14 to restore the original logic.

    For 5 volt TTL to 3.3 volt, you could use another gate of the HCT14 to convert the
    TTL to CMOS levels, then send the signal through a resistor divider of 2.2K to 3.3K
    to ground. Tap between the resistors and you'll get 3.3 volts. Again, you can accept
    inverted logic of a single gate or use a second gate for the original logic.

    This may not be quite as fast as discrete transistors but should be plenty fast enough for serial communication, and it's easier to work with a smaller parts count.

    TTL doesn't always pull its logic high up to 5V, but if your 5V part does, then you
    could use a resistor divider as above to directly convert 5V out to 3.3V without using the logic gate at all.
     
  10. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    You can use the BC547 but you can use also a buffer or NOT gate with open collector output.
     
  11. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Yes, a BC547 will work.
     
  12. jkj123

    Thread Starter Member

    Nov 5, 2008
    22
    0
    Thank you all for your valuable suggestions.

    The H_RXD input is 5V tolerant and most microcontroller (which one are you using?)
    I am using philips 89c669 microcontroller.
    According to n9352527's comments I think I can use a 3.3V zener across 5V tolerant pin and micocontroller.

    davebee has a good solution and I also found it from somewhere to use a resistor to limit current flow.

    Anyway for your information i am attaching a circuit here which now i am testing. Here instead of TVS I am using a 5.1V zener and schottky diode is 1n5819, 1.2K resistor and 6uH ferrite bead.
    Can I use 3.3V zener so that i would get a clear 3.3v across 5V tolerant pin?


    Thanks and Regards
     
  13. neverlog

    New Member

    Dec 4, 2008
    9
    0
    What about using MC74VHC1G50DFT1 ? Will this help to reduce tedious components?
     
  14. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Not unless you use a resistor to limit the current through the Zener.
    If you don't, you'll stress your uC, and the Zener too.
    The type of Zener you select will also be important - you can't just choose any old Zener. Without sufficient current flow through it, the regulation will be abysmal.

    A simple resistor, or a resistive divider network might work just fine for the 5v to 3.3v portion. Not so for the other way around.

    No, and you don't want an inductor in the path. That will skew your rise/fall times like you wouldn't believe, along with having high EMF spikes when the current switches on/off :eek:
     
  15. jkj123

    Thread Starter Member

    Nov 5, 2008
    22
    0
    Hi SgtWookie,

    The inductor is not simply an inductor, its a ferrite bead of 6uH.
    It is a combination of resistance and inductance. So the resistor requirement for zener will be taken care of, I think, right?

    Anyway my data communiaction works fine at 38.4kbps.
    pls comment.
    thanks
     
  16. John Luciani

    Active Member

    Apr 3, 2007
    477
    0
    Use a SN74AHC14N to do the level translation. Power the AHC14 off of the 3.3V
    supply. The AHC14 has 5V tolerant inputs and the outputs should be compatible
    with your 5V system. Double-check the output levels.

    I have a schematic example (with embedded datasheet) at http://tinyurl.com/5rfmrz
    Click on the application hint titled "FTDI Level Translator" in the sidebar.

    (* jcl *)
     
  17. neverlog

    New Member

    Dec 4, 2008
    9
    0
    Hi SgtWookie,

    is the solution you provided also suitable for my system?

    I am connecting a bluetooth device (2.4GHz) to a RFID module (13.56Mhz)

    Thank you.

    rgds,

    Lam
     
  18. neverlog

    New Member

    Dec 4, 2008
    9
    0
    Hi SgtWookie,

    I am new to electronics, the bypass capacitors you mentioned, is it connect the capacitor positive polarity to emitter, and negative to GND?

    So I should use electrolytic capacitor for this case?

    Awaiting your feedback.

    Thank you.
     
  19. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I don't know anything about bluetooth devices.
     
  20. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Use ceramic or tantalum caps. Electrolytic capacitors have too many parasitics for high frequency transient suppression.
     
    bbiandov likes this.
Loading...