TVS diode with weak pullup - is leakage current a problem? - Page 1
Forum section: electronics / beginners

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 04, 2021, 03:58:04 pm
content: HiLet's say I have a very simple circuit:Code:GND -> SPST switch -> MCU GPIOInside the MCU I have a weak pullup resistor (say 33k fx), so that the GPIO reads high when the switch is off, and low when it is on.With the weak pullup it means the current going through the switch, when pressed, is 100uA (with a 3.3V rail).Now if I add a TVS diode to GND, just after the switch, i.e.:Code:GND -> SPST switch +-> MCU GPIO^-> TVS -> GNDAnd this TVS has a high leakage current, say about 400uA at 3.3V (f.x SJD12A05L01, datasheethttps://datasheet.lcsc.com/szlcsc/1812061902_Brightking-Elec-TAIWAN-SJD12A05L01_C313165.pdf), am I right that the MCU GPIO will always read low, since there is >100uA current flowing through the diode?Thank youSimon

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 04, 2021, 04:09:22 pm
content: Actually a more general question is: how do you handle such high leakage currents?Here is another example from LittleFuse:https://datasheet.lcsc.com/szlcsc/1811170605_Littelfuse-P6SMB6-8CA_C80339.pdfThe 5.8V TVS has a 1mA leakage current - did I miss something here?

author: Terry Bites
author_rank: Super Contributor
timestamp: March 04, 2021, 05:10:25 pm
content: 1. Use an external pull-up that sucks up at least 10x your worst case leakage. Disable the internal pull-up.2.Don't use leaky TVSs. Have a look at a more modern protection device, ESD9R3 for instance.The internal pull-up is often a fixed current source and not a resistor. Resistors take up a lot of silicon die area. What appears as leakage may well be the intentional design. So when they tell you the value is 33k they mean 3.3V/33k a 100uA source. A crappy source at that.

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 04, 2021, 07:19:05 pm
content: Ok thanks.Yes I know about the internal pullupsBut so, about the circuit not working and always reading low on the GPIO, that was correct if I understood well?I think I understand now - these leaky TVS are just "old" design and not really adapted to low current designs clearlyThanks for the tip about the ESD9R3, I'll have a look.

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 04, 2021, 07:49:32 pm
content: So would this diode work fine with the pullup resistor for example?https://datasheet.lcsc.com/szlcsc/1903121632_SINO-IC-SESDFBP05V_C355206.pdfIt has a 1uA leakage current, and this (attached) is the actual pullup current from the internal pullup.

author: Gyro
author_rank: Super Contributor
timestamp: March 04, 2021, 08:00:05 pm
content: TVSs don't really work with internal pullups. If you look at the actual TVS clamping voltage at any significant current, it is already well above the micro's supply voltage and the internal ESD protection diodes on the GPIO pin will already be conducting (too) heavily.For the input to survive, you need some series resistance between the TVS and the input pin, so you've already got a voltage divider situation developing. If the switch is far enough away, or exposed enough, to need TVS protection then you probably want the pullup / switching current to be higher anyway for noise rejection.The best bet is external lower value pullup resistor with the switch and TVS and then a series resistor on the GPIO pin. That way, the TVS can take the majority of the current, leaving only a small current to be handled by the GPIO pin's ESD protection diodes.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: March 04, 2021, 08:09:34 pm
content: Do you have to use a 20A surge rated diode, for something that -- failing any further information -- perhaps doesn't need any protection at all?Why not a clamp diode from GND to node to VCC? Or a smaller ESD diode from GND?Note that you can tolerate much higher peak-clamping voltages, by adding a series resistor between TVS and MCU pin. It is doubtful that a pushbutton needs any kind of speed, so the limiting value of this resistance is determined by the internal pullup (assuming you don't want, or can't afford, an external pullup) and total node leakage.Note also that, manufacturers only rate leakage as it is convenient to do so; likely in this case, when they say 800uA, they do mean it (though the typical value, at 25°C, will probably be much less), but this suspicion can be valid at much lower currents, say 1uA to 0.1uA, below which it is increasingly expensive (slow) to make an accurate measurement of, so ratings in this range may be expected to be much better, they just don't want to take the time to be able to say by how much (small MOS gates being an excellent example).Tim

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 04, 2021, 08:37:00 pm
content: Thanks both that is super helpful information - I do not have much (any?) experience with ESD protection. I kinda know the theory.To be honest I do not know if the device needs any ESD protection at all - it will have a grounded metal case about 12mm above the PCB, so I am thinking any/most ESD discharge from the switches will first go to the case before they could reach the pins (just based on the distance)?If that is true then the only exposed pins I have are:* USB plug VBUS pin (5V) going to LDO input pin -> there I was thinking simply putting a TVS diode* a MIDI plug going to MCU GPIO through a 10R resistor and a ferrite bead* A TRS audio out plug going to opamp output* A pedal plug going straight to an MCU (with an internal pullup) -> this was the one I was actually asking about - based on your suggestions I will put a series 1k resistor with the input

