Hide minor edits - Show changes to markup
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.
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(). Otherwise, you will short together the active reference voltage (internally generated) and the AREF pin, possibly damaging the microcontroller on your Arduino board.
After changing the analog reference, the first few readings from analogRead() may not be accurate.
type: which type of reference to use (DEFAULT, INTERNAL, or EXTERNAL).
type: which type of reference to use (DEFAULT, INTERNAL, INTERNAL1V1, INTERNAL2V56, or EXTERNAL).
Configures the reference voltage used for analog input. The analogRead() function will return 1023 for an input equal to the reference voltage. The options are:
Configures the reference voltage used for analog input (i.e. the value used as the top of the input range). The options are:
It is a good idea to connect external voltages to the AREF pin through a 5K resistor. This will prevent possible internal damage to the Atmega chip if analogReference() software settings are incompatible with the current hardware setup. 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.2V at the AREF pin.
Connecting external voltages through a resistor makes it possible to switch the AREF voltage on the fly, say from the 5 volt DEFAULT setting, to a 3.3 volt EXTERNAL setting (and applied voltage), without the hardware setup affecting either ADC configuration.
The voltage applied to the AREF pin directly governs the ADC and sets the voltage at which the ADC will report its highest reading, 1023. Lower voltages applied to ADC (analog) pins will be scaled proportionally, so at the DEFAULT setting (5 volt internal connection), 2.5 volts on an analog pin will report approximately 512.
The default configuration on all Arduino implementations is to have nothing connected externally to the AREF pin (Atmega pin 21). In this case the DEFAULT analogReference software setting connects the AVCC voltage, internally, to the AREF pin. This appears to be a low impedance connection (high current) and voltages, other than AVCC, applied (erroneously) to the AREF pin in the DEFAULT setting could damage the ATMEGA chip.
The AREF pin may also be connected internally to an (internal) 1.1 volt source (or 2.56 on the ATmega8) with analogReference(INTERNAL). With this setting voltages applied to the ADC (analog) pins that are at or above the reference will report 1023 when read with analogRead. Lower voltages will report proportional values, so 0.55 volts will report about 512.
The connection between the 1.1 volt source and the AREF pin is a very high impedance (low current) connection, so that reading the 1.1 (internally supplied) voltage at the AREF pin may only be done with a more expensive, high-impedance multimeter. An external voltage applied (erroneously) to AREF pin while using the INTERNAL setting will not damage the chip, but will totally override the 1.1 volt source, and ADC readings will be governed by the external voltage. It is still desirable to connect any external voltage to the AREF pin however, through a 5K resistor to avoid the problem cited above.
The correct software setting for using the AREF pin with an external voltage is analogReference(EXTERNAL). This disconnects both of the internal references and the voltage applied externally to the AREF pin sets the reference voltage for the ADC.
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.
It is a good idea to connect external voltages to the AREF pin through a 5K resistor. This will prevent possible internal damage to the Atmega chip if analogReference() software settings are incompatible with the current hardware setup. Connecting external voltages through a resistor also make it possible to switch the AREF voltage on the fly, say from the 5 volt DEFAULT setting, to a 3.3 volt EXTERNAL setting (and applied voltage), without the hardware setup affecting either ADC configuration.
It is a good idea to connect external voltages to the AREF pin through a 5K resistor. This will prevent possible internal damage to the Atmega chip if analogReference() software settings are incompatible with the current hardware setup. 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.2V at the AREF pin.
Connecting external voltages through a resistor makes it possible to switch the AREF voltage on the fly, say from the 5 volt DEFAULT setting, to a 3.3 volt EXTERNAL setting (and applied voltage), without the hardware setup affecting either ADC configuration.
The default configuration on all Arduino implementations is to have nothing connected externally to the AREF pin (Atmega pin 21). In this case the DEFAULT analogReference software setting connects the AVCC voltage, internally, to the AREF pin. This appears to be a low impedance connection (high current) and voltages, other than AVCC, applied (erroneously) to the AREF pin in the DEFAULT setting could damage the ATMEGA chip. For this reason, connecting external voltages to the AREF pin through a 5K resistor is a good idea.
The AREF pin may also be connected internally to an (internal) 1.1 volt source with analogReference(INTERNAL). With this setting voltages applied to the ADC (analog) pins that are 1.1 volts (or higher) will report 1023, when read with analogRead. Lower voltages will report proportional values, so .55 volts will report about 512.
The default configuration on all Arduino implementations is to have nothing connected externally to the AREF pin (Atmega pin 21). In this case the DEFAULT analogReference software setting connects the AVCC voltage, internally, to the AREF pin. This appears to be a low impedance connection (high current) and voltages, other than AVCC, applied (erroneously) to the AREF pin in the DEFAULT setting could damage the ATMEGA chip.
The AREF pin may also be connected internally to an (internal) 1.1 volt source (or 2.56 on the ATmega8) with analogReference(INTERNAL). With this setting voltages applied to the ADC (analog) pins that are at or above the reference will report 1023 when read with analogRead. Lower voltages will report proportional values, so 0.55 volts will report about 512.
It is a good idea to connect external voltages to the AREF pin through a 5K resistor. This will prevent possible internal damage to the Atmega chip if analogReference() software settings are incompatible with the current hardware setup.
It is a good idea to connect external voltages to the AREF pin through a 5K resistor. This will prevent possible internal damage to the Atmega chip if analogReference() software settings are incompatible with the current hardware setup. Connecting external voltages through a resistor also make it possible to switch the AREF voltage on the fly, say from the 5 volt DEFAULT setting, to a 3.3 volt EXTERNAL setting (and applied voltage), without the hardware setup affecting either ADC configuration.
The default configuration on all Arduino and Freeduino implementations is to have nothing connected externally to the AREF pin (Atmega pin 21). In this case the DEFAULT analogReference software setting connects the AVCC voltage, internally, to the AREF pin. This appears to be a low impedance connection (high current) and voltages, other than AVCC, applied (erroneously) to the AREF pin in the DEFAULT setting could damage the ATMEGA chip. For this reason, connecting external voltages to the AREF pin through a 5K resistor is a good idea.
The default configuration on all Arduino implementations is to have nothing connected externally to the AREF pin (Atmega pin 21). In this case the DEFAULT analogReference software setting connects the AVCC voltage, internally, to the AREF pin. This appears to be a low impedance connection (high current) and voltages, other than AVCC, applied (erroneously) to the AREF pin in the DEFAULT setting could damage the ATMEGA chip. For this reason, connecting external voltages to the AREF pin through a 5K resistor is a good idea.
The AREF pin may also be connected internally to an internal 1.1 volt source with analogReference(INTERNAL). With this setting voltages applied to the ADC (analog) pins that are 1.1 volts (or higher) will report 1023, when read with analogRead. Lower voltages will report proportional values, so .55 volts will report about 512.
The connection between the 1.1 volt source and the AREF pin is a very high impedance (low current) connection, so that reading the 1.1 (internally supplied) voltage at the AREF pin may only be done with a more expensive, high-impedance multimeter. An external voltage applied (erroneously) to AREF pin while using the INTERNAL setting will not damage the chip, but will totally override the 1.1 volt source, and ADC readings will be governed by the external voltage. It is still desirable to connect any external voltage to the AREF pin through a 5K resistor to avoid the problem cited above.
The correct software setting for using the AREF pin is analogReference(EXTERNAL). This disconnects both of the internal references and the voltage applied externally to the AREF pin sets the reference voltage for the ADC.
The AREF pin may also be connected internally to an (internal) 1.1 volt source with analogReference(INTERNAL). With this setting voltages applied to the ADC (analog) pins that are 1.1 volts (or higher) will report 1023, when read with analogRead. Lower voltages will report proportional values, so .55 volts will report about 512.
The connection between the 1.1 volt source and the AREF pin is a very high impedance (low current) connection, so that reading the 1.1 (internally supplied) voltage at the AREF pin may only be done with a more expensive, high-impedance multimeter. An external voltage applied (erroneously) to AREF pin while using the INTERNAL setting will not damage the chip, but will totally override the 1.1 volt source, and ADC readings will be governed by the external voltage. It is still desirable to connect any external voltage to the AREF pin however, through a 5K resistor to avoid the problem cited above.
The correct software setting for using the AREF pin with an external voltage is analogReference(EXTERNAL). This disconnects both of the internal references and the voltage applied externally to the AREF pin sets the reference voltage for the ADC.
The default configuration on all Arduino and Freeduino implementations is to have nothing connected externally to the AREF pin (Atmega pin 21). In this case the DEFAULT analogReference software setting connects the AVCC voltage, internally, to the AREF pin. This appears to be a low impedance connection (high current) and voltages, other than AVCC, applied (erroneously) to AREF pin in the DEFAULT setting could damage the ATMEGA chip. For this reason, connecting external voltages to the AREF pin through a 5K resistor is a good idea.
The default configuration on all Arduino and Freeduino implementations is to have nothing connected externally to the AREF pin (Atmega pin 21). In this case the DEFAULT analogReference software setting connects the AVCC voltage, internally, to the AREF pin. This appears to be a low impedance connection (high current) and voltages, other than AVCC, applied (erroneously) to the AREF pin in the DEFAULT setting could damage the ATMEGA chip. For this reason, connecting external voltages to the AREF pin through a 5K resistor is a good idea.
The default configuration on all Arduino and Freeduino implementations is to have nothing connected externally to the AREF pin (Atmega pin 21). In this case the DEFAULT analogReference software setting connects the AVCC voltage, internally, to the AREF pin. This appears to be a low impedance conncetion (high current) and voltages, other than AVCC, applied to AREF pin in the DEFAULT setting could damage the ATMEGA chip. For this reason, connecting external voltages to the AREF pin through a 5K resistor is a good idea.
The default configuration on all Arduino and Freeduino implementations is to have nothing connected externally to the AREF pin (Atmega pin 21). In this case the DEFAULT analogReference software setting connects the AVCC voltage, internally, to the AREF pin. This appears to be a low impedance connection (high current) and voltages, other than AVCC, applied (erroneously) to AREF pin in the DEFAULT setting could damage the ATMEGA chip. For this reason, connecting external voltages to the AREF pin through a 5K resistor is a good idea.
The connection between the 1.1 volt source and the AREF pin is a very high impedance (low current) connection, so that reading the 1.1 (internally supplied) voltage at the AREF pin may only be done with a more expensive, high-impedance multimeter. An external voltage applied to AREF pin in this setting will not damage the chip, but will totally override the 1.1 volt source, and ADC readings will be governed by the external voltage.
The connection between the 1.1 volt source and the AREF pin is a very high impedance (low current) connection, so that reading the 1.1 (internally supplied) voltage at the AREF pin may only be done with a more expensive, high-impedance multimeter. An external voltage applied (erroneously) to AREF pin while using the INTERNAL setting will not damage the chip, but will totally override the 1.1 volt source, and ADC readings will be governed by the external voltage. It is still desirable to connect any external voltage to the AREF pin through a 5K resistor to avoid the problem cited above.
The correct software setting for using the AREF pin is analogReference(EXTERNAL). This disconnects both of the internal references and the voltage applied externally to the AREF pin sets the reference voltage for the ADC.
The voltage applied to the AREF pin directly governs the ADC and sets the voltage at which the ADC will report its highest reading, 1023. Lower voltages applied to ADC (analog) pins will be scaled proportionally, so 2.5 volts on an analog pin will report approximately 512.
The default configuration on all Arduino and Freeduino implementations is to have nothing connected externally to the AREF pin (Atmega pin 21). In this case the DEFAULT analogReference software setting connects the AVCC voltage, internally, to the AREF pin. This appears to be a low impedance conncetion (high current) and other voltages applied to AREF pin in the default setting could damage the ATMEGA chip.
The AREF pin may also be connected internally to an internal 1.1 volt source with analogReference(INTERNAL). With this setting voltages at the analog pins that are 1.1 volts (or higher) will report 1023, when read with analogRead. Lower voltages will report proportional values, so .55 volts will report about 512.
The connection between the 1.1 volt source and the AREF pin is a very high impedance (low current) connection, so that reading the (internal) voltage at the AREF pin may only be done with a more expensive, high-impedance multimeter. An external voltage applied to AREF pin in this setting will not damage the chip, but will totally override the 1.1 volt source, and the analog readings will be governed by the external voltage.
The voltage applied to the AREF pin directly governs the ADC and sets the voltage at which the ADC will report its highest reading, 1023. Lower voltages applied to ADC (analog) pins will be scaled proportionally, so at the DEFAULT setting (5 volt internal connection), 2.5 volts on an analog pin will report approximately 512.
The default configuration on all Arduino and Freeduino implementations is to have nothing connected externally to the AREF pin (Atmega pin 21). In this case the DEFAULT analogReference software setting connects the AVCC voltage, internally, to the AREF pin. This appears to be a low impedance conncetion (high current) and voltages, other than AVCC, applied to AREF pin in the DEFAULT setting could damage the ATMEGA chip. For this reason, connecting external voltages to the AREF pin through a 5K resistor is a good idea.
The AREF pin may also be connected internally to an internal 1.1 volt source with analogReference(INTERNAL). With this setting voltages applied to the ADC (analog) pins that are 1.1 volts (or higher) will report 1023, when read with analogRead. Lower voltages will report proportional values, so .55 volts will report about 512.
The connection between the 1.1 volt source and the AREF pin is a very high impedance (low current) connection, so that reading the 1.1 (internally supplied) voltage at the AREF pin may only be done with a more expensive, high-impedance multimeter. An external voltage applied to AREF pin in this setting will not damage the chip, but will totally override the 1.1 volt source, and ADC readings will be governed by the external voltage.
It is a good idea to connect external voltages to the AREF pin through a 5K resistor. This will prevent possible internal damage to the Atmega chip if analogReference() software settings are incompatible with the current hardware setup.
The default configuration on all Arduino and Freeduino implementations is to have nothing connected externally to the AREF pin (Atmega pin 21). In this case the DEFAULT analogReference software setting connects the AVCC voltage, internally, to the AREF pin.
The default configuration on all Arduino and Freeduino implementations is to have nothing connected externally to the AREF pin (Atmega pin 21). In this case the DEFAULT analogReference software setting connects the AVCC voltage, internally, to the AREF pin. This appears to be a low impedance conncetion (high current) and other voltages applied to AREF pin in the default setting could damage the ATMEGA chip.
The connection between the both of the internal connections and the AREF pin is a very high resistance (impedance) connection, so that reading the voltage at the AREF pin may only be done with a more expensive high impedance multimeter.
A voltage connected to the AREF pin, externally, will override either of the
The connection between the 1.1 volt source and the AREF pin is a very high impedance (low current) connection, so that reading the (internal) voltage at the AREF pin may only be done with a more expensive, high-impedance multimeter. An external voltage applied to AREF pin in this setting will not damage the chip, but will totally override the 1.1 volt source, and the analog readings will be governed by the external voltage.
It is a good idea to connect the external analog reference voltage to the AREF pin through a 1k resistor. This will prevent inadvertent short circuits caused because the pin defaults to an internal connection to 5 volts. This is a low impedance connection meaning that a short circuit to another voltage will draw significant current and possibly damage the analog system in the chip.
The voltage applied to the AREF pin directly governs the ADC and sets the voltage at which the ADC will report its highest reading, 1023. Lower voltages applied to ADC (analog) pins will be scaled proportionally, so 2.5 volts on an analog pin will report approximately 512.
The default configuration on all Arduino and Freeduino implementations is to have nothing connected externally to the AREF pin (Atmega pin 21). In this case the DEFAULT analogReference software setting connects the AVCC voltage, internally, to the AREF pin.
The AREF pin may also be connected internally to an internal 1.1 volt source with analogReference(INTERNAL). With this setting voltages at the analog pins that are 1.1 volts (or higher) will report 1023, when read with analogRead. Lower voltages will report proportional values, so .55 volts will report about 512.
The connection between the both of the internal connections and the AREF pin is a very high resistance (impedance) connection, so that reading the voltage at the AREF pin may only be done with a more expensive high impedance multimeter.
A voltage connected to the AREF pin, externally, will override either of the
It is a good idea to connect the external analog reference voltage to the AREF pin through a 5k resistor. This will prevent inadvertent short circuits caused because the pin defaults to an internal connection to 5 volts. This is a low impedance connection meaning that a short circuit to another voltage will draw significant current and possibly damage the analog system in the chip.
It is a good idea to connect the external analog reference voltage to the AREF pin through a 1k resistor. This will prevent inadvertent short circuits caused because the pin defaults to an internal connection to 5 volts. This is a low impedance connection meaning that a short circuit to another voltage will draw significant current and possibly damage the analog system in the chip.
It is a good idea to connect the external analog reference voltage to the AREF pin through a 1k resistor. This will prevent inadvertent short circuits caused because the pin defaults to an internal connection to 5 volts. This is a low impedance connection meaning that a short circuit to another voltage will draw significant current and possibly damage the analog system in the chip.
It is a good idea to connect the external analog reference voltage to the AREF pin through a 5k resistor. This will prevent inadvertent short circuits caused because the pin defaults to an internal connection to 5 volts. This is a low impedance connection meaning that a short circuit to another voltage will draw significant current and possibly damage the analog system in the chip.
Be sure to call analogReference() with the value that corresponds to the physical configuration of your board. In particular, if you have a voltage other than 5V connected to the AREF pin, you must call analogReference(EXTERNAL) before any calls to analogRead(). If the analog reference is at the default value of 5V or at the internal reference, that voltage will be applied to the AREF pin, creating a short with the externally-supplied voltage.
It is a good idea to connect the external analog reference voltage to the AREF pin through a 1k resistor. This will prevent inadvertent short circuits caused because the pin defaults to an internal connection to 5 volts. This is a low impedance connection meaning that a short circuit to another voltage will draw significant current and possibly damage the analog system in the chip.
Be sure to call analogReference() with the value that corresponds to the physical configuration of your board. In particular, if you have a voltage other than 5V connected to the AREF pin, you must call analogReference(EXTERNAL) before any calls to analogRead(). If the analog reference is at the default value of 5V or at the internal reference, that voltage will be applied to the AREF pin, creating a short with the externally-supplied voltage.
Configures the reference voltage used for analog input. The analogRead() function will return 1023 for an input equal to the reference voltage. The options are:
type: which type of reference to use (DEFAULT, INTERNAL, or EXTERNAL).
None.