Easy way to protect ADC input - Page 1
Forum section: electronics / beginners

author: Darlington
author_rank: Contributor
timestamp: September 03, 2024, 07:39:02 am
content: Hello everyone,what circuit do you usually use to protect an analogue input from surges without introducing too much noise? Do you usually also use a linear opto-isolator?

author: Smokey
author_rank: Super Contributor
timestamp: September 03, 2024, 07:45:37 am
content: protect from what?Lightning? User connection errors? Human model ESD?

author: Darlington
author_rank: Contributor
timestamp: September 03, 2024, 07:52:59 am
content: Sorry for misssing specs. Protect from user connection errors. For instance, if the user mistakenly applies a negative voltage to the input or a voltage greater than 5V.

author: RoGeorge
author_rank: Super Contributor
timestamp: September 03, 2024, 07:53:48 am
content: I like this idea fromtrtr6842, to protect the input without adding much noise:https://www.eevblog.com/forum/metrology/diy-0-1-to-10hz-noise-amplifier/msg4907843/#msg4907843

author: Smokey
author_rank: Super Contributor
timestamp: September 03, 2024, 08:00:56 am
content: Quote from: RoGeorge on September 03, 2024, 07:53:48 amYou need a split supply for that....

author: tszaboo
author_rank: Super Contributor
timestamp: September 03, 2024, 08:16:03 am
content: Series resistor and BAV199. If your ADC allows it. If it doesn't you can buffer it with an opamp.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: September 03, 2024, 04:09:19 pm
content: What ADC? They often need some kind of buffering with an opamp in the first place. But in it's simplest form a lowish value series resistor as a current limit combined with a few diodes works.It is also very dependent on the bandwidth & sample rate of your ADC.And on the input levels of your ADC. Is it a 0 to 5V input, or does it have an internal PGA and is it measuring micro volts?

author: Kleinstein
author_rank: Super Contributor
timestamp: September 03, 2024, 05:53:48 pm
content: Quote from: tszaboo on September 03, 2024, 08:16:03 amThe BAV199 are low leakage diodes with a rathe high forward voltage. The "diodes" inside most chips towards the supply are usually lower forward voltage. So for the protection one would need a 2nd resistor from the clamp part to the ADC itself. The details depend on the chip.Quite often, when the chip internal "diodes" (actually often parasitic strucktures) conduct they can effect other functions, especially other analog inputs. So a small current in the low mA range may be save to not destroy the chip, but it can effect other functions.

author: radiolistener
author_rank: Super Contributor
timestamp: September 03, 2024, 07:16:00 pm
content: Anti-parallel diodes will help solve the problem (two diodes connected in parallel but with counter direction). The diode has some open voltage which is about 0.4-1.0 V depends on specific type of diode, so when you connect it in anti-parallel configuration, one of them will be opened when voltage exceed open voltage threshold and make short circuit.But this solution can protect from a short pulses or low current. If you apply high voltage source which can provide high current, it will burn diode and ADC. So, there is a sense to also add a current limiting resistor. But resistor affects input impedance and decrease ADC sensitivity. So, it depends on your needs.Also if your ADC works with high frequency signals, the protection diode should have as low capacitance as possible, to not affect frequency response. So, you can't use high power low frequency diodes, because they have very high capacitance and will affect signal on ADC input.Some diodes like BAV series (don't remember exact type) may have very bad frequency response, so it can work like complex LC circuit with non linear components and may produce non acceptable distortions. So, you're needs to check how selected diodes affects input impedance and frequency response, if result is not acceptable then replace it with other type.Usually ADC input has protection diodes connected to AVDD and AGND lines inside chip, but they are very weak and if you burn it, you will need to replace expensive ADC. So there is a sense to install external diodes for protection, because replacement for burned diode is more easy and cheaper than entire ADC chip.

author: tszaboo
author_rank: Super Contributor
timestamp: September 03, 2024, 07:38:47 pm
content: Quote from: Kleinstein on September 03, 2024, 05:53:48 pmI hear what you are saying, but it works out just fine.You need a very big overload to destroy this, and then just blame the user.

author: Kleinstein
author_rank: Super Contributor
timestamp: September 03, 2024, 09:04:50 pm
content: Many of the µCs and similar chips are quite robust. AFAIK the limit for triggering a latchup with AVRs is at some 200 mA. For longer time the bond wires may be the more serious limit.The problem with the high forward voltage diodes is that most of the current would flow directly to the chip and not through the extra diodes. So the BAV199 alone would not do much. To get a real effect there one would want some extra resistance (e.g. 100 ohm can be enough) to the chip, so that the current to the chip is limited to some 5 mA or so.

