Protecting ADC inputs from >5V?

GreenLeader

Senior Member
I am a Picaxe novice and an electronics beginner. I am planning to read a transducer with the 10bit ADC on a PICAXE (not sure yet which one) - any comments on my plan appreciated :)

The transducer needs a 10V supply and outputs +/-225mV.
I intend to use an AD623 with gain of 10 and a Vref of 2.5V to give me 2500mV +/- 2250mV for the Picaxe 10bit ADC to read.

It is possible that the transducer can output say 400mV if it is overloaded. In this case the Picaxe ADC will see 2500+4000=6500mV.

My circuit diagram is attached - I have 3 questions:

1. Will 6500mV on the ADC damage the Picaxe? If so how can I protect the Picaxe?

2. I am using a pair of resistors as a divider to provide Vref at 2500mV. Is this a satisfactory solution and what sort of magnitude resistors should I use?

3. Is my layout with two regulators and caps satisfactory? (LM78L05 for 5V to Picaxe and LM2904 for 10V to transducer, all powerd by a 12V battery).

Many thanks
 

Attachments

gengis

New Member
Clamp

The cheap easy common way is to clamp the input signal with a pair of diodes. The resistor is necessary to protect the driving device and limit current.

In normal operation the diodes are reverse biased and effectively not part of the circuit - in a case where the signal tries to exceed the power supply or go below ground (if the driver is bipolar) the appropriate diode conducts and clamps the voltage at .6 volts above the supply voltage (with ordinary silicon signal diodes)

Many IC's already contain protection diodes on the inputs - it is somewhat safer to provide an external diode capable of handling some current (most 1N4148's are good for 100 ma)

The 10 K resistor will introduce a small amount of error to the signal because it is in series with the input impedance of the ADC. A lower value will introduce less error but increase the load on the driver and may even increase the power supply voltage to the Picaxe which could harm it. If you want to decrease the resistor value one easy way is to just make sure there's some additional loading on the same supply that powers the axe (a 20 ma led pilot light and the input resistance could be as low as 500 ohms - providing the load is always there - leds on the output of the axe won't always be switched on).
 

Attachments

hippy

Ex-Staff (retired)
With clamping diodes the thing to watch out for is the voltage they clamp at. An external diode clamping at 0.6V will only carry current if Vinput > Vsupply+0.6V, an internal diode clamping at Vsupply+0.3V will take all the current and not allow the voltage to rise to the point that such an external diode is even effective ( ie, it may as well not be there ).

I'd go with a 5V1 zener and probably include a low R.
 

hippy

Ex-Staff (retired)
@ GreenLeader : Your PSU looks okay to me. You could consider a 4u7 ( or something like that ) on the 2V5 reference but as any variation in 10V would also affect 2V5 as it is now it may actually be better without.

You could also replace the divider with a multi-turn pot and the same for R1 which would allow you to calibrate the offsets and gain. A pot between two resistors at either end will allow better adjustment assuming the mid-point is approximately what you'd likely want in theory.
 

womai

Senior Member
If you want external clamping diodes, use small-signal (not rectifier) Schottky diodes. They turn on at a forward voltage of around 0.3V (as opposed to 0.6 - 0.7V for regular silicon diodes).

Second, I would add a capacitor to your 2.5V reference voltage to filter out any noise. Use a ceramic capacitor, 10nF, with short leads (or surface mount if you build a printed circuit board). Connect it between you 2.5V reference and ground.

As to the 100nF capacitors in your schematic, place them close to the Picaxe and the AD623, respectively.

Wolfgang
 
Last edited:

leftyretro

New Member
I am a Picaxe novice and an electronics beginner. I am planning to read a transducer with the 10bit ADC on a PICAXE (not sure yet which one) - any comments on my plan appreciated :)

The transducer needs a 10V supply and outputs +/-225mV.
I intend to use an AD623 with gain of 10 and a Vref of 2.5V to give me 2500mV +/- 2250mV for the Picaxe 10bit ADC to read.

