Connect with us

Arduino PIC

Discussion in 'Microcontrollers, Programming and IoT' started by rasmus, Nov 9, 2014.

Scroll to continue with content
  1. rasmus

    rasmus

    30
    0
    Nov 6, 2014
    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 ??
     
  2. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,271
    Nov 28, 2011
    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.
     
  3. rasmus

    rasmus

    30
    0
    Nov 6, 2014
    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 ?
     
  4. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,271
    Nov 28, 2011
    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.
    Yes. That would be good.
     
  5. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,480
    2,828
    Jan 21, 2010
    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.
     
  6. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,271
    Nov 28, 2011
    I thought so too, but that's not how the specifications are worded. Where is the specification for the maximum protection circuit current?
    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.
     
  7. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,480
    2,828
    Jan 21, 2010
    It can also lead to latchup in some devices. Admittedly, this is less likely these days (and affects outputs rather than inputs).
     
    KrisBlueNZ likes this.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-