Hi all,
Working on a MEGA2560, and I would like to set the analog voltage range to 3.3V.
Related to this, the main page says:
http://arduino.cc/en/Main/ArduinoBoardMega2560:
... By default they measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin and analogReference() function.There are a couple of other pins on the board:
AREF. Reference voltage for the analog inputs. Used with analogReference().
Right .... And then, the analogReference
page says:
http://arduino.cc/en/Reference/AnalogReference:
Don't use anything less than 0V or more than 5V for external reference voltage on the AREF pin! If you're using an external reference on the AREF pin, you must set the analog reference to EXTERNAL before calling analogRead().
So, the way I'm reading this, AREF should be an input pin (in other words, Hi-Z/high-impedance pin), to which I should be able to bring some sort of a reference voltage source.
However, the problem is that AREF by default, constantly generates a 5V reference!
Ok, so then, I thought that the problem is with the analogReference
function, so in my code, I added first in setup
:
void setup()
{
// set up the analog reference pin;
analogReference(EXTERNAL);
...
.... and NOTHING happens - the AREF pin STILL generates +5V... How do I know this? Well, I made a small jumper that connects the Arduino 3V3 pin to AREF pin: and the 3V3 pin measures 3.3V when it is unconnected - but as soon as I connect it to the AREF pin, it is forced to 5V!!! I'm thinking, this cannot be good..
So will someone explain to me:
-
Obviously, the AREF pin behaves like a voltage source; is it supposed to behave like a Hi-Z input at times?
-
Is the
analogReference(EXTERNAL);
supposed to make the AREF pin behave like an input?
If I'm going completely wrong with the statements above - what would I need to do, in order to set the analog voltage range to the 3.3V that come out of the 3V3 pin of the Arduino?
Many thanks in advance for any answers,
Cheers!