I'm trying to get stable analog readings with a SAMD21 (currently prototyping with a MKRZero but I'll be making a custom board). I've noticed that applying a stable reference voltage to the AREF pin stabilizes my readings noticeably even when I don't tell it to use the external reference.
Could someone tell me why this is the case? I'd rather not have to use an external reference because I'm reading 3.3v sensors and don't want to limit their range, but I'm happy with the stability that comes from applying a stable voltage to AREF without actually using it as a reference. Adding a capacitor between AREF and ground doesn't seem to be as effective.
My goal is to take a reading in 30 uS with jitter of no more than 1-2 significant bits using 10-bit resolution. This is easy with an AVR, but seems very challenging with an ARM.
The SAMD21 actually doesn't have a 3.3V reference as such, even though the Arduino documentation states that AR_DEFAULT is 3.3V, this is because the maximum analog reference voltage must not exceed VDDANA (analog supply voltage) - 0.6V.
To overcome this limitation the SAMD21 Arduino core code sets the on-chip ADC's gain to 0.5 and then compares the attenuated input signal against an internal 1.65V reference instead, (derived from VDDANA at 3.3V and internally divided).
The reason why the default analog reference isn't super precise, is because its derived from the board's 3.3V regulator, which in the case of the MKRZero can vary by around ±2%. In order to generate more precise reference, you'll need to use an external precision voltage reference with an output no greater than VDDANA - 0.6V, or in the case of the MKRZero: 3.3V - 0.6V = 2.7V.
By the way, more information on connecting an external analog reference can be found on the Arduino website below, including the warning about ensuring that you activate the reference before calling the analogRead() function:
Thanks for this information. I'm using a 2.048V external precision reference. From your description of how the default settings works I was able to use the external reference and set the gain to DIV2 in order to read the full output range from my sensors (though the resolution is slightly lower). I assume if I used an external 1.65V reference with DIV2 then I would get the full range and full resolution.
Do you have any idea why applying the reference voltage to AREF stabilizes my readings even if I don't tell it to use the external reference?
It's likely that applying a voltage to the AREF pin affects the reference voltage of the ADC's sampling capacitor, irrespective of the selected AREF source:
Other factors, such as a high source resistance at the ADC's input can also affect the measured voltage, because if the sample rate is too fast, the sample capacitor won't have enough time to charge.
Okay, thanks! I've tried readings sources with various impedance as well as different settings for sampling rate, and precision external reference is the main thing I've found that really reduces the noise.
To make sure I understand this correctly, the only way I can make use of the full range of my sensors and maintain full ADC resolution would be to use an external reference of 1.65V and divide by two in the hardware, correct? It seems that with any other reference voltage I would either lose sensor range (by clipping the upper end) or lose resolution (by not being able to read the whole 3.3V range). I'm surprised to see that there's only one reference IC that I can find that has a voltage of 1.65V, because it seems like this would be a common practice.