I would use the internal protection diodes in some of my inputs. For it, I need to use a resistor. But my doubt is how many current can manage these diodes. Is it 40 mA?
The problem is that I want to use in the analog input, and the maximum input impedance is 10kohm to achieve a good conversion times. And I also want to achieve not fry the micro with inputs up to 15 volts.
I need a good compromise between protection and conversion time.
The maximum input current should be in the '168 datasheet.
If you can't get a low enough resistance you could buffer
the input. You would protect the input of the buffer with
clamping diodes and a resistor (or a TVS). The resistance between the
buffer and ADC input could be 0.
and the maximum input impedance is 10kohm to achieve a good conversion times
The input impedance has no effect whatsoever on on conversion time.
Is it 40 mA
No way in is more in the order of uA than mA.
The maximum input current should be in the '168 datasheet.
This sort of information is not in the data sheet, nor have I ever seen it in any data sheet. These diodes are for internal static protection and are not designed to be used or relied upon in an application.
The input impedance doesn't affect the conversion time but it does affect the
accuracy.
Usually the maximum diode current is specified. I could not find it in the
ATmega168 datasheet. For example the MSP430F169 datasheet specifies
the absolute maximum diode current at +-2mA.
I´ve been looking into the datasheet before write here and I didn´t find info about this diodes.
About the input resistor in the analog input, you can read into the manual (pag 252). You have to charge the sample and hold capacitor:
The analog input circuitry for single ended channels is illustrated in Figure 23-8. An analog
source applied to ADCn is subjected to the pin capacitance and input leakage of that pin, regardless
of whether that channel is selected as input for the ADC. When the channel is selected, the
source must drive the S/H capacitor through the series resistance (combined resistance in the
input path).
The ADC is optimized for analog signals with an output impedance of approximately 10 k[ch937] or
less. If such a source is used, the sampling time will be negligible. If a source with higher impedance
is used, the sampling time will depend on how long time the source needs to charge the
S/H capacitor, with can vary widely. The user is recommended to only use low impedance
sources with slowly varying signals, since this minimizes the required charge transfer to the S/H
capacitor.
Searching a lot, I´ve found a atmel document with the maximum current of the inside clamp diodes:
The series resistor can also be modified somewhat to make the detection closer but note that the maximum current through the AVR's clamping diode should not be higher than 1 mA.