author: Gyro
author_rank: Super Contributor
timestamp: March 04, 2021, 08:52:57 pm
content: In that case, it sounds as if your switches are pretty safe - assuming decent quality switches (where the ESD path to the case is shorter than that to the contacts).As Tim says, the most useful place for the TVS is on the supply rail (to stop it rising excessively), with ESD steering diodes from the signals to supply and Groundbeforethe series resistors.Most micros will take 5mA continuous through their protection diodes (check the datasheet). That's a basic figure that you can use to size the minimum value of your series resistors.Edit: for the pedal plug I would definitely go for diodes to supply and ground in addition to the series resistor - it does sound to be the one that is most 'exposed'.Edit1: One more thing - make sure that your circuit ground has a nice short low inductance path to Chassis ground. An ESD protection scheme is only as good as its weakest link!

author: T3sl4co1l
author_rank: Super Contributor
timestamp: March 04, 2021, 09:05:40 pm
content: The MIDI, is that not isolated? (I don't know much about MIDI, asking honestly. It's my understanding that it can be optoisolated, not sure if it's done standard though.)ESD protection, and EMI filtering, is a good idea for anything that leaves the board. It's rarely necessary within a board. So yes, those are good places for them.USB: you can combine this with data ESD protection, with a TVS array; or if you're using it just for power, anything will do of course. Presumably the LDO has some input voltage range to spare, so it can be very safe indeed.Tim

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 04, 2021, 09:13:05 pm
content: Yes Gyro you are pretty spot on with 5mA, as show in the datasheet (attached). I always saw those numbers, I never actually realized it basically the amount of current the internal diodes could handle.Regarding calculating the minimum value of the series resistor, how do I do this? A 1kV pulse through 1kOhm will give 1A... ?Unless you mean with the TVS diodes, then I take the clamping voltage? That would make sense - say about 9V, that gives me minimum 1.8k Ohm.Also you mention TVS on supply rail, and "ESD steering diodes" - what are these?Thanks

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 04, 2021, 09:17:13 pm
content: Quote from: T3sl4co1l on March 04, 2021, 09:05:40 pmOk thanks good to know! Yes MIDI is optoisolated (it's in the spec), but that does not prevent someone from touching the pins of the cable or connector while plugging it in.And yes USB is only for power so I was thinking only one simple 5V TVS diode from VBUS to GND. The LDO can handle up to 7V.

author: Gyro
author_rank: Super Contributor
timestamp: March 04, 2021, 09:31:57 pm
content: Quote from: simonlasnier on March 04, 2021, 09:13:05 pmYes, you've got it - the series resistor is there to limit the current through the internal diodes to handle what's left after the TVS has taken the bulk of the current. Yes, 1k8 minimum sounds about right.Putting the TVS across VCC and GND limits the overall rise in VCC. You then use ordinary diodes to 'steer' the ESD current to [EDIT:VCCthe TVS +Ve] and GND - one to prevent the input from going more than 1 diode forward voltage drop above VCC and the other to stop it going more than one diode drop below GND. As I say, these are before the series resistor.The TVS doesn't actually need to be connected directly to VCC - It can be resistor biased to VCC, the resistor just needs to be low enough to source the leakage current of the TVS (solving your leakage problem) but is high enough to avoid the TVS clamping voltage from raising VCC significantly (especially as the rise time of VCC is limited by the supply decoupling capacitors).EDIT: A typical TVS array datasheet to show how steering diodes and a single TVS work together...https://www.onsemi.com/pub/Collateral/SRV05-4-D.PDF(and 10k resistor biasing to VCC).

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 05, 2021, 09:27:53 am
content: Thanks these diagrams on the datasheets make a lot more sense nowI am not sure I get the resistor biasing of the TVS to VCC though - do you mean smth like this?Code:VBUS pin +-> LDO input pin+-> bypass cap -> GND^-> resistor -> TVS -> GND(the "+" and "^" are all connected - hope that makes sense)If so I am not sure how to calculate the right resistor value... fx, with VBUS = 5V and a TVS with 1uA max leakage current, then the resistor can be 5MOhm max...? Unless you meant with a resistor in series with the VBUS pin, but in that case that will limit the current going to my LDO

author: Gyro
author_rank: Super Contributor
timestamp: March 05, 2021, 12:22:16 pm
content: You have a small conflict there...The TVS (plus steering diodes) are there for whichever signal I/O lines you want to protect. The TVS (via the resistor) should go on the logic VCC (output of your LDO, I don't know if this is 5V or 3V3). Yes, the resistor only needs to be enough to cope with TVS leakage. In the TVS array datasheet (Option 2 diagram) they use 10k. Taking your example of 9V as the TVS clamping voltage, 10k would only allow 400uA to flow into your logic VCC (if 5V) or 570uA (if 3V3). This is almost certainly less than the current consumption of your circuitry, so in practice, it wouldn't raise VCC at all - if worried, you could go to, say, 20k or 47k, it's not critical, just to prevent TVS leakage current from affecting your I/O signals. I wouldn't bother going into the Mrange though, there's no need.Now, for the protection of VBUS, you want direct clamping of the input voltage of the regulator (no resistor). You need another TVS there, and there's no worry about a little bit of leakage current. I've often got away with using a 5V6 400mW Zener for this duty, it's generally good enough for a pin inside a shielded USB connector. I haven't compared costs between Zeners and basic TVSs recently, TVSs have greater spike current capability though.I don't know if your board is SMD or through hole, but you might actually want to consider using those TVS arrays for your signal protection. They are much more compact that using discrete parts and not that expensive - they are used on things like cheap Chinese logic analysers for input protection (maybe clone devices though). Less helpful if your board isn't SMD.

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 09, 2021, 10:57:29 am
content: Thank you Gyro, and apologies for the late answerI have ordered a few TVS now which I will test.Understood about the VBUS protection - it is exactly what I was thinkingRegarding the pedal input protection, I am still confused - there is not VCC anywhere nearby on the board (the pedal pin is directly connected to the MCU and the other pin is simply ground), are you saying an ESD strike on the pedal pin could raise VCC as well?If not, then one diode from ground to pedal pin and then a resistor in series should be enough protection - it will clamp both negative and positive, and the excess voltage will be handled by the series resistor and the internal MCU diodes as you said.

author: Gyro
author_rank: Super Contributor
timestamp: March 09, 2021, 11:38:13 am
content: No problem.Just a series resistor on the pedal inputmightbe enough, although, if the connector is a 1/4" jack and the pedal itself is well shielded, it would be very difficult to get an ESD strike that didn't go straight to chassis instead of the input. Remember though that your calculation for series resistor size using just the on-chip protection diodes didn't come out well though (Reply #10).Don't you have VCC on the MCU? Ideally you would still put a diode from input to VCC (or to TVS), one from input to ground , and then a 2k resistor to the MCU input. Worst case, a zener to ground after the resistor would be better than a simple diode to ground.Using the weak pullup on the MCU input still seems a bit dodgy for predictable pedal response speed, leakages in the pedal, capacitance of the cable etc. The switch contacts might need a bit more current for decent contact reliability (self-cleaning action). Just a thought.

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 09, 2021, 11:40:58 am
content: Another point is whether I should protect the MIDI port as well. I have been looking at other professional devices and none of them seem to use ESD protection.Looking at the attached picture f.x., it is inside a Dave Smith Mopho X4 keyboard. There are 2 MIDI Output circuits (the ones I use), as well as a MIDI input circuit.* The MIDI input does not even use ferrite beads - just a direct connection to the octocopler through the standard 220 ohm resistor** Note that the D6 diode is mentioned in the MIDI spec, it is to protect against reverse polarity, not ESD* The MIDI outputs have a ferrite bead on each pin, and also going through the standard 220 ohm resistor but then go directly to:** a Hex inverter (pin 5 of first plug) -https://www.onsemi.com/pdf/datasheet/mc74ac05-d.pdf** a NAND gate (pin 5 of second plug) -https://www.ti.com/lit/ds/symlink/cd74hc03.pdf?ts=1615240774162** the 5V rail (pin 4 on both) - which I guess has ESD protection somewhere else in the circuit** ground (pin 2 on both)* The pedal input on the left side though, has precisely the 2 ESD diodes, one to ground and one to VCC. It also has each pin going through a ferrite bead (it's actually crazy the amount of ferrite beads on that board - kinda makes me think it is a bad EMC design?)One thing to note about MIDI Outputs - they are open drain, but I do not think it makes any difference for ESD.The only difference with my MIDI Output is that I am using 10 and 33 ohm resistors as my rail is 3.3V and not 5V.

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 09, 2021, 11:47:12 am
content: Quote from: Gyro on March 09, 2021, 11:38:13 amThanks for the reply - sorry I did not mean a "simple diode" but an ESD diode (between plug pin and GND) and then a resistor from plug pin to MCU pin. My point is one ESD diode will still prevent the voltage going up as well as down, right?And about an ESD strike on the chassis of the pedal - on all (most) pedal the chassis of the pedal is connected to the sleeve on the TRS cable, which in my case is conencted to circuit GND - isn't that the best (safest) place to get an ESD strike? I also intend to connect the metal enclosure to ground - for the same reason.Regarding the weak pullup that is very easy to change - for now it works fine, even with really long pedal cable. I'll make some tests and see

author: Gyro
author_rank: Super Contributor
timestamp: March 09, 2021, 12:21:01 pm
content: Sorry yes, by chassis I meant the case / metal enclosure. It's really where all local ESD strikes will eventually end up going to - whether direct hit, or through the internal clamping of the inputs / outputs.Ah, ok. Yes an ESD diode (TVS or Zener) would solve the problem - doesn't that bring you round to your original weak pullup leakage issue though? - I suppose not if it's a low leakage type. As you say, it's easy to add a stronger pullup resistor anyway. Happy testing.

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 09, 2021, 12:54:45 pm
content: Ok thanksYes true that was the original problem but there are loads of tiny and cheap TVS with very low leakage (like the one I found with max 1uA above) - I was just wondering why some of them had such a huge leakage and I got that answer

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 27, 2021, 03:59:12 pm
content: So just FYI - I have been testing and the following setup works perfectly (attached). The diode I am using is this one:https://datasheet.lcsc.com/szlcsc/1912111437_SINO-IC-SESD3Z5V_C355217.pdfAnd the label "Pedal" goes straight to the MCU which has a weak pullup (current) of about 37k as discussed before. Reading the "low" value I get about 140mV which makes sense with the voltage divider 1.8k - 37k.It works with short cables for the pedal, I also just tried a 30 meter long cable (nobody is ever going to use such a long cable anyways), and it also works perfectly fine.So far I only tested the fonctionality (as in: the pedal), but not how good the ESD protection is. Apart from buying an ESD gun, do you guys have any ideas? I was thinking literally creating the ESD by rubbing a couple of my fleece together and then touching the tip of a cable plugged in. I mean the amount of times where I give myself an ESD shock and it pisses me off, at least now it will be useful

author: Gyro
author_rank: Super Contributor
timestamp: March 27, 2021, 04:10:01 pm
content: Thanks for reporting back. It's always good to know when things worked out.Don't try to ESD test ittoohard, but I think you're pretty safe by the time the plug tip has passed through the socket barrel.P.S. You can always connect the 'R' contact of the socket to GND too for a bit of added protection (I was going to suggest T1 but that would be defeating the object!)

author: perieanuo
author_rank: Frequent Contributor
timestamp: March 27, 2021, 04:30:16 pm
content: resistors cost nothing, put pull-ups externally and you won't fail ever

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 27, 2021, 05:04:41 pm
content: @Gyro: good point about the R contact but normally any pedal cable would be TS so the R is automatically grounded.And about plugging the cable into the barrel, I was more thinking about the other side, if you have one of those pedals without a cable attached (I have one at home), so after plugging one end of the cable into the device, then generate an ESD on meself and then touch the tip of the TS plug at the other end of the cable.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: March 27, 2021, 06:01:27 pm
content: It lacks filtering. Adequate debouncing can be done digitally so it isn't a huge deal. It will fail in the presence of more than a few volts of RF. Not great, not terrible.Y'know, phono jacks are probably quite insensitive to charged cable transients -- that is, say a cable ends up with a charge between conductors, due to odd fields around the connector, handling (triboelectricity between the wires in the cable), etc. Even if you insert it carefully, it'll be impossible to avoid shorting it out, or at least approaching a gap that can be bridged by more than a few kV. The hundreds of volts left over will be easily handled by the ESD diode.Tim

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 28, 2021, 08:29:06 am
content: Hi TimThe debouncing is done digitally indeed. I originally had a small RC filter but I removed it when I saw the digital debouncing was enough.Good point about RF interference, I'll do some tests with my phone on a call right next to the board - unless someone has a better idea?And yes I agree about the jack, you almost always short Tip to Sleeve (=GND) when you insert it. But as I said above I imagined a scenario where the cable is already plugged in, but someone/something with a charge touches the tip of the cable then that would go straight through the ESD diode and the series resistor.