Analog input voltage

Discussion in 'Embedded Systems and Microcontrollers' started by ecaits, Jul 30, 2014.

  1. ecaits

    Thread Starter Member

    Jan 6, 2014
    Dear Friends,

    I have two-three silly question in my mind...

    1. If I give more than 5V, say 10V to analog pin of ADC then what happen???

    2. If I give negative voltage to analog pin of ADC then what will happen???

    3. If I have 4-20mA output of sensor, can I use it as analog input??? OR First I need to convert 4-20mA to equivalent 0-5V??? If yes, How can I covert the same???

    I am using PIC16F877.

    Thank you in advance,
    Last edited: Jul 31, 2014
  2. hexreader

    Active Member

    Apr 16, 2011
    You forgot to give any information on exactly which ADC you are using.

    Some ADCs will happily accept +10 volts and negative volts, others will not.
  3. Papabravo


    Feb 24, 2006
    A resistor of 249 Ohms 1% will convert currents as follows:

    .004 A * 249 Ohms = .996 Volts
    .010 A * 249 Ohms = 2.49 Volts
    .020 A * 249 Ohms = 4.98 Volts

    You can use an opamp configured a a voltage follower to avoid having the ADC input load the current loop.
  4. shteii01

    AAC Fanatic!

    Feb 19, 2010
    There are voltage ADC, you will need to convert your current to voltage.

    There are current ADC, you feed current to the ADC.
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    Generally you make any analog device very unhappy when you apply a voltage at any terminal greater then the positive supply, or less than ground (or the negative supply).

    Most input pins these days have "ESD" diodes to conduct energy to the power rails in case of a sttic zap. Often you can use these to keep your device safe from occasional short term overvoltages, but you need to insert a resistor in series with the input line.
  6. MrChips


    Oct 2, 2009
    Putting voltages greater than Vcc (Vdd) or lower than GND (Vss) isn't going to sit well with integrated circuits.

    In a worst case scenario, a CMOS circuit will latch-up, i.e. go into a SCR parasitic short circuit state that literally fries the chip.

    As Ernie points out, you need to put a resistor in series to limit the current plus voltage clamping diodes if the chip does not already have input protection diodes.
  7. wmodavis

    Well-Known Member

    Oct 23, 2010
    See answers above.
    Papabravo likes this.
  8. ecaits

    Thread Starter Member

    Jan 6, 2014
    I am using PIC16F877.
  9. ecaits

    Thread Starter Member

    Jan 6, 2014
    I am using PIC16F877.
  10. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    My comments still stand:

    Also, max current into or out of a pin is 20mA max (it's listed as "Clamp Current" in Table 15.0). So a series 5K resistor keeps the ESD diode happy but provides a low imedance for the A2D.

    If the voltage goes to 10V the A2D reads 1023, if it goes below ground it reads 0. I would use a resistor below what Papabravo suggests so you can read a difference between a legit 20mA input and an open sensor (which could give you that 10V).