I want a reference analog voltage of 2.0 volts on a 3.3 V Arduino.
Since there is an internal resistance of 32k on the Arduino, I hooked up a 21k resistor to Vcc.
How can I confirm that I now have an analog voltage range from 0 to 2.0 V? Can I do this via code? Or just use a voltmeter?
-
\$\begingroup\$ It probably took longer to ask this than test it. If you are confident about the 32k internal (I'm not sure it will be reliable) use a voltmeter or use code. \$\endgroup\$Andy aka– Andy aka2013年08月06日 07:05:14 +00:00Commented Aug 6, 2013 at 7:05
-
\$\begingroup\$ The "32KΩ" number for the aRef impedance in the documentation is a number of things. First, you don't know if the 32K is the effective impedance to ground, VCC, or an unknown arbitrary voltage between the two. Second, the 32K number is a typical value, and I really really doubt that Atmel bother to make sure the aRef input is held to close tolerances between parts. You really are going to need a resistive divider at minimum, and a capacitor from the aRef pin to ground is a good idea. \$\endgroup\$Connor Wolf– Connor Wolf2013年08月07日 07:28:25 +00:00Commented Aug 7, 2013 at 7:28
1 Answer 1
With a sketch, read and print a known test voltage of a little bit less than your reference voltage, say 1.5V in this case. The printed result will be the same fraction of 1024 that your test voltage is of the reference voltage, or:
V_test x
------ = ----
V_ref 1024
1024
V_ref = ---- V_test
x
Edit: The intent here was to supply a presumed 2.0V external analog reference, say it's your 20K resistor. Now supply a known voltage of ~80% the 2V reference to one of the MCU's analog inputs. Run a sketch to print what the MCU reads as that voltage as. Calculate the actual analog reference voltage as I did above. If it is 2.0V, you're done.
This is how I'd make a 2.0V ARef. An AtMega328p's ARef only draws ~100μA at Vcc = 3.3V, so this should still be pretty close:
schematic
simulate this circuit – Schematic created using CircuitLab
As above, get A/D reading of the known voltage input and calculate what the reference voltage must be, to confirm it.
-
\$\begingroup\$ by test voltage you mean applying a response from my sensor device to attain that test voltage? \$\endgroup\$l3win– l3win2013年08月06日 17:02:51 +00:00Commented Aug 6, 2013 at 17:02
-
\$\begingroup\$ I'd make a known, constant voltage with a battery or a voltage divider from your Vcc. That way you can calculate what the reference voltage must be. \$\endgroup\$JRobert– JRobert2013年08月06日 18:09:30 +00:00Commented Aug 6, 2013 at 18:09
-
\$\begingroup\$ hmmm...I hooked a Voltmeter to GND and the AREF pin, but it still shows approximately 3.3 V with my 21k resistor between Vcc and AREF \$\endgroup\$l3win– l3win2013年08月06日 19:03:04 +00:00Commented Aug 6, 2013 at 19:03
-
\$\begingroup\$ The ARef input is high impedance so, yes, you shouldn't see much drop across the 21K. See my edited answer for creating the analog reference voltage and confirming it with a short sketch. \$\endgroup\$JRobert– JRobert2013年08月06日 20:32:46 +00:00Commented Aug 6, 2013 at 20:32
-
\$\begingroup\$ thx for your help JRobert. But what about the internal 32k resistance in the Aref pin? According to the text on analogreference arduino.cc/en/Reference/AnalogReference, I should be able to use only a single resistor (22k in my case) to convert to 2.0 V. In your schematic, won't the Aref voltage be dropped due to that internal 32 k resistor? \$\endgroup\$l3win– l3win2013年08月06日 21:39:34 +00:00Commented Aug 6, 2013 at 21:39