8
\$\begingroup\$

This is a theoretical question since I've come across this type of problem many times.

Suppose an amplifier is powered between 12 V and -12 V, so the signal output can reach a maximum of 12V. If I am not expecting my signal to be more than a few hundred millivolts, then I should be able to safely read it on my Arduino Nano (or UNO).

To be safe if I want to make a filter that blocks all voltages above, say 3.3V, just to be safe, how do I do it?

Are there semiconductor devices that could perhaps become high resistance over a particular voltage?

\$\endgroup\$
1
  • \$\begingroup\$ On "if I want to make a filter that blocks all voltages above, say 3.3V" Take a look at this answer which protects a 3V3 logic input when driven with much higher logic HIGH voltages, using a very simple circuit. \$\endgroup\$
    – TonyM
    Commented Mar 29, 2023 at 22:39

4 Answers 4

11
\$\begingroup\$

Many ICs have input protection diodes that will become conductive when the input falls outside the bounds of the power supply potentials (one or the other diode becomes forward biased), having a voltage "clamping" effect (left):

schematic

simulate this circuit – Schematic created using CircuitLab

R1 is usually inserted to prevent a lot of current flowing during such clamping. This also prevents diode forward voltage from excceeding 0.3V or so, keeping the actual potential applied at the IC input to between \$-0.3V\$ and \$V_{SUPPLY}+0.3V\$. When input potential is within bounds, the diodes are reverse biased, passing negligible current as if they weren't even there. The IC's high input impedance means that resistor current is negligible, with no appreciable potential difference across it, so the IC "sees" the potential at IN.

If your device doesn't have those diodes, or the datasheet doesn't mention them, nothing's stopping you from doing this yourself, with your own diodes (shown above right).

Sometimes you wish to avoid dumping current into the positive supply rail, preferring that it go to ground instead. For that you can use a zener diode to clamp to ground:

schematic

simulate this circuit

Above left, a single zener diode prevents the voltage at its cathode from rising above 3V, by conducting strongly in that condition. It is otherwise a regular diode, so it also prevents its cathode from becoming more negative than -0.7V. On the right we add a schottkey diode to clamp closer to zero, at -0.3V. In both cases, clamp current is directed to ground, and won't interfere with the positive supply in any way.

If for some reason the IC's input must not go negative at all, you can use the above zener diode trick, but against the positive rail, or you can clamp against something other than the supplies. Both of the following examples will allow OUT to approach, but not reach, 0V:

schematic

simulate this circuit

The diode clamping solutions above all require a resistor to limit clamp current, but that might be a problem. For instance, reverse-biased diodes leak some current, which must traverse the resistor, causing a small voltage drop across it. That's a big problem if, say, you're trying to measure a potential with millivolt precision, using a 16 bit ADC.

It may be necessary to avoid clamping altogether. You can use resistor potential dividers to scale and offset the source, producing a potential compatible with the ADC:

schematic

simulate this circuit

Sometimes you want as little impedance as possible between the source of signal you are measuring, and the input to the ADC. Some ADCs, particularly high speed or high resolution ones, can have appreciably low and variable input impedance. This will draw current via any impedance in the source, resulting in a voltage drop across that impedance, messing up your measurement.

A simple potential divider on its own may not be an appropriate source for direct connection to an ADC, because it becomes an additional impedance between the original signal source and the ADC itself. However, using an op-amp, with negative feedback, you can produce a near-zero impedance signal, suitable for direct connection to even the most troublesome ADC input, while simultaneously scaling and offsetting the signal:

schematic

simulate this circuit

Alternatively, you can buffer a signal with high source impedance (such as the output of a potential divider) using a voltage follower:

schematic

simulate this circuit

OA2 is a FET input type, with extremely high input impedance (1012Ω) and insignificant input bias currents (a few picoamps), which won't load the potential divider output at all. Crucially, it has near-zero output impedance (due to negative feedback), and will guarantee the ADC sees the signal you want it to see (op-amp input offset voltage notwithstanding).

As a bonus, by powering the follower with supplies of 0V and +3.3V, since the op-amp is physically incapable of outputting anything outside that range, you have an additional layer of security for your expensive ADC.


Update

I neglected to show you one of the most useful clamps I've come across, for signals under 400mV. It uses a diode-connected bipolar transistor, instead of a regular diode, to clamp signals to under 700mV. Where a diode will begin to conduct significant current at 200mV or so, the transistor wont begin to conduct until the signal reaches 400mV or so:

schematic

simulate this circuit

A diode-connected transistor is just like a diode, but with much more "ideal" behaviour. As such, you can connect them in series to produce maximum forward voltages of any multiple of 0.7V. You could also use a PNP transistor, in the same configuration, to clamp negative-going signals to ground:

schematic

simulate this circuit

enter image description here


Update 2

