When using the arduino as a voltmeter AND using the Aref pin for accuracy, what should the circuit's path look like?
~I thought I would make an inquiry before experimenting to avoid doing anything foolish.
Say I want to measure line/signal voltage either to or from a component (similar to that carried on the third wire of a servo) and I know it is less than 5V (no resistance or division required for analog input).
I'm thinking that I would need to splice into or otherwise probe the line for a voltage to route to an analog input pin, then return (analog output pin) to the ground of that signal.
Now, what gets used as a voltage for Aref? Would it be the +voltage (Vn) before the load/impedance from which the signal originates? Or should the arduino use its own internal reference? is it possible for arduino to use an internal reference to measure an external voltage?
-All of these questions are basically asking: how is Aref pin properly applied to voltage measurement?
Typically you would:
1) Call analogReference(EXTERNAL) in setup() - very important to avoid burning out the chip...
2) Connect the external voltage reference to GND and AREF - these wires shouldn't be carry any significant current, note.
3) connect the signal lines to analog inputs.
The ADC outputs are then ratiometric (you don't care about absolute voltages, only the ratio between signal and AREF voltages).
So if you have a circuit where AREF is being driven from a voltage below the supply you must never upload a sketch that
calls analogRead() without calling analogReference(EXTERNAL) - otherwise you'll push a lot of current through a single
FET on the chip and may damage it. The first call to analogRead() by default will turn on this FET that connects Vcc to AREF,
unless you setup the analog reference as external.
You can add a 1k resistor between your reference voltage and AREF to protect against this failure mode, but you will lose
The other important caveat is to be very sure that the external reference to AREF can never exceed the Arduino supply by 0.5V
(say you power down the Arduino while that reference is still connected....). Adding a schottky diode between AREF and
Vcc can be a wise precaution (worst case the external supply will power the Arduino as well).