CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

ADC input protection ??
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mindstorm88



Joined: 06 Dec 2006
Posts: 102
Location: Montreal , Canada

View user's profile Send private message

ADC input protection ??
PostPosted: Fri Jan 22, 2010 8:29 am     Reply with quote

Hi guys , I would like to know how do you protect your PIC adc inputs against reverse polarity ??? Ì'm feeding battery volrtage to my PIC16F877A and would like to protect it against operator error !!!!

Thanks
lsimaster



Joined: 19 Mar 2009
Posts: 25

View user's profile Send private message

ADC input protection
PostPosted: Fri Jan 22, 2010 8:53 am     Reply with quote

The best protection scheme is a series resistor and a pair of schottky diodes (such as BAT54S) one to each power rail. The resistor should be sized to not burn out the diodes and no affect the sample accuracy of the A/D. The Microchip data sheets give info on the accuracy issue.

The schottky keeps the voltage drop below the processors internal protection diode forward drops and therfore prevents latchup and destruction.

We have used this approach for many years with complete success. Typically we use a 10K, 1206 resistor although sometimes go smaller depending on how we are using the A/D, which comes down to the sample rate. The same circuit is also effective on digital inputs that are exposed to the external world.
logical



Joined: 21 Dec 2009
Posts: 57
Location: SouthPort, UK

View user's profile Send private message Visit poster's website

Re: ADC input protection ??
PostPosted: Fri Jan 22, 2010 1:42 pm     Reply with quote

mindstorm88 wrote:
Hi guys , I would like to know how do you protect your PIC adc inputs against reverse polarity ??? Ì'm feeding battery volrtage to my PIC16F877A and would like to protect it against operator error !!!!

Thanks


Another option is a modification of the above solution, I personally use a series resistor with a 5v1 Zener, that covers reverse polarity and also saves over voltage too ;o)
3v3 Zener if using a 3.3volt Micro.

1k inline resistor would give you 5 milliamps to contend with based on 5 volt, 3.3 milliamps on 3.3v etc so makes choosing a zener easy.
lsimaster



Joined: 19 Mar 2009
Posts: 25

View user's profile Send private message

zener is not a good option
PostPosted: Fri Jan 22, 2010 3:09 pm     Reply with quote

The zener has a problem because it is more expensive and, most important, the zener tolerance is poor. Look at a zener break over curve with tolerance factored in and you will see what I mean. The zener provides some protection just not as good.

The schottky diode pair clamps the input within (Vcc + VS) and (Vss - VS). VS has a very tight tolerance. Using the schottky insures that VS is always less that the internal clamp diode forward drop as those are regular silicon junction diodes. The difference is about .3V vs .7V. I designed integrated circuits for a lot of years so am very familiar with CMOS input structures.

We use the BAT54S because it is very inexpensive in tape and reel and the SOT23 size doesn't waste a lot of board space.
mkuang



Joined: 14 Dec 2007
Posts: 257

View user's profile Send private message Send e-mail

Re: zener is not a good option
PostPosted: Fri Jan 22, 2010 3:20 pm     Reply with quote

lsimaster wrote:
The zener has a problem because it is more expensive and, most important, the zener tolerance is poor. Look at a zener break over curve with tolerance factored in and you will see what I mean. The zener provides some protection just not as good.

Zeners at around 5V are actually quite good in terms of tolerance so that should not be a problem. It works well for positive overvoltage protection. For negative input voltages it clamps the input to a diode drop below ground (at around -0.6 to -0.7V). Some A/D chips can only tolerate an input of 0.1V or 0.2V below ground so this is not going to work.

I personally use a pair of Schottky like the 1N914 for situations like these.
lsimaster



Joined: 19 Mar 2009
Posts: 25

View user's profile Send private message

Zener diode tolerance "pretty good"?
PostPosted: Fri Jan 22, 2010 4:08 pm     Reply with quote

This is not true. Zener diodes have very poor tolerance compared to a forward biased diode junction.

Furthermore they are extremely leaky so will completely distort the signal to be measured. The leakage current across the input resistor will make the circuit useless and the leakage gets extremely bad as you approach the zener point. The zener point is not a point but rather a place on a current curve. You guys need to learn a lot more about semiconductor physics.

Small schottky diodes have very low reverse leakage so this is only a problem in circuits of extreme accuracy. Furthermore the stacked structure makes it so one leakage mostly cancels the other.

The 1N914 is not a schottky but rather a very old junction diode designed by the original Fairchild Semiconductor. The modern equivalent is the 1N4148.
mindstorm88



Joined: 06 Dec 2006
Posts: 102
Location: Montreal , Canada

View user's profile Send private message

PostPosted: Fri Jan 22, 2010 5:33 pm     Reply with quote

Thanks guy !!!! i'm gonna go with Lsimaster solution , i've just read an application note about it, i'm convinced Very Happy !!!!!
logical



Joined: 21 Dec 2009
Posts: 57
Location: SouthPort, UK

View user's profile Send private message Visit poster's website

Re: Zener diode tolerance "pretty good"?
PostPosted: Fri Jan 22, 2010 5:34 pm     Reply with quote

