There are some interesting behaviours at the low end of a diode detector's response - but that's the subject for another day. Today, I want to focus on the analog to digital conversion to read the data into the micro-controller...
I have found that the 12-bit ADC in the Arduino DUE has rather poor linearity at the extremes of its range. As I'm interested in accurately converting very small voltages (in the 0.01V range) to get best accuracy and dynamic range from my diode detectors, this is a problem.
Specifically, the response of the ADC follows something like the following deliberately exaggerated characteristic in the sketch below.
Instead of a linear relationship between the applied voltage and the resulting code from the ADC, suggested by the dashed line in the sketch, there is instead something of a sigmoidal shape, as shown in blue. This indicates inaccuracy in the analog to digital converter integrated into the DUE's Atmel AVR SAM3X8E processor.
To get round this, I tried hooking up a simple 12-bit converter from Analog Devices - the AD7896 (which just happened to be in the "junk" box). The resulting lash-up is seen below...
I wrote some code to drive the external converter (a listing of the function is given below) and then set up a test in which both the external AD7896 and the SAM3X8E were set to convert the same analog voltage. The results were converted from a code into a voltage (in milliVolts), allowing the performance to be compared with the voltage as shown on an external meter.
The poor performance of the DUE's internal converter is seen in the following images, in which the ADC results are photographed from the little colour TFT screen seen in the bench shot above and compared with the voltages as measured on a voltmeter...
At voltages below about 10mV, the DUE returns a zero result (but the AD7896 works FB)...
At slightly higher applied voltages, the DUE at least produces a non-zero conversion result - but it is below the true voltage (as shown in the sigmoidal curve falling below the ideal linear dashed line in the sketch of the conversion characteristic, above). Once again, the Analog Devices converter does a good job...
The moral of this story - don't use the internal ADC of an Arduino DUE if you want accurately to measure voltages. My meter project just got a a little more complicated!
Interestingly, Tex Swann, g1tex, is talking about reading diode detector voltages into an Arduino (UNO) in the December number of Practical Wireless which was delivered to m0xpd yesterday - but he is more interested in large-signal behaviour.
...-.- de m0xpd
No comments:
Post a Comment