# Can I use an ADC pin as AREF?

simulate this circuit – Schematic created using CircuitLab

I'm using the A9 module from Ai-Thinker in a logger project. It has 2 ADC pins and I need to measure 2 analog inputs (not at the same time) from my 2 sensors. Right now I'm prototyping with an Arduino Uno and an A6 module. I'm using the Arduino AREF pin to get accurate measurments from my sensor.

If I would move on to the A9 module then if and how could I use one of those ADCs as an AREF? For the sensors I would use just one of those ADCs and a multiplexer.

If anyone could suggest an even simpler way of doing what I need then I would be grateful.

I added a circuit, I did the best I could, don't hate, I'm not an electrical engineer.

• How are you using AREF with your sensor? It's probably better to draw s schematic diagram than to try to describe it. There's a circuit editor built in to the question editor that you can use if you are on a PC. It doesn't work on phones or tablets, though. – JRE Feb 27 '20 at 13:27
• I added a schematic, I hope you can understand it. – Tostuk Feb 27 '20 at 14:06
• @Tostuk your schematics would be much easier to understand if you followed a convention of drawing GND at the bottom and aligning two resistors (in your case a resistor and thermistor) of voltage divider as vertical column – Maple Feb 27 '20 at 15:11

According to this the ADC input on A9 module supports 0~1.8V voltage. There is no AREF pin on the pinout diagram, which means the module uses 3.5~4.2V power supply to derive 1.8V reference internally.

You have to supply stable power to voltage dividers and calculate fixed resistors so that when thermistor is at its highest resistance the voltage from the divider does not exceed 1.8V.

Note, that if your power source is not stabilized (e.g. direct connection to lithium battery) then the ADC readings will drift with battery discharge.

However there is a (very slim) chance that the module uses ratiometric reference voltage, i.e. voltage that changes with power supply, in which case your voltage dividers can be connected directly to module supply.

I would suggest connecting dividers directly to VCC first and taking experimental ADC readings at same temperature and different VCC voltages. If you see big difference then you would need to stabilize divider supply.

• Some of the GPIOs of the A9 board can supply 1.9V. Would that be an acceptable and a stable power source for the thermistors, if I would get it down to 1.8V first? – Tostuk Feb 27 '20 at 19:41
• Technically you can configure GPIO as digital output, set it to "1" and use as power source for your voltage dividers. With an added benefit that you can switch it off when not reading the sensors and save power. However you have to figure out yourself how stable the output voltage is and how much current you can source from the pin(s). I could not find that information right away. If they are typical CMOS outputs then Voh usually depends on supply or I/O voltage (if separate). But in this case they seem to have additional configuration options – Maple Feb 27 '20 at 21:14

Are you familar with what Aref even is? Either I misunderstand your question or we should explain the basics to begin with.

An ADC is comparing the input voltage with a reference voltage and gives the proportion of this as a digital output: $$ADC-Code = \frac{V_{in}}{V_{ref}} * 2^{n-1}$$ , with n beeing the resolution of the ADC in bits.

This reference voltage is supplied to the ADC inside the Arduino-µC by the Aref pin. In your schematic it is connected to 3.3V, which is totaly fine. It means, that the maximum code your ADC can give you as digital output corresponds to an input voltage of 3.3V.
Your thermistors build a voltage divider with the $$\10k\Omega\$$ resistors. This voltage divider is also fed by the same voltage as the analog reference voltage. This makes sense, because noise on the supply voltage will be present in the signal as well as in the reference - so the ADC conversion will not be affected by that noise. If you have a clean power supply or you don't measure with high resolution this is not absolutely necessary.