Shop OBEX P1 Docs P2 Docs Learn Events
Input clamping diode 5v to 3.3 volt: Max and Min resistors? — Parallax Forums

Input clamping diode 5v to 3.3 volt: Max and Min resistors?

prof_brainoprof_braino Posts: 4,313
edited 2013-06-21 19:13 in Propeller 1
This question is an off shoot of this http://forums.parallax.com/showthread.php/148489-SR04-5-volt-to-3.3-volt

The question is: What are the max and min values for a resistor from a 5 volt sensor to a 3.3volt prop input pin?
A) Minimum: Below this value, the prop pin's clamping diode risks damage.
B) Maximum: Above this value the signal won't get through.

I used 330 ohm. I think I was supposed to use 3300 ohm, but now that doesn't work. I want to figure out if the diode is burned or what.

As stated in the other thread, a voltage divider using 1.7 k ohms and 3.3 k ohms does work on that pin.

So, I want to answer: Don't go below this value, and don't go above this value.

Thanks!

-ANSWERS-

Recommended: At least 4.6k, the official value from AN#10

Easy to find and still works: 10K

Minimum:
2.2k is the absolute minimum, which drives the input at absolute max, so is risky.
3.3k is the minimum SAFE (calculated by various unofficial parties) resistor value, and its easier to find

Maximum: Up to the mega ohm range. The higher values will affect the max frequency that can get thru, dues to the RC time constant from the capacitance of the input (whatever that happens to be). So there is no strict upper limit, it depends on the frequency and the sensor, but could be in mega ohm or tens of mega ohms before the signal stops getting through.

