A/D, input overvoltage

13 posts / 0 new
Author
Message

hi everybody again,

I'm dealing with a design here, where a CAN AVR is powered from 5V, and I have to measure signals varying from 0V to 6V.
I don't need to measure once it is above 5V. The only information I need is voltage when it's from 0V to 5V or if it is above 5V.

Before using a zener to limit input voltage, I thought it might be possible to use the AVR's internal protection diodes to do the limiting. Maybe 4.7k series resistor between input voltage (which is low impedance) and AVR's AD pin.

Of course this probably isn't the best way, but I would like to know if anyone did something similar for a design.

On the other hand, the closest zener I found is 5.1V, which may help, but according to the datasheet the AVR will tolerate up to VCC+0.5V only.. maybe powering a little bit above, like 5.3V, may do.

Carlos

Hi,

You want:

0 - 5 [V] -> 0
5 - 6 [V] -> 1

Am I right ??

Well yes these protective diodes can reduce voltage slightly but I don`t thing so they will manage to
withstand many miliamps. Anyway I haven`t found any information about it. I belive that when the current will be to high diode will be shortcircuited to ground or Vcc for ever and microcontroller will be smoked ;)
So I don`t think so it is a good idea.

But I am looking forward to other opinions.

Cheers :)

I need to measure analog voltage when it's from 0V to 5V, by using the A/D. After it's above 5V i have no problem to read it as 1023 ( assuming internal 10-bit adc).

I agree with the diodes not withstanding too much current. That's why the series resistor is there, I think between 4.7k and 10k is alright. Assuming only 1V overvoltage, max current is 0.21 mA with 4.7k and 0.1mA with 10k. These are really overweighted max currents, since I didn't put the diode forward voltage into account, which may reduce it to the half of that.

However the resistor can't be that big, since it should be much smaller than the A/D's input impedance in order to work alright after it's below 5V.

Carlos

You can read this app note-
http://www.atmel.com/dyn/resourc...

where they say-

Quote:
It is not recommended that the clamping diodes are conducting more than maximum 1 mA

If you don't want the avr to do it, I think the 5.1 zener is what you would want, as you want the zener to clamp the excess voltage instead of the internal diode (5.1 vs. 5.5). You could also do a search on this site, as I suspect it has been brought up many times.

Last Edited: Sun. Feb 24, 2008 - 01:37 AM

wow, missed that appnote!
That info would be really useful in the device datasheet.

Thanks!

If your signal is slow it's fine to use a serial res.
But if it's fast you should make a voltage divider just two res in serial to GND(0V) and then put the AD at the midpoint.
Make it so 6V->5V

Jens

Edit typo

yes, I can see the difference. But it is to monitor current consumption, once every 0.5 sec or 1 sec (quite slow).

thanks

Beware though.. the 5V1 zener will start
to conduct before reaching 5.1V - if you have
a high series resistor from your signal then the zener will degrade the signal from .. guessing.. 4.5V and upwards.
Better to use a simple voltage divider

Swech

The following works well and is being used in 24VDC interfacing in an industrial setting for more then 3 years now - without any problems what so ever...

```                   VCC = 5VDC
-+-
|
|
|
K - Schottky Diode
A ^ Vf = 0.25V
|
|
5.0K       |       5.0K
Vin >-----\/\/\/\/-----+-----\/\/\/\/---------+-----> Vout To AVR A/D input
R1        |        R2            |
|                      |
|                      |
K - Schottky Diode       |
A ^ Vf = 0.25V           \
|                      /
|                      \ R3
|                      / 50K
-+-                     \
GND                     /
|
|
|
-+-
GND

R3                    50K              50K
Vout = Vin -------------- = 6VDC --------------- = 6VDC --- = 6VDC * 0.8333... = 5.0VDC
(R1 + R2) + R3        (5K + 5K) + 50K        60K
```

So, you have between 5.0VDC and 5.25 to 5.3VDC to make your determination of Vin >= 5VDC.

By the way, 4.75VDC to 5.25VDC is the standard tolerance for a 5.00VDC logic power supply, or VCC = 5.00VDC +/-5% (VCC nominal: 4.75VDC < VCC < 5.25VDC). So technically VCC + 0.25VDC falls within the worst case requirements.

And graphically:

```                         Y2 5VDC +
|
Put 5VDC on the Y axis    Y axis |
Put 6VDC on the X axis           |
Y = mX+b                 Y1 0VDC +----------+
0  X axis  6
X1   VDC   X2

Y2 - Y1   5 - 0
m = ------- = ----- = 0.833...
X2 - X1   6 - 0

b offset = 0

Sanity Check: Example 1.
Y = (0.8333 * 6VDC) + 0 = 4.99999VDC

Sanity Check: Example 2.
Y = (0.8333 * 3VDC) + 0 = 2.49999VDC
```

```                ADC    Vmax * ADC
Vdisplay = Vmax ---- = ----------
1023      1023

Where:
Vmax = 6.0VDC

```

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston

really nice ascii schematics carl!
and clever solution too!

did you use any schottky diode in particular?

thanks,
Carlos

swech wrote:
Beware though.. the 5V1 zener will start
to conduct before reaching 5.1V - if you have
a high series resistor from your signal then the zener will degrade the signal from .. guessing.. 4.5V and upwards.
Better to use a simple voltage divider

Swech

Exactly true - and has caught me out in the past with a 10K resistor between the signal and the junction of the 5V1 zener and ADC

At signal voltages greater than about 3.5v, the "conductance" of the zener and the 10K resistor act as a very effective, and non-linear, potential divider :(

cbecker wrote:
really nice ascii schematics carl!
and clever solution too!

did you use any schottky diode in particular?

thanks,
Carlos

The diodes were from way back when I worked for Fairchild.

As a Schottky diode has about the lowest Vf, it would be the best choice for protecting an input.

The fact that I have the diode in the node between the two 5K resistors, well, the diode is protected fairly well and the current is limited to the AVR input. The combination of the two 5K Ohm resistors and the 50K Ohm resistor form a voltage divider that scales the AVR A/D input to the OP's 6VDC measurement requirement.

Assuming that VCC is at the worst case value of 5.25VDC, and if the diode connected between the R1:R2 node and VCC turns on at about 0.25VDC to 0.3VDC, then, using the voltage divider rule:

```                   R3      (Vin + VCC) * R3   (0.3VDC + 5.25VDC) * 50K
Vout = Vin + VCC ------- = ---------------- = ----------------------- = 5.0455VDC
R2 + R3        R2 + R3             5K + 50K
```

So, 5.0455VDC is the worst case voltage that will be applied to the AVR input for any applied voltage above 5.25VDC. As I said in the previous post, I have use this type of input protection with 24VDC input signals - with what seems to be absolute reliability.

But I can't see the OP using this circuit. There seem to be some stigma within the hobbyist community to using any more then ONE part to accomplish a task properly But we must realize that good, reliable input protection comes about at the expense of extra parts.

That there are other additions to be made, as well - such as a 0.01uF filter capacitor. But then, that is another part...

I will always opt for the better input protection.

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston