ADC input protection and more

Discussion in 'The Projects Forum' started by mojo_risin, Jan 26, 2014.

  1. mojo_risin

    Thread Starter Member

    Jul 3, 2013
    35
    0
    Hello everyone

    I am doing a circuit in which I would need to measure some signals with the ADCs of PIC24FJ128GC006. The mcu's supply voltage Vdd is 3.3 V, and I will be measuring two signals, both coming from op amps with dual +-9 V supply. The conditioned signal is in the range of the PIC (0-3.3 V), but occasionally it goes as high as +5 V. Here is a picture:

    [​IMG]

    I need both signals to be in the range 0 - 3.3 V, no matter what spikes will come and be amplified from my analog circuit. As you can see on the green graph, spikes occur in two instances - in the beginning and in the end of the signal (that corresponds to relay and motor switching). You can also see how the green signal goes negative, which should be avoided for obvious reasons. So I was thinking of doing a regular two Schottky diode clamping circuit, but after a little research it proved to be somewhat unreliable - please take a look at this discussion. Both of my signals come out from op amps, so the output impedance is low enough, and I need to keep it below 2.5 KΩ. The spikes will not last more than 100 ms. So if I clamp my circuit with a diode to Vdd, that would inject current in the Vdd rail - the same rail which supplies the PIC. I am using linear voltage regulator, and don't have a lot of load on this rail besides the mcu.

    Can someone provide me with a circuit for clamping the voltage, and maybe a little explanation why this works? I would appreciate that. When I asked my tutor what should I do, he said to use the clamp circuit... but I don't want to risk it.

    So that's it - I need both positive and negative clamping, and hesitate which way to go. I don't care if I lose a the negative part of the signal, as it is not important. Again, op amp supply is +9/-9 V, and I need the voltage clamped to Vdd 3.3 V.

    Thanks a lot! :)
     
  2. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    PIC's have internal clamp diodes, to +Vs and 0V that can handle upto ~20mA.
    Use a 1K thru 2k2 resistor in series with the output of the OPA to the ADC input pin.

    EDIT:
    I assume you have adequate smoothing and decoupling capacitors on your PIC supply rails.
    Say, at least 47uF and 100nF.?

    E
     
    Last edited: Jan 26, 2014
  3. JohnInTX

    Moderator

    Jun 26, 2012
    2,347
    1,029
    Microchip doesn't 'allow' that on the PIC24FJ128GC006. Although the practice was common its now discouraged across the board. For the 24F, Sec. 37.0 Absolute Maximum Ratings in the datasheet calls out the voltages allowed on the various pins (3v3 / 5V tolerant etc.)

    A 3v3 input buffer with input clamps might be one approach or clamps on the ADC pin itself maybe if you can live with the source impedance.
     
  4. mojo_risin

    Thread Starter Member

    Jul 3, 2013
    35
    0
    Absolute maximum Ratings for this device show that any analog pin could tolerate Vdd+0.3 V and -0.3 V. But these are extreme conditions, and in general it's not a good thing to subject the chip to such voltages, says the datasheet. Since I am going to run in these values pretty often, I would need a circuit for precise 0 - 3.3 V clamping.

    Yes, I have decoupling caps... If I have time later today I will make a test to see how much the Vdd would increase if 8 V is clamped via Schottky diode to 3.3 V rail.

    John, can you please tell me more about this input buffer? I've never seen one, so a little explanation would be helpful here :) Thanks
     
  5. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    A CMOS input with normal pad buffer intrinsic clamp diodes really doesn't care what the input voltage is; what matters is how much current you try to inject into pin. If the current is limited by an external resistor, like Eric describes, no harm.

    If you are totally anal, you can add two silicon diodes, or two Schottky diodes, one with cathode tied to 3.3V rail, and the other with anode tied to Vss.
     
    Last edited: Jan 26, 2014
  6. mojo_risin

    Thread Starter Member

    Jul 3, 2013
    35
    0
    I just tested the circuit using BAT43 for clamping. They do the job nicely by clamping the voltage out of the opamp to Vdd+0.3 V. I also tested the Vdd rail to see what is happening when clamping occurs - it was pretty stable, so I think I would go with this solution. Just couldn't find Schottky diodes with lower forward voltage drop in my area.

    I have some doubts about the circuit I'm using and that would be a nice time to ask. That's it:
    [​IMG]
    I am not sure if I need resistors in series after the clamping diodes. I've added one at ADC2 rail. I assume the ADC inputs have high enough impedance.
    I also read that a capacitor of 100 nF added to the analog input would increase stability. Is it worth trying?
    And please, take a look in the circuit and tell me if there's something obviously wrong with it. I tend to miss this sometimes.

    Thanks! :)
     
  7. JohnInTX

    Moderator

    Jun 26, 2012
    2,347
    1,029
    I asked Microchip again last night and they referred me to TB3013-Using the ESD Parasitic Diodes on Mixed Signal Microcontrollers. It should answer your questions.

    You don't need a resistor between the diodes and the ADC pin. The diodes should be close to the processor.

    Consider revisiting the motor/relay wiring to ensure that the low level processor/analog are not sharing any power lines (single point connections to the source).

    Good luck!
     
Loading...