Change analogReference on one analog pin

Hi there,

when I change the analogReference to INTERNAL, this will affect all analog pins A0-A5 right?

Background is:
I want to measure a battery powered device (lipo 3.7v) and how much battery voltage is left and display it on a TFT. So I will connect the Lipo via a voltage divider to one analog pin so 4.2v go down to 1.1v.

But what happens to all other analog pins? Do I need a voltage divider (to 1.1v) then for all analog pins?

Is it possible to just change to INTERNAL on one analog pin for battery measurement?

Thanks for your help!

If you change to internal reference , all analog pins are affected and no you can’t set different reference values for different pins.
Note that analog inputs remain protected against over voltage to 5v

There is just one ADC, so the reference applies to all conversions. There is a multiplexer to choose which
analog input pin is routed to the ADC at any point. You can call analogReference() whenever you like
to switch from Vcc to internal and back. Check the datasheet, I think you may need to discard one
call to analogRead() after each switchover - the datasheet will mention these details.

Thanks for your input!

So I need voltage dividers for all analog readings on analog pins then.

Does the analogReference(INTERNAL) affect the analog pins in any otherway?

Im thinking about:

  • Using an analog pin with digitalRead?
  • Using hardware i2c (A4,A5)

Thanks!

Note that analog inputs remain protected against over voltage to 5v

Does this also apply to 3.3v MiniPro? Probably not, right?
Im building an i2c scanner (with a mini pro 3.3v) and attaching the scanner to a 5v circuit will fry the minipro I suspect?! It would be nice to use the scanner on a 3.3v circuit and 5v.

Does the analogReference(INTERNAL) affect the analog pins in any otherway?

Im thinking about:

  • Using an analog pin with digitalRead?
  • Using hardware i2c (A4,A5)

Any ideas? :slight_smile:

Does the analogReference(INTERNAL) affect the analog pins in any otherway

No.

asuryan:
Thanks for your input!

So I need voltage dividers for all analog readings on analog pins then.

Does the analogReference(INTERNAL) affect the analog pins in any otherway?

Im thinking about:

  • Using an analog pin with digitalRead?
  • Using hardware i2c (A4,A5)

Thanks!

Nothing's stopping you from changing the reference before reading a different channel. It just takes time since you need to throw away the first analogRead you perform after changing the reference.