3.3V sensor (outputting 0.2V to 1.5V peak-to-peak to A0) powered from µC 3.3V output pin
µC Aref pin connected to µC 3.3V output pin
analogReference(EXTERNAL); in setup()
A0 output well biased on 1.65V (sensor Vcc/2), but resolution too low for my liking
As before, but
µC Aref pin now connected to centre of 18Ω/27Ω (1% type) voltage divider (voltage divider input 3.3V from µC 3.3V output pin) outputting 1.98V to µC Aref pin, checked with DMM
I always upload code with analogReference(EXTERNAL); in setup() before connecting a voltage source to the Aref pin. The Metro Mini is all right, Aref 3.3V works.
I think I got it. The sensor outputs Vcc/2, and that is the bias voltage of 1.65V, plus whatever the sensor outputs on top. And with 1.98V at Aref from the voltage divider, what I did can't work. I think that's the right interpretation?
If your sensor outputs 0.2V to 1.5V p-p and it centered on 1.65V, then it goes from 1V to 2.3V.
So setting Vref to 2.5V with a voltage reference, will give you a little more resolution but if you want the full 12 bit range you will need to scale and offset the sensor signal using opamps.
Thanks, I should try 2.5V Aref to find out how much better that is than using 3.3V. The Metro Mini's ADC is only 10-bit. I should try the Adafruit Feather M4 next. It features two 12-bit ADCs. Faster processor also.
That won't help any.
If you want to make use of the full resolution of the ADCs, you need to scale and offset your 1V-2.3V sensor output so thta it goes from 0V to 5V
Stop using those crazy low resistances.
The way to reduce Aref for a 328 is to use a single resistor, not a voltage divider.
Aref impedance according to the Atmega datasheet is 32k, so using a 33k resistor between the 3.3volt pin and the Aref pin will set Aref to about 1.65volt.
Bias your sensor input to half of that, with a voltage divider powered from the 3.3volt pin.
Leo..
According to Arduino: Don’t use anything less than 0V or more than 5V for external reference voltage on the AREF pin!
If, instead of outputting 3.3V to the Aref pin, one outputs 2.5V to the Aref pin, that makes no difference. After all, being able to input a voltage below 5V is the reason for the Aref pin's existence in the first place. Where the voltage that is output to the Aref pin comes from - from a dynamo, battery, LM4040, or a voltage divider somewhere else, is irrelevant. Important is that the voltage is constant (which is why dynamos or batteries are not a good idea).
Not correct. Safe range is -0.3volt to "VCC+0.3volt". Important to keep that in mind during bootup and shutdown. Still baffles me why you used 18/27 ohm for that divider. That makes mistakes more deadly. IIRC the datasheet recommends a minimum 5k6 impedance on the Aref pin.
Leo..
So, what you mean is that the official Arduino documentation is wrong? Then, why are 3.3V Aref correct and 2.5V Aref not correct yet 1.1V Aref correct? Is there some kind of "voltage valley of death"? Isn't the whole purpose of the Aref pin to feed reference voltages below 5V to it? What would be the difference between using an 18Ω/27Ω divider (from 3.3V) to deliver 2.5V and a 2.7Ω/2.7Ω divider (from 5V) to deliver 2.5V and an LM4040 (from 5V) to deliver 2.5V? I tried all three solutions now, and the values I obtain from A0 are just the same, with all three Metro Minis alive and well, neither belching fumes or smelling a wee bit funny.
That statement is IMHO over-simplified, assuming VCC is always 5volt.
But it seems you understand that any pin of the MCU has to stay within the limits of VCC/GND.
With those low values you only put an extra load on the tiny 3.3volt regulator,
which is not needed if you use higher values.
Aref should work with any voltage between 1volt and VCC.
If 2.5volt is not working, then you should check your wiring.
The first one and the last one turns it into an absolute A/D, the second one into a ratiometric A/D.
Which way you should choose depends on sensor output type.
Leo..
Thanks; 2.5V Aref is working well with all three solutions, as far as the voltage output to A0 is concerned. The values obtained are just the same, and the resolution noticeably better than the 3.3V Aref based solution. In the end, I will stick to the precision reference LM4040 (TO-92 variant) 2.5V based solution.