I recently answered another question, in which I used yet another technique which is worth mentioning here. It allows you to specify quite precisely an arbitrary upper limit, using a relatively high impedance reference voltage, that you could derive using a potential divider, for instance:

schematic

simulate this circuit

enter image description here

Beware of reverse-biasing Q1's base-emitter junction though! This solution really only works for clamping to 5V or less, since a 0V input would reverse-bias that junction enough for it to begin conducting.


Update 3

I was reminded that JFETs have extremely low gate leakage current, and can be used as regular PN junction diodes:

schematic

simulate this circuit

The 2N4117 seems particularly good in this respect, passing only 10pA or so when reverse biased to 15V. Be careful not to exceed the maximum gate current for the device, when the gate junction is forward biased, which is 50mA for the 2N4117, closer to 10mA for most JFETs.

With such low leakage current, you can use a JFET instead of a normal diode in the role of clamping, without it loading the source impedance while it's not clamping:

schematic

simulate this circuit

\$\endgroup\$
11
  • 1
    \$\begingroup\$ @DribbleNibble, when the input goes out of bounds, and is clamped by a diode, lots of current could would flow via the diode, unless there's a resistor R1 to throttle it. But when the signal is within bounds, there's no clamp current, just regular input current, which would be nano or picoamps, almost zero, due the high input impedance of the MCU... \$\endgroup\$ Commented Apr 5, 2023 at 12:06
  • 1
    \$\begingroup\$ @DribbleNibble This "normal" input current passes via R1 too, but it's so small that the V=IR drop across the resistor is negligible, zero for all intents and purposes. That means that the right side of R1 has the same potential as the left, the original signal potential. From the perspective of the MCU, R1 has no effect when the signal is "within bounds". \$\endgroup\$ Commented Apr 5, 2023 at 12:09
  • 1
    \$\begingroup\$ Got it, thanks, understood now. Will apply it. \$\endgroup\$ Commented Apr 5, 2023 at 15:24
  • 1
    \$\begingroup\$ @DribbleNibble That clamp current could damage the diode (internal or external), for sure. That's why you choose R1/R2 to limit that current. Also, the positive supply will be SINKING that current which is bad, since they are usually designed to only source. That's one reason why it might be better to clamp to ground, not into some poor regulator output. D2 clamps negative signals to ground (which would forward bias that diode). If you are sure your signal will never go negative, then you don't need D2. \$\endgroup\$ Commented Apr 6, 2023 at 6:30
  • 1
    \$\begingroup\$ @DribbleNibble I would also add that any current you dump into the positive rail is basically extra noise there. For systems that rely on a clean power source, like audio amplifiers, it's generally advisable to not rely on diode clamping against the positive rail, and instead dump all extraneous currents directly to ground. \$\endgroup\$ Commented Apr 6, 2023 at 6:42
7
\$\begingroup\$

Usually, when a very low level ANALOG input signal is to expected, a resistor is placed in series with the input, with a diode in parallel, like this:

schematic

simulate this circuit – Schematic created using CircuitLab
(Note: This circuit would not work with digital, logic inputs because it would constantly limit the signal to logic low.) This would limit the input voltage to forward voltage drop of the diode, around 0.5V. You could place two diodes in series with each other to get about 1.0V limit, or 6 diodes for about 3V or 3.6V peak.
The diode turned upwards should remain single (no additional diodes), it is there to prevent negative voltages at the input, as Arduino can't read negative voltages and those are limited to 0.5V.
Instead of D1, you could place a zener diode of 3.3V or a single LED instead, RED would limit it to about 1.6-1.8V, GREEN to about 2V, WHITE or BLUE to about 2.5-3.4V, depends on the model.

Another way is to place a diode from ground to input pin and a diode from input pin to ground, with a resistor in series with the voltage signal you're measuring or sampling, like this:

schematic

simulate this circuit
The capacitor is needed if supply lines are long, in order to absorb fast transients. But since MCU input protection diodes are integrated in your MCU, and that MCU has a capacitor on its supply line, you don't need it there.

The ATmega328 IC used in Arduino Nano and Uno, and most microcontroller ICs have diode protections on their inputs, both towards ground and towards the positive supply rail, as mentioned in the ATmega328 datasheet below, so you don't have to add diodes:

enter image description here

This means that the input voltage will be limited by those diodes from -0.5V to +3.5V, but you still need to introduce a sufficient resistance/impedance on its input to prevent a current high enough to burn those protection diodes when they start conducting.
So, you should place a resistor of at least 12kΩ in series with each Arduino input you're using, because 1mA is the maximum protection diode current (per datasheet for ATmega328), and you have 12V supply voltage which means: 12V/0.001A=12kΩ.