author: tszaboo
author_rank: Super Contributor
timestamp: September 03, 2024, 10:26:19 pm
content: Quote from: Kleinstein on September 03, 2024, 09:04:50 pmWhy would you let 5mA into an ADC? Even ~20 year old chips like the ADS1248 have 300 MOhm input resistance. Or you have a high speed SAR or similar ADC and you need to buffer it anyway. At 100uA the BAV199 is just the same 0.6V like any other diode.

author: Kleinstein
author_rank: Super Contributor
timestamp: September 04, 2024, 08:09:52 am
content: The forward voltage with the BAV199 is quite a bit higher than a "normal" diode. Compared to a 1N4001 a good approximation could be something like 300mV more over quite some range (e.g. 1 nA to 10 mA) as both are still resonably close to an ideal diode curve, just shifted in current / voltage.With a smaller diode (like 1N4148) the difference would be smaller, but still there. The low leakage performance comes at a price. One kind of needs to high forward voltage, so that one can get down to the pA range at 50 mV. The curve can hardly be steeper than the shockley diode curve.The typical beginners ADCs are the µC internal ADC inputs - so some moderate speed SAR type. Depending on the type they want a source resistance of less than some 10 K or so. So one may not want a very high series resistor, as this effects the sampling.

author: Psi
author_rank: Super Contributor
timestamp: September 04, 2024, 08:39:14 am
content: For a 5V input I sometimes start with a 220R resistor in series with the MCU pin.Then a 9V TVS diode to GND, followed by a 10k series resistor to the external connection.The 220R is just there if the TVS ever gets to clamping voltage. You can only get 20-30mA flowing into the MCU IO at TVS Clamp, which the MCU IO can usually handle without damage.The 10K input impedance is fine for most ADCs.It's not the best protection, but it's pretty simple and you can get 8-SOIC chips full of TVS diodes

author: radiolistener
author_rank: Super Contributor
timestamp: September 04, 2024, 06:37:28 pm
content: Quote from: Psi on September 04, 2024, 08:39:14 amThis way definitely exceeds absolute maximum rating for GPIO input specified in datasheet and can lead to chip damage.For example, for STM32F103:Input voltage for non-5V-tolerant pins Vin:min: Vss - 0.3 Vmax: 4.0 VInput voltage on 5-volt tolerant pin:min: Vss - 0.3 Vmax: Vdd + 4.0 VSo if you put 9.0 V it can damage the chip.In some cases, if you're lucky, the chip may survive, for example if input pin impedance will be low enough to not exceed 9V and current will be low. But this is definitely not proper protection.

author: Smokey
author_rank: Super Contributor
timestamp: September 04, 2024, 09:26:55 pm
content: Quote from: radiolistener on September 04, 2024, 06:37:28 pmmaybe... maybe not.... some data sheets will explicitly have a note that says something along the lines of ** Voltage maximums can be exceeded as long as current is below maximum.....The thing that breaks those parts is overpowering the clamp diodes once they start to conduct. So they are saying if your input impedance is high enough, then yes the clamp diodes will conduct but the current will be so low it won't overpower them.10.2K at 5V is about 0.5ma. About 1ma at 10V. That's very likely below the clamp diode overpower limits. That's the idea at least.

