# A/D Input PIC24EP

I am using a PIC24E microcontroller and trying to convert analog voltage input to digital. The ADC can accept only analog voltages from 0-3 V and my external input signal ranges from 0-5V. Can someone tell me how to scale it down? I am planning to use a resistive divider, but I do not know if it will affect my signal quality and whether the ADC will be able to read the voltage.

This is the ADC input port electrical diagram. Here Rs should be around 200 ohms, but I am not able to find the input impedance value of the analog pin from the datasheet. Can you recommend me something here?

• Please edit your question to explain what the signal source is. This will affect the answer. Sep 22, 2018 at 8:59

It's a pretty standard procedure to use a resistive potential divider to convert a 5 volt signal level to a 3.3 volt signal level but there are a couple of concerns: -

• You need to choose resistor values that are not so low that the 5 volt signal is unduly reduced due to a loading effect. This means you need to understand the source impedance of your input signal and make sure that the loading effect of the potential divider is not too great.
• You need to choose resistor values that are not so high that the 3 volt output signal presents an impedance to the ADC input that causes measurement errors.

These two requirements are of course contradictory but there is usually a range of values for your potential divider that works despite the contradiction.

In cases where there is no common ground that satisfies these two conditions (without unduly affecting the input signal or making the output impedance too high for the ADC), an op-amp buffer can be used. However, this introduces another set of limitations in that op-amps usually can't: -

• Accurately drive an output signal down to close to 0 volts
• Accurately drive an output signal close to its upper power rail limit

In addition, an op-amp buffer may introduce an offset error of a few millivolts So care must be taken when using an op-amp buffer but it is the usual turn-to solution when the input impedance to your voltage signal source needs to be fairly high.

Added to all of this is the ADC's input voltage range; it's never as good as it seems when casually reading the front page of a data sheet; there will be a zero offset voltage that might mean a digital offset even when the input signal is precisely 0 volts AND there may be a gain error to consider that might mean the full-scale digital output is not reached even with your maximum signal.

And finally (hopefully) you do need to "worry" about over-voltage protection should the input actually rise to maybe 6 or 7 volts or even go to negative values.

• thankyou andy. Please have a look at my updated question Sep 22, 2018 at 11:25
• The data sheet should actually recommend the maximum source impedance that produces less than 1 LSb of error. Keep looking, you’ll find it. 10 kohm rings a bell. Sep 22, 2018 at 16:56
• Andy, Thank you for your reply. I am a bit confused. Do you mean, I should make a resitive divider of 10 kohm ? Here, the maximum allowed source impedance is Rs = 200 ohm. Sep 22, 2018 at 17:13
• and here Cin of pin is not measured. So,around what capacitance value would be okay to attach with the resistive divider ? Sep 22, 2018 at 17:17
• @Najam that depends on what the maximum frequency of your input signal that you will want to measure accurately. If it is (say) 1 kHz then use f = $\dfrac{1}{2\pi RC}$ to calculate the maximum value of C. at 1 kHz and 200 ohms, C could be as high as 795 nF but that would give 3 dB attenuation at 1 kHz so 80 nF would be a good choice. Remember this is a maximum value for 1 kHz and 200 ohm source impedance. It can be much lower. Sep 24, 2018 at 8:18