problem while using analog input on arduino with version C5.4.0.4 (by Moez )
Hi all
I have a problem when I use the analog input of the arduino nano card. the result of the conversion is a fixed value whatever the voltage applied to the input (the version used is c5.4.0.4). using the c2.2 version I have no problem. the new version has two parameters for the analog input destination and REFS. what should we put in REFS (the default value is 0)?
problem while using analog input on arduino with version C5.4.0.4 (by DanielH)
@Moez
From ATmega 328P datasheet:
Voltage Reference Selections for ADC ADMUX register (0x7C) REFS1 REFS0 (2 bits)
0 0 - AREF, Internal VREF turned off: LDmicro REFS = 0
0 1 - AVCC with external capacitor at AREF pinf: LDmicro REFS = 1
1 0 - RESERVED: LDmicro REFS = 2
1 1 - Internal 1.1V Voltage Reference with external capacitor at AREF pin: LDmicro REFS = 3
If you are using AVCC (5V on Arduino Mega 328P) as reference, you must set REFS = 1.
REFS = 1 is equivalent to analogReference(DEFAULT) on Arduino IDE.
Use a LC network powering AVCC circuit: 10mH inductor (choke) between VCC and AVCC, and a 100 nF capacitor between AVCC and ground, to better cancel noise.
If you are using AREF and an external voltage (0 to 5V) as reference, you must set REFS = 0.
REFS = 0 is equivalent to analogReference(EXTERNAL) on Arduino IDE.
Keep analog signal paths as short as possible. Make sure analog tracks run over the ground plane, and keep them well away from high-speed switching digital tracks.
Best regards,
DanielH