2

I'm using arduino for the first time and don't really understand what am I suppose to plug to the ADC refernce PIN... or if I even have to use it while plugging analog sensor to the arduino, thanks!

6

The AD converter in the ATMega microcontroller (as used in Arduino) converts an input voltage to a number.

This ADC happens to be 10 bit that means 2^10 states which is 1024.

The number 0 (zero) means 0 Volt input voltage.

The number 1023 means the maximum input voltage.

Since 0 is also a value the scale runs from 0 to 1023 making 1024 values.

The scale is linear so 511 means half of that maximum voltage.

What is this maximum input voltage?

That is the ADC Reference voltage. By default the power supply voltage is used so if you run your Arduino on 5 V, then 1023 = 5 V. But if you run your Arduino on 3.3 V, then 1023 = 3.3 V.

There is also in internal reference of 2.56 V (or 1.1 V depending on your Arduino), if you use that then, you guessed it, 1023 = 2.56 V (or 1.1V).

You might have a very fancy external reference voltage already available and if you want to use that, use the external setting and connect that reference voltage to the AREF pin.

If your analog sensor gives 0 to 5 V and your Arduino is also powered by 5 V then you should use the default setting so that the VCC is used as ADC reference.

If your sensor gives a voltage between 0 and 1 V then you could use the internal reference so that more of the 0 to 1023 range is usable. Giving you get better resolution.

2

The default behaviour is for the analog reference to be Vcc which on many Arduinos is 5V. In that case do not connect anything to AREF.

However if you have a precision voltage reference then you can connect that to AREF (and GND) and specify in your sketch, before doing an analogRead:

 analogReference (EXTERNAL);

I have a page about the ADC converter which may help explain, or may be too much detail. :)


or if I even have to use it while plugging analog sensor to the arduino

Unless you are planning to use some different reference voltage, don't use it at all.

For a 5V Arduino the voltage measured with the default AREF would roughly be 4.88 mV per unit of measurement (ie. 5V / 1024), but more accurately:

float voltage = ((float) rawADC  + 0.5 ) / 1024.0 * Vref;

The voltage you supply to VREF (if you supply any at all) must be between 1.0V and Vcc where Vcc would be 5V for an Arduino Uno.

  • do not connect anything to AREF” and “[call analogReference(EXTERNAL)] before doing an analogRead” (amphasis mine). These are very important points not mentioned in the other answers. – Edgar Bonet Dec 15 '17 at 8:52
  • I added the emphasis in my answer in case it was too mild as it was. ;) – Nick Gammon Dec 15 '17 at 10:36
1

Well, I think you should read the manual first before you use (and even perhaps brake it).

Generally speaking, analog reference is a voltage value between 0.00 and 5.00V, which will be used as virtual reference for all the analog inputs, you connect to your arduino board.

About analog reference is on Arduino site: https://www.arduino.cc/reference/en/language/functions/analog-io/analogreference/

1

The AREF is a reference voltage input pin.
The reference voltage is maximum voltage when you measure analog signal.
In other words, you can measure 0V ~ AREF voltage by using ADC port.

Be aware that the minimum voltage of AREF is 1.0V.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy