Electronic – switch between two analog references to read signals with different ranges with the ATmega328P

adcatmega

I want to read two voltages of different ranges with an ATmega328P ADC with the highest resolution possible:

  1. The 1st signal varies from 0 to 1V. It's the output of an LM35DZ Temperature Sensor. I wanted to use the internal 1V analog reference to get the highest ADC resolution possible.

  2. The 2nd signal is the battery voltage, that varies from 0 to 5V. I feed it to this Over-Discharge Protection circuit that Russell McMahon proposed and based on that reading, it will turn off the circuit if battery levels are too low. To read this signal, I have to use the ADC 5V voltage reference.

My questions are:

  1. Is it ok if I keep changing the ADC voltage reference from the internal 1V to the 5V reference to make one read then the other?

  2. When I switch to 1V internal reference, will the other 5V signal damage the other analog input? I got the impression that the 1V reference would be a limit for the ADC and the 5V on the other input would somehow violate this.

  3. I actually tried to switch between 1V and 5V reference, but when I do it, the reading of the 1st signal (with 0 to 1V range) starts fluctuating. Why is that? I tried giving the ADC time to settle (10 to 50 ms), but that didn't work. How do I get a stable reading after switching the analog reference?

Best Answer

  1. No problem at all.
  2. No.
  3. Take multiple readings and average them. Also, the internal voltage reference isn't wonderfully stable. Better to use an external voltage reference chip. I often use an MCP4821 / MCP4822 DAC chip so I can program a precise voltage reference down to 500µV resolution.