author: tszaboo
author_rank: Super Contributor
timestamp: September 04, 2024, 09:54:53 pm
content: Quote from: Smokey on September 04, 2024, 09:26:55 pmWell, not just that. If you connect 9V to the input of a microcontroller through a resistor (and you don't have explicitly a diode in front of it) then the GPIO protection diodes start conducting, and the current will go into the power supply. And that raises the power supply voltage. But the load of the power supply is usually high so you cannot really raise the voltage that much.So the datasheet needs to be read this way: If you nail the power supply with an SMU that can source and sink current to 3.3V (for example) and you connect 3.6V to the input with a 0 Ohm source, the MCU will get damaged.But if it's powered by an LDO or buck converter that can only source current, then your power supply will go up... and then, you investigate how much and if that can break anything at all.

author: radiolistener
author_rank: Super Contributor
timestamp: September 04, 2024, 10:10:46 pm
content: Quote from: tszaboo on September 04, 2024, 09:54:53 pmThere is no such thing in the datasheet. But it clearly claims that 4.0 V and/or 5 mA inject current on input pin is the absolute maximum rating and exceeding it may cause permanent damage to the device.I think that using internal ADC protection diodes as voltage suppressor is a bad choice and may lead to ADC damage even if you limit voltage to 9V with external suppressor diodes. I know cases when ADC was damaged with less voltage.

author: tszaboo
author_rank: Super Contributor
timestamp: September 04, 2024, 10:33:15 pm
content: Quote from: radiolistener on September 04, 2024, 10:10:46 pmIf you run current into an ADC or GPIO pin of a microcontroller, where does it go?Use Kirchhoff's law, and draw where the current goes.

author: radiolistener
author_rank: Super Contributor
timestamp: September 04, 2024, 11:07:52 pm
content: Quote from: tszaboo on September 04, 2024, 10:33:15 pmit depends on selected pin mode. If there is internal protection diode and you exceed VDD it flows through diode to VDD and may damage MCU and other components which is powered from the same VDD.If VDD consume too much current, it may leads to broken internal protection diode (this is what often happens).If ADC input is selected it also may lead to ADC analog input degradation.Also note that some ADC may not have internal protection diodes and may be even more sensitive to voltage spikes.Datasheet don't allows that, so just don't implement circuit in that way which may lead to exceed absolute maximum rating voltage and opening internal protection diodes...Even if you don't exceed absolute maximum rating, but put too high voltage on ADC input to get ADC overload, it may affect further measurements when voltage drops below VREF, so it may need to wait after voltage overload event.

author: Smokey
author_rank: Super Contributor
timestamp: September 05, 2024, 02:50:23 am
content: ... maybe our friend from the KKK will chime back in with what ADC he's actually using

author: tszaboo
author_rank: Super Contributor
timestamp: September 05, 2024, 07:39:09 am
content: Quote from: Smokey on September 05, 2024, 02:50:23 amOh yes BTW, terrible choice of name. I doubt it means the same in Italy.

author: Psi
author_rank: Super Contributor
timestamp: September 05, 2024, 08:20:48 am
content: Quote from: Smokey on September 04, 2024, 09:26:55 pmYeah, this was with an AVR, STM32 may need testing and tweaking the component values a bit. It also depends what you are trying to protect from. Static discharge or continuous DC.But yes, as long as you don't overpower the clamp diodes the MCU can handle quite a bit more than the datasheet indicates especially for a short time.Obviously there's risks when using any IC outside it's spec, but often you are only looking for some basic protection. And if you test something yourself 100 times or for an hour straight and it never causes any damage then that's sometimes good enough for a protection feature that probably wont even activate once in the lifetime of some of your products.

author: Darlington
author_rank: Contributor
timestamp: September 05, 2024, 11:53:05 am
content: I need to make a shield based on arduino nano every (ATmega4809 AVR platform) to be able to do free classes for some kids, so I was looking for an inexpensive circuit to avoid trivial mistakes that the latter can make such as applying a negative voltage to the ADC input or a voltage out of the allowed range. Attached is a mini circuit I have simulated. The two diodes more toward the front represent the diodes inside the ADC and the resistor should represent the input impedance. The leftmost diodes are actually diodes with a forward low voltage.Could this work?

author: Kleinstein
author_rank: Super Contributor
timestamp: September 05, 2024, 04:34:55 pm
content: For the 2 sets of diodes to work together there are 2 solutions:1) external diodes with a rather low forward voltage, so not BAV199, but more schottky diodes or BE junctions of a large transistor (e.g. TIP3055). However these have rel. high leakage current and may not be ideal.2) an extra resistor (can be relatively small, like 220 ohm), so that the clamping diodes at the input can clamp a bit higher and the current to the chip internal diodes is still limited to a safe level. Than the external clamp can be low leakage diodesIdeally one would also have a zener / TVS diode at the supply, so that the supply can not rise to an unsafe level.

author: Darlington
author_rank: Contributor
timestamp: September 05, 2024, 05:28:57 pm
content: I think I will choose the first solution by also adding a TVS diode maybe 30V. But I have a doubt, can the TVS diode capacitance, when the trip threshold has not been reached, affect the analog reading considerably?

author: Kleinstein
author_rank: Super Contributor
timestamp: September 05, 2024, 06:24:02 pm
content: The capacitance of TVS diode can vary quite a bit. There are low capacitance ones for something like USB and high power ones with rather high capacitance. Depending on the resistors the capacitance (especially as it tends to be voltage dependent) can effect the linearity a little.A 30 V TVS would not provide much protection. one would want more like a rather low voltage one, like 6 V or 8 V and than still 2 resistors (one at the ADC and one at the very input).

author: radiolistener
author_rank: Super Contributor
timestamp: September 05, 2024, 10:40:18 pm
content: Usual practice is to install two anti-parallel diodes. They clamp input voltage to about 0.5 V which is usual working range for ADC input. Using high frequency diodes with low capacitance allows to minimize effect from added diodes.