lsimaster wrote:
This is not true. Zener diodes have very poor tolerance compared to a forward biased diode junction.

Furthermore they are extremely leaky so will completely distort the signal to be measured. The leakage current across the input resistor will make the circuit useless and the leakage gets extremely bad as you approach the zener point. The zener point is not a point but rather a place on a current curve. You guys need to learn a lot more about semiconductor physics.

Small schottky diodes have very low reverse leakage so this is only a problem in circuits of extreme accuracy. Furthermore the stacked structure makes it so one leakage mostly cancels the other.

The 1N914 is not a schottky but rather a very old junction diode designed by the original Fairchild Semiconductor. The modern equivalent is the 1N4148.


Via a 1K Resistor, a 5v input measures 4.97v inbetween the zener and the pic, 5v based on the BAT, 12v input measures 5.11v (zener) [bzx55c5v1], 5.29v on the bat (BAT54).

Reverse polarity will measure -0.3v (BAT) -0.8v (Zener) so yes the BAT is better for reverse polarity BUT the zener is absolutely fine also for over voltage, out of interest, the above was also simulated in Spice to the exact same results, even based on 0.2v accuracy of the Zener, it gives you exactly the same thing, just not as good on reverse polarity.

At around 10pence for the Bat, 8pence for the Zener and one less component to worry about.
Guest








PostPosted: Sat Jan 23, 2010 9:59 am     Reply with quote

Sorry, I didn't mean the 1n914...but I did use a pair of discrete Schottkys, I forget what the part number is though as I would have to look it up in my schematic.

You could just buffer the input to the ADC with an opamp power from a single 5V supply. Then there is no chance of your input going negative. They sell unity gain followers in discrete packages.
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Sat Jan 23, 2010 1:17 pm     Reply with quote

re zeners -
To be SAFE you need to use a typical 6.2V zener to make sure you are not losing too much single to the SLOPPY Observed breakover voltages.

Real word zeners are FAR from sharp at breakover.

I've been using ONLY the BAT54s or BAV99 fast - diode method described already - dude face it - that's how the PROS do it.
cchappyboy



Joined: 03 Dec 2008
Posts: 45

View user's profile Send private message

Question about A/D input protection
PostPosted: Sat Jan 23, 2010 1:20 pm     Reply with quote

Hi Guys,
I got a question here. For BAT54S its VS is 40V. Does that mean it will work if the input signal amplitude is over 40V ? How can it protect the port ? Can this A/D port afford more than 5V ? Do not laugh at my silly question. I appreciate any response.

Thanks
Guest








PostPosted: Sat Jan 23, 2010 2:48 pm     Reply with quote

If your ADC is powered from a 5V supply then you connect the cathode of one Schottky to 5V. The anode of this Schottky, the cathode of the second Schottky, will connect to the ADC input. The anode of the second Schottky connects to ground.

THe point is to clamp the input to either ground or 5V. If you put 40V on the anode of the first Schottky then your circuit will clamp between ground and 40V which isn't much protection at all. I personally wouldn't drive the ADC without some sort of buffer just for isolation purposes.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Sat Jan 23, 2010 4:10 pm     Reply with quote

I have only been designing instrumentation for a living for 27 years, so maybe I am not a "pro"yet ;-) But I often use a series resistor to a pair of clamp diodes to the rails PLUS A SECOND SERIES RESISTOR from that node to the A/D input pin.

The clamp diodes, 1N4148 or simillar, clamp the overvoltage to about 0.7V beyond the rails. The second series resistor and the PIC internal clamp diodes handle the small excess voltage that is left. In the case of ESD, where you may have a pulse of 10,000V on the input and 10A or more being eaten by the first clamp, the second clamping stage is needed to protect the PIC. If at all possible a capacitor on the first clamping node also helps with ESD.
_________________
The search for better is endless. Instead simply find very good and get the job done.
mindstorm88



Joined: 06 Dec 2006
Posts: 102
Location: Montreal , Canada

View user's profile Send private message

PostPosted: Sat Jan 23, 2010 4:59 pm     Reply with quote

So SherpaDoug is 1kOhms, diodes , 1kOhms OK ??? will it affect measurement a bit ???

Thanks
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Sat Jan 23, 2010 8:27 pm     Reply with quote

mindstorm88 wrote:
So SherpaDoug is 1kOhms, diodes , 1kOhms OK ??? will it affect measurement a bit ??? Thanks


It will probably be fine. But you can find out for sure. The two 1kOhm resistors give 2k resistance. The 16F877A PIC datasheet section 11.1 states the max input resistance should be 2.5k. So as long as the source impedance into the two 1k resistors is under 500 Ohms you are OK for DC loading. The datasheet then gives acquisition time in Equation 11-1 to determine how long it will take to get a good reading with a given resistance.

Their example gives an acquisition time of 19.72us for a 10k source impedance. If you have only 2.5k or less source impedance the time drops to 11.6us.

Can you spend 11.6us waiting for a A/D conversion? If you can then the 1k, diodes, 1k network will be fine. If 11.6us is too slow then you will have to do some engineering to see how to speed things up.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group