Transistor level shifting

Discussion in 'General Electronics Chat' started by Druzyek, Feb 17, 2015.

  1. Druzyek

    Thread Starter New Member

    May 19, 2013
    21
    0
    I'm working on a programmer that programs 5v EEPROMs with a 3.3v microcontroller. I'm using a PN2222A transistor with a 10k pull up to 5v and a 10k resistor on the base for level shifting when I read from a shift register. This limits me to about 400kHz. I know if I used smaller resistors it might go faster but how low could I go? I would hate to damage any of the chips involved by drawing excessive current. Is there a rule of thumb I could go by? Does anyone know how fast I could expect to switch with a transistor like this?
     
  2. WBahn

    Moderator

    Mar 31, 2012
    17,732
    4,789
    You can only so low as to avoid drawing excessive current from any of the chips. You are spot on the money. So the key constraint -- which we can't answer because we don't have the information -- is how much current your microcontroller and/or transistors can source or sink.
     
  3. crutschow

    Expert

    Mar 14, 2008
    13,001
    3,229
    The 2N2222A is not a fast switching transistor as it has a significant delay coming out of saturation (about 400ns).
    My simulation shows that it barely works at 400kHz as you observed.

    A 2N2369 is a faster device with much less saturation delay (≈15ns).
    And that with a 10kΩ base resistor from a 3.3V source allows a 2kΩ collector resistor to further increase the speed.
    My simulation shows that should be good for up to a least 1MHz.

    If you reduce the collector resistor 1k and the base resistor to 5k with a 2N2369 you should be good to at least 2MHz.

    For even higher frequencies you can use a 74HCT device (such as a 74HCT04 inverter) to convert from 3.3V to 5V since they operate on 5V for a 5V output swing but have a 2Vmin logic high threshold. That should be good to 10MHz or better.
     
  4. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,530
    1,248
    When translating from a 3.3V device output to a 5.0V device input, you might not need anything at all. The standard 5.0V logic high level is anything above 2.4V, and most 3.3V devices meet this voltage level with ease. The concern is the input stage of the EEPROM. A true TTL device actually sources current out of its input pins that can overvoltage the output of whatever is driving it, the main reason for level translators. If your EEPROM does not do this, or if its input current is so low that it can be loaded down to under 3.3V with something like a 10K resistor, then you're good to go without a translation (and inversion!) stage. Draw up a schematic for us showing the relevant components, and be sure to use reference designators to aid the discussion.

    ak
     
  5. Druzyek

    Thread Starter New Member

    May 19, 2013
    21
    0
    Thanks! This is just what I was hoping to figure out. Do you know of a comparison of transistors by saturdation delay? I couldn't find one on Google and was hoping to find a few alternatives in case my local shop doesn't have 2N2369s.

    I made a mistake in my first post and should have said that I am using a 3.3v pullup. I did not know that inputs could overvoltage what is driving them. How would I go about figuring out if this is happening? Here is a schematic. (Sorry, no Eagle for Chromebooks :/ )

    EDIT: I was thinking, does HC not suffer from the same danger of overvoltage on inputs? It might be a simple matter to run the signals through an HC chip running at 5v.
     
    Last edited: Feb 18, 2015
  6. crutschow

    Expert

    Mar 14, 2008
    13,001
    3,229
    Here are some that have a low saturation delay based upon there simulation in LTspice:
    2N5089
    BC546B
    BC547
    2N5210
    2N5769
    2N3391A
    A Google search for fast switching transistors may find you some others.

    One thing that will significantly reduce the saturation time of any transistor is to add a small capacitor (≈50-100pF) across the base resistor. That helps pull the excess charge from the base to speed up the turn-off.

    I don't know what you mean by inputs overdriving the driver. That's not a problem.
    It's only the outputs overdriving the inputs that's a problem.
     
  7. Druzyek

    Thread Starter New Member

    May 19, 2013
    21
    0
    Awesome. I'm sure I can find one of those.

    So one side of the capacitor directly to the base and the other to Vcc?

    I meant that in response to AnalogKid's post, although I might have misunderstood:
     
  8. crutschow

    Expert

    Mar 14, 2008
    13,001
    3,229
    No. I stated it needs to be across (in parallel with) the base resistor.

    AK's post refers to driving a TTL bipolar component that's at a higher voltage then the driver.
    There's no reason for you to use an old TTL device.
    The CMOS devices (HC, HCT, etc.) don't have that problem.
     
  9. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,530
    1,248
    I mentioned TTL as a caution that some input stages actually are outputs, and that a little investigation might save an increase in circuit complexity. Also, many 3.3V devices have 5V-compliant inputs and outputs. For example, this is a common feature in CPLD's.

    ak
     
  10. Druzyek

    Thread Starter New Member

    May 19, 2013
    21
    0
    Thanks for your replies guys. We have old EEPROMs and even EPROMs at our hackerspace and I can't be sure a TTL chip will never be stuck in there. I have some 74HC244s at home and I could put one in between the microcontroller outputs and EEPROM inputs. If I run it at 5v, drive its input with my 3.3v microcontroller, and drive the EEPROM with its outputs I think I will be fine no matter what, right?
     
Loading...