analogread() and his reference

Hi everyone!
i would like to know, if is it possible, how to change the Reference voltage of the dac for just one analog input.
The input is presetted from 0 (0) to 5v(1023) and i want to change it in 0(0) to 2.5v(volt).
But i need the others analogpin normal setted cause i have to stamp everthing on a lcd , and seems like it doesn't work if everthing is 2.5.

Any suggestion ?

There is only one ADC on the AVRs with an analogue multiplexer in front - if you change the reference for one input, you change it for all.

But you are free to change it whenever you like. So set it to 5V, read pin 1. Set it to 2,5V, read pin 2.

septillion:
But you are free to change it whenever you like. So set it to 5V, read pin 1. Set it to 2,5V, read pin 2.

The internal references are connected to the same pin as the external reference (AREF pin) so YOU CAN'T USE BOTH. The Arduino UNO only has the internal 5V and 1.1 (+/-.1) internal references. To use a 2.5V reference you would have to connect an external 2.5V source to the AREF pin. If you switch to the Internal 5V reference while an external reference is connected, the internal 5V source and your external 2.5V source would be connected together and fight each other.
Note: It might be possible to put a diode between the external source and the AREF pin so that the higher Internal voltage won't pass to the external source. You would need a slightly higher external source to compensate for the diode's voltage drop. This trick only works when the Internal source is a higher voltage than the External source.
If you use an Arduino MEGA 2560 you can switch between the internal 5V and internal 2.56V references.

johnwasser:
If you use an Arduino MEGA 2560 you can switch between the internal 5V and internal 2.56V references.

That was what I was assuming when I wrote it.*.

Other option would be to drop the input at pin 2 from 2,5V to 1,1V and use the internal ref.

  • I know, assumptions are the mother of all f*-ups

I'd be wondering about a circuit to switch the Ref pin between 2.5V and a z-state INPUT pin? Some way to fool the Ref pin?

Could the on-chip voltage comparator be used?