EDIT from Sandy-
Parallax appnote (#10) "Low-cost Bidirectional Mixed-voltage Interfacing" - interfacing 5V signals to the Prop using a resistor.

They calculate 4.6k as the minimum resistor value for 5 volt signals.
100k resistors on 5V inputs from operator buttons. The frequencies aren't very high...

Edit from Phil -
How can we test if the protection diode is damaged?
Apply 5V through a 3.3K resistor and measure the voltage on the pin. It should be around 3.9V if the diode is intact and functioning properly.

Comments

  • whickerwhicker Posts: 749
    edited 2013-06-13 12:30
    I think the answer is more about current...


    You have a voltage source of 5 volts with an (undefined) source resistance R1. You connect it through R2 to an input pin that has (varying) resistance R3, and want to know R2 minimum and maximum, exactly.

    Because it's current that will kill the diode, you have the voltage (5V), but need the total resistance (R1 plus R2 plus input pin resistance R3). The problem is that R1 is hard to define (it's not even a set number if it's coming from a transistor driver circuit, it's usually an equation that depends on the resistance it's encountering). In other words R1 could be anything, depending on what it exactly is.

    So we don't know R1, and you want to know definitively what R2 should be... no wonder you're experiencing frustration.
    I think the answers are going to always be "if you use this, then R2 should be this" type answers. That's about the best that can be done, unfortunately.


    Person A has sensor F and says that value R2 "totally works and won't break anything".
    Then Person B has sensor G, and uses value R2, and says "that didn't work! That actually broke something!"
    Finally, Person C has sensor H and says that value R2 is not enough, "The signal is too weak. It needs to be smaller!"

    Who's right?
    Well, they all are.
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-06-13 13:13
    I have not seen/found your input circuit. Without knowing this, there are a few solutions. 1. Use a voltage divider. 2. Use a series resistor and place a 3v3 or 3v6 zener at the input pin to ground. 3. Use a buffer circuit e.g. 74LVCxx.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-06-13 14:09
    A series resistor should be at least 2.2K, preferably 3.3K, to limit current through the protection diodes to 0.5mA or less. You can use much higher values than that -- up to the megohm range even -- and the signal will stilll get through, but your frequency response will be limited by the RC time constant formed by the series resistor and the pin input capacitance.

    -Phil
  • JonnyMacJonnyMac Posts: 9,107
    edited 2013-06-13 14:39
    By my calculation the minimum should be 2.8K, but 3.3K is a standard value and easier to get. As I reminded a friend: use 3.3K to protect the 3.3v inputs from 5v circuits. Be mindful of Phil's admonition vis-a-vis input frequency.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-06-13 16:26
    I added the protection diode's forward voltage to the 3.3V before subtracting from 5V to arrive at a 1.1V difference and the 2.2K value. But that really is cutting it close, since the 0.5mA is an abs max rating.

    -Phil
  • prof_brainoprof_braino Posts: 4,313
    edited 2013-06-13 18:00
    Thanks all! Updated post 1 with the info you provided.

    So the protection diode forward voltage is 5v-1.1- 3.3 = 0.6v ?

    How can we test if the protection diode is damaged?

    In my case the SR04 on the pin that had 330 ohm resistor does not function after a long reading using 3.3k resistor. Using a 1.7k and 3.3k ohm voltage divider, the same prop pin with the same SR04 works just fine. Is this enough to tell me that the prop pin protection diode is damaged, or do I still need to keep looking?

    Also, does the protection diode cover a single pin, or a group of pins? On the Quickstart, the input was on pin 17, and I saw pin 18 flashing when nothing was connected. So I figure at least pins 17 and 18 are ruined. Could the other pins be undamaged?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-06-13 18:21
    So the protection diode forward voltage is 5v-1.1- 3.3 = 0.6v ?
    That's my assumption.
    How can we test if the protection diode is damaged?
    Apply 5V through a 3.3K resistor and measure the voltage on the pin. It should be around 3.9V if the diode is intact and functioning properly.

    -Phil
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2013-06-13 18:38
    I've been using 3K3 series resistors, but with all the mention on threads like this I thought I would check out the 74LVC chips. I suspect they do make things much easier. Run the chip from a 3V3 supply and it can handle 5V inputs as it is designed for that, and with octal buffers like 244 or 245 there are 8 buffers for something like 30c. Yesterday I did my first PCB design using 74LVC chips. It used the same amount of PCB space as I had been using DIP resistor packages so it is one DIP vs another, and cost is about the same too. If I ever had to justify my design to a real engineer I think I'd feel more comfortable with the LVC chip.

    And if one used voltage dividers and there were more than maybe 4, the PCB real estate might be smaller with LVC packages.
  • kwinnkwinn Posts: 8,697
    edited 2013-06-13 19:33
    Lets not forget that 5V logic is rated for operation at +5V +- 5% so the power supply could provide as much as +5.25V. If the 3.3V supply is also +-5% the voltage could be as low as 3.135V, for a differential of 2.115V.

    If the voltage drop across the protection diode is 0.6V the minimum safe resistance value for this worst case scenario would be (2.115 – 0.6) / 0.0005 = 3.03K.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-06-13 19:35
    Oh, those pesky things called tolerances! :)

    -Phil
  • ManAtWorkManAtWork Posts: 2,176
    edited 2013-06-14 07:43
    Also, does the protection diode cover a single pin, or a group of pins? On the Quickstart, the input was on pin 17, and I saw pin 18 flashing when nothing was connected. So I figure at least pins 17 and 18 are ruined. Could the other pins be undamaged?

    I don't think that any diode is damaged at all. There are two thresholds that should be considered. The limit for safe operation should be something like 0.5 or 1mA. (I don't now where the 0.5mA value comes from, IMHO the data sheet says nothing about that). The problem you get when exceeding this value is not damage to the diode but influence on other pins and eventually latch up. The protection diode is part of a parasitic bipolar transistor that injects current into the substrate. This will disturb other inputs and may cause latch up in extreme cases.

    I know little about the CMOS process of the propeller but, for example, the data sheets of 74HCxx parts usually state +/- 20mA absolute maximum clamping current. However, proper functioning of the device is not guaranteed at that level. It only says, don't exceed or you risk damage.
  • edited 2013-06-14 10:04
    Parallax published an application note (#10) "Low-cost Bidirectional Mixed-voltage Interfacing" that covers interfacing 5V signals to the Prop using a resistor. Go to the Parallax Semiconductor site and click on the Application Notes tab at the top. There are 17 application notes covering different topics. Some good information there.

    They calculate 4.6k as the minimum resistor value for 5 volt signals. I use 4.7k resistors on all lines going to/from an ADC including the clock line which is at 400 kHz. The ADC produces reliable readings so I'm thinking 4.7k is an appropriate value.

    I haven't had any problems using 100k resistors on 5V inputs from operator buttons. The frequencies aren't very high and it makes life easy for the protection diodes.

    Sandy
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-06-14 10:11
    ManAtWork wrote:
    I don't now where the 0.5mA value comes from, IMHO the data sheet says nothing about that
    You must've overlooked it:

    attachment.php?attachmentid=102252&d=1371229843

    -Phil
    842 x 452 - 53K
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2013-06-14 12:15
    I'd tested the forward characteristics of a + side substrate diode, attached as a curve taken out to 14mA forward current. Early on, Chip said he designed in beefy substrate diodes, and that gives me confidence (as in all Chip's designs) that he thought it through and that the diodes can absorb some energy. The possible effects are those that ManAtWork listed, and the degrading effects are time and power related, latchup related, and performance related. It is considered bad practice to forward bias the substrate diodes at any current level, although it is certainly a useful hack to do so. I believe the 0.5mA is a good practical limit for the hack, in accordance with industry standards, but other means of level shifting that avoid the issue should be considered for professional designs. Note that the forward voltage is indeed close to 0.6V at 0.5mA forward current. There is the usual exponential diode curve.
    Prop_substrate_diode_curve.png
    448 x 539 - 37K
  • prof_brainoprof_braino Posts: 4,313
    edited 2013-06-20 11:39
    Thanks All!

    I've updated the first post with my results. I still need to do the test Phil suggested.
  • prof_brainoprof_braino Posts: 4,313
    edited 2013-06-20 11:53
    kwinn wrote: »
    Lets not forget that 5V logic is rated for operation at +5V +- 5% so the power supply could provide as much as +5.25V. If the 3.3V supply is also +-5% the voltage could be as low as 3.135V, for a differential of 2.115V.
    If the voltage drop across the protection diode is 0.6V the minimum safe resistance value for this worst case scenario would be (2.115 – 0.6) / 0.0005 = 3.03K.

    Here's my updates calculations:

    I found that the 44 AA batteriy pack with fresh alkaline batteries was 6.13 volts.
    The prop 3.3v could be as low as 3.135 volts.
    The clamping diode provides 0.6 voltage drop.
    Max curent we want is 5 micro amps or or .5 milliamps or 0.0005 amps

    6.13v - 3.135v = 2.995 volts difference
    2.995v - 0.6 = 2.395v
    2.395 / 0.0005 = 4790 ohms.

    So, this would just to be safe with the batteries were in the fully charged state, I don't know how long this would last, I'll test if I'm in this situation. However, this significantly over volts the SR04 sensor (what started the investigation) so I'm going to avoid four fresh alkalines. Maybe I'll just test the motors till the batteries run down a little.

    Becasue of all this, I've started using 10k, this seems to work so far.

    Also, I broke down and got some NiMH AA from Harbor Frieght. Cheap, but too expensive to include in the kit. I'll just have to state "batteries not included".
  • ManAtWorkManAtWork Posts: 2,176
    edited 2013-06-21 06:24
    You must've overlooked it:

    Oh, yes. I checked and found out that was stil working with version 1.2 of the datasheet.
    whistling.gif
    V1.4 is the latest.
    35 x 20 - 2K
  • prof_brainoprof_braino Posts: 4,313
    edited 2013-06-21 09:00
    Apply 5V through a 3.3K resistor and measure the voltage on the pin. It should be around 3.9V if the diode is intact and functioning properly.

    I did as directed. The pins all read 3.9 volts, so I did not burn the prop. WOW. Talk about idiot proof!

    Also I noticed that the when I tested pins 16 through 23 on the quickstart, at least one LED on both sides also lit. So this replacates the condition I saw.

    Is it safe to say when the clamping diode functions, the neighboring pins also get clamped?
  • LawsonLawson Posts: 870
    edited 2013-06-21 11:51
    I did as directed. The pins all read 3.9 volts, so I did not burn the prop. WOW. Talk about idiot proof!

    Also I noticed that the when I tested pins 16 through 23 on the quickstart, at least one LED on both sides also lit. So this replacates the condition I saw.

    Is it safe to say when the clamping diode functions, the neighboring pins also get clamped?

    I think this is just leakage current. The buffer driving the LEDs on pins 16-23 is very sensitive. If the prop isn't driving those pins, I can easily make the LEDs light and flash by rubbing those pins with my finger.

    Lawson
  • prof_brainoprof_braino Posts: 4,313
    edited 2013-06-21 12:57
    Lawson wrote: »
    I think this is just leakage current. The buffer driving the LEDs on pins 16-23 is very sensitive.

    Ah! the buffer, I forgot about that. I don't even know what a buffer is, I better go look that up on wiki

    ...later...

    So, is this a "unity gain buffer"? is it voltage or current buffer (can it be both current and voltage?)

    Whoa! How much to i need to know about these?

    Is the leakage just from one buffer input to the next, and not so much from one prop pin to the next?
  • LawsonLawson Posts: 870
    edited 2013-06-21 19:13
    Ah! the buffer, I forgot about that. I don't even know what a buffer is, I better go look that up on wiki

    ...later...

    So, is this a "unity gain buffer"? is it voltage or current buffer (can it be both current and voltage?)

    Whoa! How much to i need to know about these?

    Is the leakage just from one buffer input to the next, and not so much from one prop pin to the next?

    Actually the "buffer" is a 74HC541 logic buffer. (ok, technically you could call it a current buffer) It senses the logic level on it's inputs and outputs the same logic level with a lot more power. Very useful for cases like the Quick-start where you want to drive LED's from an IO pin without adding a significant load. (i.e. the buffer adds ~6pf and a pA or two of leakage at room temperature) Because the buffer input adds an insignificant load, insignificant things can effect it. For instance, skin conduction to nearby power pins and traces. (even through solder mask!) Or the movement of a charged object nearby. (like a finger bearing a small static charge)

    Lawson
Sign In or Register to comment.