It is possible that the transducer can output say 400mV if it is overloaded. In this case the Picaxe ADC will see 2500+4000=6500mV.

My circuit diagram is attached - I have 3 questions:

1. Will 6500mV on the ADC damage the Picaxe? If so how can I protect the Picaxe?

2. I am using a pair of resistors as a divider to provide Vref at 2500mV. Is this a satisfactory solution and what sort of magnitude resistors should I use?

3. Is my layout with two regulators and caps satisfactory? (LM78L05 for 5V to Picaxe and LM2904 for 10V to transducer, all powerd by a 12V battery).

Many thanks
Electrical question aside....

One question I have is are you going to try and measure a possible valid negative voltage that the transducer/input op-amp can develop or do you just wish to ignore it except if it exceeds the PIC pin voltage limit?

I don't think the ReadADC/ReadADC10 will "process" a negative voltage, i.e. give a valid digital 8 or 10 bit integer value. I think it only works with a zero based single polarity voltage.

I may be all wet with this, lets see what others have to say

Lefty
 
Last edited:

moxhamj

New Member
Re "One question I have is are you going to try and measure a possible valid negative voltage that the transducer/input op-amp can develop or do you just wish to ignore it except if it exceeds the PIC pin voltage limit?" there should be no negative voltages anywhere unless there is a negative supply and the circuit didn't show one. So the input would never go under 0V and the diode from 0V to the input wouldn't be needed. I've used 1k and a 5V1 zener in the past. Works for most input scenarios (except lightning).
 

GreenLeader

Senior Member
Well thanks for all the advice. I've updated my circuit diagram, see attached.

So I can get away with a single 5V1 zener and I should put it between the ADC line and the 5V PICAXE supply then?

I don't think I understand how the diode works, despite doing some reading! Current flow vs electron flow confused me! Could anyone describe what happens - electron flow direction and voltages -
a) when ADC input is 4V, compared to
b) when its 6V

thanks again
 

Attachments

gengis

New Member
Electron flow, is from negative to positive - that is it comes out of the ground and flows into the positive power supply. Only if you were observing it on an atomic level.

Current flow is an ancient concept and it has it going from positive to negative. It is a historical mistake. It doesn't matter which direction you choose to use, all the theory works either way. The distinction is moot most of the time - unless you want to electroplate metal, or etch metal, or plasma weld etc..

Most engineers will use current flow. That is a conventional way of thinking. If you think of current as flowing from positive to negative - diode arrows point in the direction of flow. And since that is the convention, that's what we use. If you are trying to understand how some things actually work on an atomic level electron flow comes in handy.

The diode acts as a one way valve to electricity. If the the anode (arrow) is positive with respect to the cathode (plate) current flows. There's a turn-on voltage too - current begins to flow at any voltage but it is almost nil until you exceed a specific voltage for the diode you are using. The type of diode affects the voltage level you are required to overcome before voltage flows. Silicon diodes and rectifiers require the anode to be more than point six volts higher than the cathode before current flows. Germanium diodes and Schottky diodes require point three volts.

Another analogy: One way valves used in plumbing have something called a "cracking pressure." that is they don't allow forward flow unless enough forward pressure is there to move the internal parts against gravity - or compress a spring. A valve that can withstand 2,000 pounds of pressure may require 100 pounds before forward flow starts.

In your example: At 4 volts with a 5 volt power supply the diode is for all intents and purposes not there - no current flow. When it is six volts - there will be current flow. Instead of 6 volts appearing on the picaxe terminal it will go through the diode and up into the power supply. The voltage will be clamped at 5.6 volts (.6 to turn on the diode) the remainder of the voltage will be across the resistor. At 10 volts in, the voltage at the axe will still be 5.6 and the other 4.4 will be across the resistor. Any voltage below 5.6 and the diode will be reverse biased.

