Maker Pro
Maker Pro

Arduino PIC

rasmus

Nov 6, 2014
30
Joined
Nov 6, 2014
Messages
30
Hi

Using an Arduino controller or a PIC the input pins are rated at maximum 5v, if i am correct here. I am building a circuit that will be using a Arduino as a controller. So one of the circuits job is to measure a voltage that varies between 10-20 VDC. I am planning to use a voltage divider to scale that voltage down to little below 5 volts. The problem is in a case where lets say i lose the ground on the voltage divider while the voltage input to the divider is 20V, it will now damage the PIC because the voltage is 20 at the arduino input pin. The question is, if the PIC/arduino input does not consume any current why does a voltage higher then 5v damage the PIC ???.

Is there a protection solution to my case ??
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
The Arduino/PIC input WILL draw current if you pull it beyond the power supply rails, because the internal protection diodes will conduct. But as long as you limit this current, the device won't be damaged. The resistance of the voltage divider will inherently limit this current; you just need to choose resistor values high enough so that the device's maximum pin current won't be exceeded. This current will be listed in the data sheet. Actually I would limit the current to a lot less than the stated figure - a few mA at most.

But if you're concerned about losing the ground on the voltage divider, you could just put the bottom resistor of the voltage divider right next to the PIC so the ground can't be lost.

You may also need a capacitor from the input pin to 0V because the ADC generates pulses of current during conversion that will disturb the pin voltage if it is not held fairly stable. I normally use a 0.1 µF metal film capacitor (don't use a ceramic capacitor) for this.
 

rasmus

Nov 6, 2014
30
Joined
Nov 6, 2014
Messages
30
So as long as i don't exceed the current rating which is 40ma per pin no matter what voltage is across the resistor the PIC will survive ???

if i am right, providing 100vdc across a 100k resistor would not be a problem because the PIC will only receive 1ma ?
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
So as long as i don't exceed the current rating which is 40ma per pin no matter what voltage is across the resistor the PIC will survive ???
I think so, but I strongly advise you to limit the current to a lot less than that - say 5 mA. Remember that that figure is in the absolute maximum limits section of the data sheet and data sheets normally say that the device is not guaranteed to work properly at those limits and that exposing the device to those limits can compromise reliability.
if i am right, providing 100vdc across a 100k resistor would not be a problem because the PIC will only receive 1ma ?
Yes. That would be good.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,505
Joined
Jan 21, 2010
Messages
25,505
So as long as i don't exceed the current rating which is 40ma per pin no matter what voltage is across the resistor the PIC will survive ???

That's the maximum current through the output transistors, not through the protection circuit.

You would be advised to make sure the input voltage does not exceed the voltage rails in normal operation.

You can always add your own protection circuit if you're worried.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
That's the maximum current through the output transistors, not through the protection circuit.
I thought so too, but that's not how the specifications are worded. Where is the specification for the maximum protection circuit current?
You would be advised to make sure the input voltage does not exceed the voltage rails in normal operation.
Yes, you're probably right. Current flowing into the protection circuit could cause VDD to rise and this would throw off all of the measurements if VDD is being used as VREF.

For best accuracy, don't clamp the input voltage using a zener, because of the leakage. I got good results using "clamping rail" consisting of a zener biased from VDD with a zener voltage around 0.4V lower than VDD, and a 1N914/4148 diode from each input pin (anode side) to the clamping rail. This ensures that the clamping current doesn't flow into VDD.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,505
Joined
Jan 21, 2010
Messages
25,505
Current flowing into the protection circuit could cause VDD to rise and this would throw off all of the measurements if VDD is being used as VREF.

It can also lead to latchup in some devices. Admittedly, this is less likely these days (and affects outputs rather than inputs).
 
Top