6 years, 10 months ago.

What is the reference voltage used by mbed's AnalogIn()

Hi,

I think I understand that mbed's <code>AnalogIn()</code> uses a reference of 3.3V. Is that correct?

If so, is it possible to specify a different reference voltage when reading from an analog pin? I know, for instance, that Arduino has an interface accessible through <code>analogReference()</code> which allows modifying the reference voltage https://www.arduino.cc/en/Reference/AnalogReference to, among other options, an external reference. Can something similar be done using mbed?

To give more context to this question, here (https://learn.adafruit.com/tmp36-temperature-sensor/using-a-temp-sensor#getting-better-precision) is an interesting example that illustrates the potential usefulness in being able to specify the an external reference voltage. The example is with an Arduino Uno, and the goal is to get a more precise temperature reading from the TMP36 sensor, by measuring the actual input voltage to the sensor with a pin called AREF. Can something similar be achieve with ARM mbed devices? I am currently experimenting with the mDot https://developer.mbed.org/platforms/MTS-mDot-F411/#mdot-pinout-diagram

Thank you. :)

I did more research about the mDot and it turns out that its reference voltage for analog inputs is 3V. Here are two threads on MultiTech's developer forum on the topic:

- http://www.multitech.net/developer/forums/topic/what-is-the-reference-voltage-used-by-analogi-on-the-mdot/ - http://www.multitech.net/developer/forums/topic/analogin-from-mbed-lib/

posted by F A 13 Jun 2017

2 Answers

6 years, 10 months ago.

It depends on the target platform, it maybe just tied to VMCU, which means you wouldnt be able to set your own. There are plently of platform that expose this AREF pin :) one may suit your needs!

As far as API, no there is not any to change the reference.

Regards,

Andrea, team mbed

Accepted Answer
6 years, 10 months ago.

If you are using a Nucleo from ST then you can use the internal calibration to figure out what the external voltage is. If you're using something other than ST then I don't know if there is a way to determine AREF. You can always bring in a local copy of mbed code and modify the AREF settings yourself...