All diodes have other characteristics - how much reverse voltage they can take before breakdown occurs, how much power they can dissipate at a given temperature, how fast they can switch from non conducting to conducting and back again. etc..

Zener diodes breakdown at given voltages - that's how they are designed. NO DIODE is harmed by "breakdown" unless the current is too high in the reverse mode. The emitter-base junction of a transistor, for instance can be used as a zener - silicon breaks down at ~7.5 volts (but it isn't the same for all transistors). The forward conduction and breakdown (reverse) conduction both occur at fixed voltages so both can be used as voltage references - they remain relatively constant despite the amount of current flow (within limits). LEDs are diodes that emit light when forward biased. Red may require 1.8 volts and blue 3.5 volts - the reverse breakdown of an led is ~5-7 volts.

A 1N4148 small signal diode can take about 100 ma forward biased, need .6 to conduct, reverse breakdown is ~100 volts and they are very fast switch's. The actual specs vary a bit from different manufacturers.

Diodes can be specially made to do lots of fancy things - regulate current and voltage, vary capacitance with the amount of reverse voltage, switch audio and video signals, generate microwaves and oscillate at lower frequencies.

That's basically what you can do with diodes - how they are made and actually work inside is another fascinating. story.
 

moxhamj

New Member
If you have a variable power supply (eg up to 12V) you can do a simple experiment with a zener. Put a zener in series with a 1k resistor and put that across the power supply. If the zener is put in the same way as a diode, eg the + side to the side without the bar, then the zener acts like a diode and conducts electricity. But if you put it in backwards and wind up the volts, when you get to a certain value (eg 5.1V for a 5.1V zener) the zener also conducts. It is a simple experiment that helps explain why zeners always have to go in 'backwards'.
 

Michael V

Senior Member
Is this right?

I also have a similar "Challenge", and would like to check this is right, and ask for advice.

I procured a bunch of 20 Bar 0-5 V pressure transducers at a bargain price, new ones at a more desirable range of about 2-4 bar would cost about $350 or 140 pounds each (don't have the symbol).

I decided to use an op-amp to amplify the signal with a gain of 10, and this seems to work OK and give better precision than the raw input. The output goes straight into the ADC of the Picaxe, as per sketch.

From the "machine" i have 24V, which i then put through a commercial automotive 24V - 12V converter, then feed it to my project board. So on my project board i have a choice of 12V or 5V.

I am using the 5V to supply the op amp for safety, because if i feed it 12V Murphy's law says that there will be someone will swap a transducer for a lower range one and i could have 10.5V on my Picaxe input, not good.

But, with the 5V supply, the maximum output of the op amp is 3.5V, which is less than 70% of the range of input of the picaxe. The output voltage is a max of 1.5 less than the supply current.

I have an IF statement that tests the ADC input and if the voltage is greater than 60% of full scale , then read the unamplified voltage and don't divide by the gain. Then i lose precision at that point. not good. I'd like to READADC10 over the full range for maximum precision.

In reading the Data sheet for the op amp (LM 358) http://www.national.com/mpf/LM/LM358.html it says that the maximum short circuit current it will deliver would be 40 ma, and it would cook the op amp if it was at more than 15V - but i have 12 max.

So the questions are:
1) If i go with the 12V supply, without any protection, would the 40mA max at 10.5V cook the picaxe? ( easiest fix)
2) If i put in a 5.1V Zener as per the sketch, after the zener kicked in the maximum differential voltage would be about 5.5 V, and the zener could handle 40 mA. Would this be enough protection?
3) Hippy mentions about putting in a Low R - i presume to limit the current. But does (in this case) the op-amp not manage the current? If i did need to add any resistors, where would they go?
4) what is the best practice -and least redesign of my perfectly functioning circuit?

Michael
 

Attachments

wapo54001

Senior Member
This maximum 3.5V out with 5V supply seems to be is a limitation of the op-amp? If so, consider using an LMC662 (dual 8-pin dip) or LMC660 (quad in 14-pin dip) op-amp, which will allow rail-to-rail swing at 5V supply and has very good specifications.
 

