Analog reference setting

Do you do this once in a stand alone program to set the chip or once each time when you run the program.

analogReference(DEFAULT)

The default setting for analogReference is DEFAULT. If you never change it, you never have to change it back.

The default setting is assumed every time the Arduino starts. If you need to change it, it needs to be part of the sketch that is running.

Before reading through the manual completely, I added a pot to my board thinking that it was for a simulated analog input. From then on, all I got was 1023 from all the analog inputs.

I removed the pot - added the DEFAULT setting, it started working. It looks like the Aref signal I gave it messed up it up.?

I added a pot to my board thinking that it was for a simulated analog input

That doesn't make a great deal of sense; can you expand a little?

I'm using an SB freeduino board. It has a position for a pot. The pot is actually to set AREF and it is not for analog simulation. Possibly taking Aref from 0 volts to 5v reset the internal reference.

PS resetting the chip did not restore the internal Analog reference.

This discussion sounds extremely dangerous. The AREF is internally connected to the used reference voltage, be it AVcc or 1.1V if those options have been selected. In that cases, a decoupling condensor is strongly recommmended, and one of the awkwardnesses of the Arduino is, that it does not provide this. Only - ond only - in the case of selected external reference voltage may a voltage be applied to this pin! It will definitely do harm otherwise when the involved current from that source exceeds some uA!

In that cases, a decoupling condensor

A what?

Sorry - it's late again... The English speaking world calls this capacitors, for unclear reasons... Something of 10 to 100nF between Aref and GND.

Which wouldn't really protect anything...you'd also want a resistor between the external voltage and AREF.

This is not meant as a protection but as a means to reduce noise.

There are good reasons for NOT putting 1MOhms resistors in front of every pin, which would be a nearly bulllet proof protection for most electrical issues :-)

But there are situations where the hobbydesigner is aware that he shoud care and where he is not. The Aref is such a case, as this thread proves again. A 10nF capacity between Aref and ground would have done no harm and a lot of good....

The Aref is such a case, as this thread proves again. A 10nF capacity between Aref and ground would have done no harm and a lot of good....

Well I read a posting around here lately where a cap on Aref to ground slowed the A/D conversion sufficiently enough to cause accuracy errors when switching reference sources and then reading analog inputs. Forget the details but it should be researched and dealt with in one's software.

Also there is the caution in the Arduino reference section about how to wire external voltages to Aref:

Warning If you're using an external reference voltage (applied to the AREF pin), you must set the analog reference to EXTERNAL before calling analogRead(). Otherwise, you will short together the active reference voltage (internally generated) and the AREF pin, possibly damaging the microcontroller on your Arduino board.

Alternatively, you can connect the external reference voltage to the AREF pin through a 5K resistor, allowing you to switch between external and internal reference voltages. Note that the resistor will alter the voltage that gets used as the reference because there is an internal 32K resistor on the AREF pin. The two act as a voltage divider, so, for example, 2.5V applied through the resistor will yield 2.5 * 32 / (32 + 5) = ~2.2V at the AREF pin.

Lefty