P.S.: Thanks to TonyM and Nick Alexeev for reminding or correcting me in the comments.
\$\endgroup\$
11
  • \$\begingroup\$ I need some clarification. Since the output from the amplifier is DC, how would that work? I'm not educated in electronics, I thought that Sinusoidal voltage in the diagram is AC \$\endgroup\$ Commented Mar 29, 2023 at 14:36
  • \$\begingroup\$ @DribbleNibble Regardless of it being AC or DC, it will limited to the diode's forward voltage drop. I should have added another diode in case of AC, because the negative voltage can go to the diode's reverse breakdown voltage value. I will fix that now. \$\endgroup\$ Commented Mar 29, 2023 at 14:41
  • \$\begingroup\$ Note that modern high-brightness red and green LEDs can also have voltage drops of about 3 V. Check the datasheet. Or you could just use a zener diode, or if you want it very precise, a TLV431. No need for carefully chosen (and likely slightly more expensive) LEDs. \$\endgroup\$
    – Hearth
    Commented Mar 29, 2023 at 14:45
  • 1
    \$\begingroup\$ Regarding the last paragraph about using ESD diodes in the IC as clamps. Datasheets don't always provide a value for the max current in the ESD diodes. 1mA is a good guess for continuous current. The minimum resistor value would be 12V / 1mA = 12kΩ . The 12V value comes from the -12V supply in the O.P. (An app note on the topic of ESD protection diodes: ESD diode current specification It's written about MSP430, but it describes typical ESD protection diodes in an IC.) \$\endgroup\$ Commented Mar 30, 2023 at 1:47
  • 1
    \$\begingroup\$ @TonyM thanks for pointing this out. This question has received a lot of text in the answers (some of it going over my non-electronics-educated head) and I'll go through it all patiently and test my system before confirming solution. \$\endgroup\$ Commented Mar 30, 2023 at 12:35
4
\$\begingroup\$

If the ATmega associated information was 100% reliable, you could use an external Zener diode clamp and a series current limiting resistor. For instance, some sources suggest that the ATmega328 input diodes must be limited to no more than 1 mA (see further down for the proof of an official value of 1 mA).

This doesn't appear to be official but, maybe there is some documentation that does officialise it? Any offers?

Maybe there is some official statement for the 1 mA figure in the ATmega328P data sheet: -

enter image description here

Thanks to Edin Fifić for finding this. This device appears to be used in Nanos and Unos.

So, based on the 1 mA limit and using a 10 kΩ input series resistor, the current would be limited to 1 mA when the external input voltage is no higher than high Vcc + 10 volts: -

schematic

simulate this circuit – Schematic created using CircuitLab

Hence, a simple 10 volt Zener diode at the external input would suffice. But, the Zener diode needs to be protected to prevent it from overheating and failing. If your input source was "powerful" you could use an appropriate low-ish value series resistor for the Zener protection. Taking it to extremes, you might wish to use a fuse to protect the Zener (which in turn protects the vulnerable input with the 10 kΩ resistor).

schematic

simulate this circuit

If you can't find or believe the data for the maximum input current, play safe and use a rail-to-rail op-amp (which will have its maximum input current specified) powered from the same supply as the ATmega328.

\$\endgroup\$
6
  • \$\begingroup\$ The datasheet for ATmega328 under "Electrical Characteristics">"Absolute Maximum Ratings" specifies "Injection current" at Vcc=0V as ±5.0mA, and at Vcc=5V as ±1.0mA. \$\endgroup\$ Commented Mar 30, 2023 at 15:50
  • \$\begingroup\$ What page of which document @EdinFifić \$\endgroup\$
    – Andy aka
    Commented Mar 30, 2023 at 15:54
  • \$\begingroup\$ "Injection current" doesn't appear in this data sheet so, maybe you can provide a pointer @EdinFifić \$\endgroup\$
    – Andy aka
    Commented Mar 30, 2023 at 15:56
  • \$\begingroup\$ I was looking at this one: ww1.microchip.com/downloads/en/DeviceDoc/… , page 258, first table under Absolute Maximum Ratings. \$\endgroup\$ Commented Mar 30, 2023 at 16:02
  • \$\begingroup\$ @EdinFifić OK thanks. The data sheet you linked is the ATmega328P and I shall incorporate a section to justify the 1 mA claim!! \$\endgroup\$
    – Andy aka
    Commented Mar 30, 2023 at 16:06
3
\$\begingroup\$
  1. If you are planning to use the current-limiting resistor + ESD diode to supply (3.3V) combination to limit the input voltage at the MCU pin, a word of caution: Take care of the current that you are injecting into the 3.3V supply. If you inject a current that is higher than the load current of the LDO that is supplying the 3.3V, there is a risk that the LDO voltage can go out of regulation because LDOs might not be able to sink current. So, choose the current-limiting resistor accordingly. If that resistor is too high, it could filter your input signal.

  2. One could use a series switch between the AMP output and the MCU and cut-off the switch when the voltage crosses the safe region. Ofcourse, this would be complicated compared to the other solutions because you need to add comparator(s) & switches.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.