Dippy

Moderator
A little 'general' note about zeners.
They do NOT suddenly start reverse 'conducting' at their rated value. It's a sharpish curve I admit - and it varies with current too (yeah,yeah and temp and probably manufacturer).
So a 5v1 Zener will NOT be infinite impedance at 5.0V and zero at 5.1V.

By all means use them for protection with a resistor as mentioned above. But note that if that resistor value is quite high then the zener may/will affect what the ADC 'sees' as the input approaches 5V. This may not be applicable in this case, just keep it in mind for the future.

As mentioned try an experiment using a variable psu + res + zener and measure across zener with your voltmeter. As you change the res value you will see the non-linearity as you approach 5V. This loading should also be considered if your source impedance is high.
 

MFB

Senior Member
Protection & LP filtering

The problem with Zeners is that they can start to degrade the input signal well before they start to fully conduct and protect the PICAXE. Therefore I would use a rail-to-rail output AND INPUT opamp, configured in the non-inverting unity can mode (output directly connected to the inverting input) and powered from the PICAXE supply. You will need a resistor in series with the opamp non-inverting input for protection, but this can be a high value (>100K) and could optionally be combined with a capacitor (between the opamp input and ground) to provide some usefull low-pass filtering. The TS922IN is a suitable low cost dual opamp that is avialable in a DIL package.
 

Michael V

Senior Member
Zener not a Panacea

Hi Guys,
it appears that the zener is not quite the fix i was looking for. Also, i didn't really know what a rail to rail op amp was, and coundn't see that it would actually be true. My local volume retail suppliers Dick Smith and Jaycar only have the LM358. But i see that Farnell have The LMC662 and TS922IN, as well as a LMC6482 which lists transducer amplification on the data sheet. Just that i avoid Farnell as they tend to be expensive, these op amps are about $3.50, which is not really that much.

The smartest thing for me to do is simply replace the LM358 with a "Rail to rail" amplifier and change my IF statement to switch ADC inputs at 95%. I already have the input resistor (10K) and 100nF in place.

Thanksd once again for your assistance.
 

Michael V

Senior Member
Updated chip

Hi All,
One good thing about Farnell is that they deliver same day, for $10. Hard to beat.

I replaced the LM 358 with LMC6482 http://www.national.com/mpf/LM/LMC6482.html. This chip seemed to be preferred for data acquisition and transducer amplification, and is qquited as an upgrade of LMC662.

On a rock solid power supply of 5.0 V, the output goes as high as 4.96, which is great. This extends my useable range by 50%. I think can still comfortably use 95% of the ADC input range, just in case it is not linear at the end.

Maybe if i did use a Zener, it would be to protect the input of the Op amp rather than the Picaxe. I am amplifying at a gain of 10 to exploit the low end range of the transducer , so non linearity due to the zener as pointed out by Dippy is at the high end, an is not going to affect the precision of what i am reading, amplifying and inputing to readADC10.

Thanks again all for your great assistance.
 

MFB

Senior Member
Good to hear that the National opamp has overcome your problems but the TS922IN would have done the same for only £0.76 (from Farnell).

As long as you have an opamp input series resistor of over 10K, you really will not need any additional protection. Unless you expect to input tens of volts, and even that would probably only blow the opamp (its output will then be clamped to one of the supply rails) rather than damaging the PICAXE.
 

Michael V

Senior Member
Thanks

Thanks MFB, the 10K resistor on the input is there (previous sketch), and it makes sense that it will provide enough protection to the op amp, which will just max out at, in this case, 4.96V. Actually, this makes the device more flexible in that if a 0-5V transducer was replaced with a 0-10V transducer i would not have to make hardware mods, or put in a voltage divider, just rejig the internal maths.

That part number TS922IN is $1.00 cheaper at about $2.50, it is cheaper in the UK it seems. Anyway, it means there are options.

Thanks once again.
 
Top