How to safely interface a 5v signal to the propeller? [See Post/Reply #104]

13

Comments

  • TransistorToasterTransistorToaster Posts: 149
    edited 2007-03-30 04:17
    There are a couple of chip families out there that built to be 5V tolerant at their inputs plus high speed.
    For example the LCX family:
    www.fairchildsemi.com/ms/MS/MS-513.pdf


    I recall on a breadboard some chips that were made by Pericom. I just googled around and I saw that their LVTC can tolerate 5V also.
    www.pericom.com/faq/faq_family.php?family=1
  • TransistorToasterTransistorToaster Posts: 149
    edited 2007-04-02 18:57
    Hello,
    I'll be trying out the 74lcx245 8 bit bidirectional driver, which is a 3.3V device with 5V tolerant inputs.
  • Mike YoungMike Young Posts: 10
    edited 2007-04-03 09:57
    Folks,

    You may wish to check out Texas Instrument's dual-supply line of bidirectional level translation IC's. These can be used to map the Propellor to any logic standard and are available in bit widths from 1 to 32. Note that these work like a 74xx245 bus driver, so you need to provide a direction input. See:

    http://focus.ti.com/lit/ml/scyb033/scyb033.pdf

    Do not be intimidated by the Ball Grid Array packages discussed in the .pdf; these are available in SSOP.

    V/R
    Mike
  • Bill HenningBill Henning Posts: 6,445
    edited 2007-04-15 07:43
    When I ordered my Propeller Proto boards, I forgot to order a Propeller Plug; however all was not lost as I had a few FTDI USB 2 Serial 5V prototyping boards; and using two 1K resistors (on Rx and Tx, only one is really needed, but I wanted to make sure I would not damage the propeller if I wired Rx/Tx backwards), a 10k resistor, a 10nF cap, and a 2N3904 I made my own butt-ugly Propeller Plug equivalent.

    Worked like a charm the first time I tried it. Mind you, I'd already used the FTDI tool a couple of weeks ago to invert DTR on it.

    Moral of the story:

    interfacing to 5V logic really is as simple as adding 1k resistors in series - thanks Chip!

    I think I'm going to order another 5 proto boards - and a propeller plug.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.mikronauts.com - a new blog about microcontrollers

    Post Edited (Bill Henning) : 4/15/2007 7:49:59 AM GMT
  • DustdemonDustdemon Posts: 6
    edited 2007-04-30 18:55
    I use a chip made by analog devices to seperate between voltage difference in my setup. The chip part number is ADUM1400 and I have great success with it. Theres many versions of this digital isolator family. I purchase this part from Digikey and it is a bit expensive but worth it in the long run I think.

    ADUM1400ARWZ-RLCT-ND
    $5.47

    This is a far cry better than an opto coupler.

    Hope this helps..................................
  • parskoparsko Posts: 501
    edited 2007-06-05 15:06
    www.sparkfun.com/commerce/present.php?p=Sensor-Interfacing

    This was highlighted on MakeZine's website today. I knew this post existed, and said to myself: "Self, too much info is never enough"

    If it is no good, a moderator can delete my post...

    -Parsko
  • deSilvadeSilva Posts: 2,967
    edited 2007-06-16 21:22
    This link might also help clearing things as it contains some graphics
    http://www.sparkfun.com/commerce/present.php?p=Sensor-Interfacing

    Mentionable the absolutely safe interface 3,3 V -> 5 V for the true paranoic, utilizing the pull-up trick.

    Post Edited (deSilva) : 6/17/2007 3:09:34 PM GMT
  • Tom WyckoffTom Wyckoff Posts: 26
    edited 2007-07-07 21:27
    I have some 3.3 <-> 5 volt lever shifter modules from Futurelec, 8 signals each with a jumper for direction. Two of them will give me 8 propeller --> 5 volt logic, and 8 5 volt logic to propeller signals. They're pretty cheap as assembled modules. Should that work and be safe?
  • deSilvadeSilva Posts: 2,967
    edited 2007-07-08 16:36
    I wonder why people keep asking: "Is that safe"? Do they think 5V is something like 110 V ??
    The most common misunderstanding seems to be the opinion voltage can harm a chip. It rarely can nowadays.. Current is the baddy!
    So whenever you have made sure current constraints are considered nearly everything is fine.

    Why "nearly"? Well, note that by a serial resistor you create a low pass filter! Of course there ALWAYS is a low pass filter, by output impedance (some 100 Ohms generally) and input capacitance (some 10 pF generally). So think for yourself!

    BTW: There is always the chance that output is OC rather than TS - always check this, as it will generally simplify the connection of different voltage devices.

    In my opinion integrated level-shifters are mainly marketing devices smile.gif
  • edlikestoboogieedlikestoboogie Posts: 71
    edited 2007-07-14 22:46
    I am working on a project that will require a propeller to control a lot of relays.. like 20 or so.. Since I don't want to use up all the props I/O pins.. I decided to use an SX micron as a helper.. I want to communicate between the two chips using the standard shiftout and shiftin routines provided with SX/B.. Since the SX is a 5V device.. and the prop is 3.3v.. what extra resistors and other hardware need to be between the two chips??
  • Mike GreenMike Green Posts: 23,024
    edited 2007-07-14 22:56
    A 1K series resistor would be more than adequate. You're trying to avoid damage to either chip in one situation and to the Propeller in another:

    1) If you make a mistake in programming such that both the Propeller and the SX are set to output mode, say with the Propeller to output high and the SX to output low, you will have a short circuit between the 3.3V supply and ground. The 1K resistor will limit that current to 3.3ma.

    2) If the Propeller is set to output low and the SX is set to output high, you will have a short circuit between the 5V supply and ground. The 1K resistor will limit that current to 5ma

    3) If the Propeller is set to input mode or output high mode and the SX supplies output high, the protective diodes on the Propeller will conduct from 5V to ground to attempt to protect the Propeller from the excessive voltage. The 1K resistor will limit that current to 5ma.

    In all the above cases, the 1K resistor will limit the fault current to 5ma or less which both the Propeller and the SX are capable of handling indefinitely without damage.
  • mahjonggmahjongg Posts: 141
    edited 2007-07-14 23:13
    I am not familiar with the SX micron, but if you only connect propellor pins to inputs of the SX micron, (you only want to control outputs, not read out status or something) then all you have to do is to check the data sheet of the SX micron to see if it's input logic high voltages are below 3,3 Volt (or actually a little lower, say 3 Volt, so you have some margin).
    If they are, then you are fine. If not some 4K7 pull-ups to +5V, to slightly raise the logic high output voltage of the propeller, might do the trick.
    Some, but not all +5V logic does accept logic high signals above 3 Volt, so in many cases you can directly interface 3,3 Volt logic outputs to %V logic inputs, check your data sheet before you assume there is a problem.
    If the logic high input voltages of the inputs of the device you are controlling are really high, say above 4 volt, then you need a buffer of some kind to translate the logic levels.

    Mahjongg
  • edlikestoboogieedlikestoboogie Posts: 71
    edited 2007-07-15 00:01
    Hey Mike,

    Does the 1K resistor work with communication both ways??
  • RaymanRayman Posts: 11,696
    edited 2007-07-26 16:42
    If it's just two lines, you can use the PCA9509D i2c bus repeater to easily go from 5· to 3.3 V.· It's only good up to 400 kHz though.
  • KnutKnut Posts: 2
    edited 2007-08-06 09:02
    Hi!

    I'm interfacing with a serial display driver which requires a minimum of 3.5V for logic high. I only need a 3-wire (SPI)·one-way interface to the driver, so I'm thinking of using a 74HCT7007 hex buffer for the job of shifting from 3.3V to 5V (for instance Toshiba's TC74HCT7007AP - http://www.semicon.toshiba.co.jp/docs/datasheet/en/LogicIC/TC74HCT7007AF_TC74HCT7007AP_en_datasheet_061109.pdf)

    Two questions;
    Any thoughts on this beeing a bad idea? smile.gif
    Local availability of the 74HCT7007 may be a problem - any thoughts on equivalents (except the obvious 74xx07s)?

    Have also looked at the Philips HEF4104 (http://www.nxp.com/acrobat/datasheets/HEF4104B_CNV_3.pdf), but since I don't need a bi-directional interface or the 3-state features it seems the 7007 is a better choice (and, unless I would hardwire the enable-output pin on the 4104,·the only·transparent solutions requiring no code of the two).

    Am I missing something here or am I on the right track? smile.gif
    I know I can whack up level shifting using a couple of transistors and some resistors, but for me, an IC doing the job (preferably transparent) is the easier and preferred solution. smile.gif

    Best regards,
    Knut
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-10 04:18
    (1) I personally would try to connect the display directly first, though slightly out of spec.
    (2) Literally ANY HC chip will do the job; when you take an inverting one, you have just to adapt the software. There is no need for an HCT version
  • KnutKnut Posts: 2
    edited 2007-08-10 10:55
    I tried going directly at first, but it's not working :-( That's why I'm looking for solutions.
    I'll have a run through some catalogs and see if I can find a nicely available HC variant

    Thanks!

    Knut
  • javerjaver Posts: 6
    edited 2007-08-20 11:58
    Hi,
    You can try this:
    ·
                     +---- C2 ---+                        R1 = 3K3
                     |           |                        R2 = 2K or 2K2
    3.3V I/O ----+---+---- R2 ---+------- 5V I/O          C1 = 330 pF
    (Propeller)  |   |                    (HCT)           C2 = 220 pF
                 |   |
                 C1  R1
                 |   |
                 |   |
                GND GND
    

    C1 and C2 are needed only for very fast signals,·when 3.3V I/O is input or bidirectional pin.
    For 3.3V I/O output only, C1 is not needed.
    5V I/O is assumed to be HCT (minimum High level is about 2V).
    Capacitors are used only for fast transitions. For 3.3V input, C2
    Output current from 3.3V pin is be about 1mA (or max. 2.5 mA if 5V I/O is at GND level).

    Best Regards,
    Javer
    461 x 396 - 29K
  • Chicago MikeChicago Mike Posts: 88
    edited 2007-12-26 03:55
    I realize most of this conversation has been pertaining to level shifting in i2c applications. In the end it seems level shifters are real cute, but a 1K resistor is the down and dirty, always works solution for i2c 5v<-->3V problem. Just to expand this out of the small deviation of a 2 voltage drop. What about the case of say sending a 24V signal on a pin. What would stop you from just throwing a 1K1 resistor in series with this supply. In applications like this I've always been told to use a signal relay of some type for isolation, but I really can't come up with any good reason to waist the expense?. You'll get a current of 20mA @ 2V in this case, which is well within the tolerance. Any comments?
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-26 04:40
    Nearly all CMOS inputs are resistant upto 2kV, some to even higher values. This is necessary as this is the voltage you carry in your little finger on a dry day.

    To get rid of that voltage each input has so called ESD ("electro static discharge") diodes to Vcc and from Vss.
    The diagram has been posted many times - twice by me, I think...

    Now to your question: All voltage below -0.6 V and beyond +3.9 V causes a flow of current through those diodes. Their rating is a little bit unclear, but 1mA is the utter limit.


    So it is not a matter of voltage: The safest way to fry a 3V-chip is to connect one input to a 4.5V battery...

    So what you have to do when connecting X Volts is add a current limiting resistor of (X-3.9)V/1mA Ohms
    24V need >20k
    Thats all.

    Post Edited (deSilva) : 12/26/2007 5:02:29 AM GMT
  • Peter JakackiPeter Jakacki Posts: 9,956
    edited 2007-12-26 05:39
    One often ignored aspect of current limiting higher voltage inputs into the propeller is that the current has to go somewhere. That somewhere is through the substrate diode from the pin to the propellers VDD supply and from there through whatever is connected to VDD. Not a problem you say as you have a regulated 3.3V supply ...... wrong! Regulators (for all practical purposes) only ever source current, they do not sink which means that if you pump a few milliamps through the pins then the VDD can be raised up to the breakdown voltage of the propeller. So don't be surprised to measure 3.9V at VDD because of this effect. This can also cause havoc with brownout detect and resetting as well, especially as the prop draws very little current during reset.

    So if you are going to use current limiting for inputs then use as high a value as possible, yet not too high that the signal is slowed down too much to be used (due to RC charging). For a slow input like a switch there is no problem using 100K but for fast inputs even 1K might not be low enough in which case you should think about clamping the pin with a zener and/or even loading the 3.3V supply with a low value resistor.

    Driving 5V logic from Propeller:
    Someone mentioned that you could just hookup a pullup resistor to +5V on the pin but this will not give you +5V as the pin will start breaking-down at around 3.6V and conduct current. You can only use this technique with +5V tolerant I/O pins which some chips have, but not the propeller. 74HC or better still 74HCT devices (Vih=2V) are happy to buffer the signal and output a real +5V but it is just as likely that the +5V logic will work without the buffer anyway.

    Bi-directional 3-5V interfaces are problematic and although there are specialized solutions for this I try to work around having to do level translation by perhaps rethinking the design. This is becoming less and less of a problem these days as more and more devices/modules are designed for lower voltages.

    *Peter*
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-26 09:54
    Peter's first remark lets me add this, also a little bit off-topic:

    (a) It has been observed many times that an RS232 adapter, powered by an external source (e.g. PC) inputs a higher voltage to the receive pin. This does no harm as it is current limited. However when the main circuit is unpowered, this low current - induced into the Vdd rail - will suffice to ressurrect parts of it, bring LEDs to glow etc..

    (b) Vintage regulators and maybe also some new ones do not like their output voltage to exceed their input voltage. When the mains are disconnected (Vin=0) this can happen in two cases:
    - Higher voltage input to any processor input. This can be most dangerious as this can last for hours or even days!
    - High caps in the 3Volts network, discharging slowly (seconds or minutes), not quite so dramatic
    This is why good designs generally have an anti-parallel diode (1N4001) across the regulator.

    Post Edited (deSilva) : 12/26/2007 4:03:49 PM GMT
  • Michael07Michael07 Posts: 12
    edited 2008-01-13 16:19
    I have not seen this link in this thread:
    http://www.iearobotics.com/personal/ricardo/proyectos/skylamp/docs/ft232r.pdf

    Michael

    I am not always right!
  • FineFine Posts: 1
    edited 2008-02-04 16:21
    Typically when I need to transision from on voltage to anyother I almost always use an open collector which could be a transistor for single bit transision or something like a 74ALS621 ref: http://www.ortodoxism.ro/datasheets/nationalsemiconductor/DS006231.PDF

    Simply add a resistor to the output pulling the signal up to 3.3V or 5.0 volts depending on which way you are heading. Its the perfect answer.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 22,863
    edited 2008-02-28 23:18
    In order to couple two related threads, here's a link to a discussion on interfacing a 5V I2C device to the Propeller:

    ····http://forums.parallax.com/showthread.php?p=712167

    -Phil
  • VIRANDVIRAND Posts: 655
    edited 2008-02-28 23:58
    The previously mentioned optocoupler solution to the 5V interface being slow brings up a problem I ran into...
    How can I send video output from the propeller and/or a camera over fiber-optic cables?
    Light would have great electrical isolation.
    The failure to do so with any optoelectronics I could find seems to debunk and mythify the
    otherwise obvious possibility and claim of fiber-optics having vastly greater bandwidth than coaxial cable!
    (Test Results, only one, useless, channel of blurry gray image optically received.)

    Light should also be simpler than alternatively using the RF broadcast video mode at the receiving end, if it's not a TV.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 22,863
    edited 2008-02-29 01:01
    Fiber optics is a little OT. Perhaps a new thread would be better? (Short answer: high-speed fiber optic receivers use PIN photodiodes, not phototransistors.)

    -Phil

    Post Edited (Phil Pilgrim (PhiPi)) : 2/29/2008 7:02:14 PM GMT
  • tdtd Posts: 8
    edited 2008-07-06 14:11
    I know this topic has been discussed alot about the 5v and 3.3v. I am new to designing with the propeller chip and need to work with a whole series of TTL chips that are all 5v. This includes some I2C chips as well as flip flops etc... I know there are suggestions for using 1k resistors but did not want to crowd the circuits with unnecessary components. Should the general rule be to place a 1k resistor between all P0-P31 pins and their corresponding TTL chips etc?

    I also saw the circuit for the SDA/SCL pullup but this looked quite involved to get the Propeller to work with a 5V say DS1307 chip?

    Any help would be greatly appreciated...

    A new guy at this stuff!

    Tony
    blush.gif
  • Mike GreenMike Green Posts: 23,024
    edited 2008-07-06 14:27
    You really need to read this whole thread. I know that it's not "digested" and summarized. There is a lot of information here. Using 1K resistors is one solution that works sometimes. It depends on your circumstances.
  • RaymanRayman Posts: 11,696
    edited 2008-07-06 15:50
    Note that I2C is a special case and you can interface to the DS1307 and some other I2C chips with no resistors at all. This is because I2C devices only pull-down on the signal lines. As long as they recognize 3.3 V as a logic high, as the DS1307 happens to do, it will work. But unfortunately, there are plenty of other I2C chips that do not recognize the 3.3V as logic high...
Sign In or Register to comment.