Analog Input Protection?

Hi Guys,
I have a question regarding the protection of the Analog Inputs on the Arduino.

The Back Story
A short while ago with some help from the Arduino Forums I managed to put together a OhmMeter/VoltMeter used to measure the resistance of a cable. It was to be the first part of an Alarm System for my house. It worked quite well, measuring the cable resistance using a voltage divider circuit and some math. At the moment, it is currently used with Passive Sensors but now I would like to add some Powered Sensors into the system. A potential problem I have come across is that the Powered Sensors operate on 12VDC. If for any reason there is a short, the Analog Input on the Arduino could potentially have 12V attached to it!

The Question
What is the best way of protecting the Analog Inputs on an Arduino from anything potentially damaging, specifically over-voltage protection without affecting the accuracy of the converter?

I have being doing a bit of looking around but I can't seem to find anything particularly helpful on the topic so any light you guys could shed would be awesome.
Thank for your help in advance.

Kind Regards,
Alex

I think you should have a look here:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1275320672

Overvoltage protection can be achieved with a zener diode which only conducts current once voltage applied exceeds its rated voltage.

That's the simple story. In practice, because the diode has a limited power rating you cannot allow it to conduct any amount of current else it will dissipate too much power and be destroyed. So we put a resistor in series to limit the current, and we end up with the overvoltage protection circuit on our Gator boards:

Then it gets even more complicated. The zener diode is not a perfect "on/off" switch such that current through it is 0.000000 for voltages <5.1V and infinite for voltages >5.1V. There is a "knee" to its current-voltage characteristic such that current starts to creep up as you increase the voltage towards 5.1V. The current leaking through this diode causes a voltage drop across the 510 ohm resistor such that what you see at the microcontroller pin is just a little bit less than what is coming in. You can see this effect on an X-Y plot of microcontroller voltage vs. applied voltage:

See the little "bend" in the graph near the top right? That says that when you apply 5V to the pin (X axis) you only see about 4.6V at the microcontroller (Y axis). But for applied voltages <4V there is no "bend" because the current drawn by the zener diode is negligible.

Since converter accuracy is important to you then if you use this circuit you should only apply voltages of 4V and below, else you will lose linearity beyond this point.

Alternatively, you can buy an "active zener" diode like the TL431 which has a much steeper "knee" and almost does act like an "on/off" switch with respect to current and voltage. You'll still need a current-limiting resistor but there will be much less leakage current closer to 5V.

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons

Hi Guys, Thank you for your replies.

From what you've told me, my understanding is that in this situation, over-current protection is not required because the Arduino will only draw what it needs, and over-voltage protection can be achieved by using a Zener Diode (5.1V) and a resistor. However, using a Zener Diode will cause a voltage drop across the resistor when it reaches its "knee" (about 4.0V).

Another Question...
To maintain accuracy and utilise the full resolution of the A/D Converter, instead of measuring input voltages on the Analog Pin between 0 - 5.0V, would it be a good idea to use input voltages between 0 - 4.0V and set the analogReference on the Arduino to 4.0VDC?

Or have I completely misunderstood...

Thanks again for your help,
Alex

To maintain accuracy and utilise the full resolution of the A/D Converter, instead of measuring input voltages on the Analog Pin between 0 - 5.0V, would it be a good idea to use input voltages between 0 - 4.0V and set the analogReference on the Arduino to 4.0VDC?

Yes, exactly, if that is an option for you in your application. You will also have the benefit of a more accurate reference (assuming you actually use an accurate reference!) than the "5V" reference which, if powered by USB, is not at all guaranteed to be 5V thus possibly leading to "large" errors in measurements.

--
Beat707: MIDI drum machine / sequencer / groove-box for Arduino

Hi Guys,
Apologies for the late reply. I'd just like to thank you all for the help, I had a chance to test the Zener Diode out today and it works perfectly.

Thanks again,
Alex

I read somewhere, to use a zener diode (5.6v) to avoid the knee and still protect the input and read the full 0-5v divider. Would this work, or was this guy wrong to say that? I cant find where i read this, but he must have convinced me because i ordered 10 from digi-key on my last order.

Found it on page 323 of this book.

Practical Arduino: Cool Projects for Open Source Hardware
By Jonathan Oxer, Hugh Blemings

google this phrase and it should be the top link.

voltage divider arduino 5.6v zener

or try this link

You're in a very gray area. Current will either go through the 5.6V zener or the on-chip ESD diode depending upon the particulars. You don't want significant current going through on-chip ESD diode as that will cause electrical overstress and eventual chip destruction.

Now a "5.6V zener" could be a 5.6V+/-5% zener (so as high as 5.88V) and by that it means its voltage will be 5.88V when xx mA flows through it (xx could be 1mA, 5mA, 20mA depending on the zener diode and the manufacturer). So exactly how much current goes through the zener and how much goes through your chip....very much depends.

Personally, I think 5.6V is too high to protect a 5V input with ESD diodes that start conducting at 5.5V.

--
The Rugged Motor Driver: two H-bridges, more power than an L298, fully protected

RuggedCircuits,

The ones I have are 1N4734ATR by Fairchild. These were tested at 45mA.

Wouldn't the 5.6v zener start clamping at 5.1v or 5.2v though? By the time it got to 5.5v wouldn't the zener be flowing enough to cover a pretty high current spike without letting any to the arduino? If it were to spike wouldn't the zener keep the voltage at a max of 5.88v and leave very little current left for the ESD diode to handle, if any?

Not really understanding the whole thing.

Thanks

Wouldn't the 5.6v zener start clamping at 5.1v or 5.2v though?

I don't know...they don't say. And "start clamping" is a vague term -- the question is what will their current be when the ESD diodes start conducting. But, you've got 10 of them now so you can test them!

--
The Quick Shield: breakout all 28 pins to quick-connect terminals

If you need a full 5v linear range i don't think you can use a zener. I'd go for schottky diode clamping to the power rails and a series resistor before the diodes.


Rob

I haven't had a chance to test anything yet but, just thought of this, doesn't the top resister limit the current anyway? So if its a 100k resister and the voltage spiked at 100v it would only be 1mA current through the resister? And that's .1 watts. What am I missing?

tnovak:
I haven't had a chance to test anything yet but, just thought of this, doesn't the top resister limit the current anyway? So if its a 100k resister and the voltage spiked at 100v it would only be 1mA current through the resister? And that's .1 watts. What am I missing?

Your not wrong. The series resistance that the 'over-voltage' flows through is pertinent to the discussion.

Lefty

I was thinking of the post by the same user when i said "top resister 100k". He has a thread about voltage divider also.

http://arduino.cc/forum/index.php/topic,59729.0.html

I have take a break, and clear my head.