multiplying it by “1.” This eliminates any miscalculation
error. I use the serial monitor to read the measured
voltage on each channel. I connected all four of the ADC
inputs together, then to a ground connection, and then to
the 2.500V reference on the DAS.
When grounded, the measured voltages in the four
channels ranged from - 3. 7 mV to 7. 5 mV. This is a range
of about 10 mV above zero.
When connected to the 2.500V reference, the
voltages on the four channels ranged from 2.469V to
2.454V. This is a variation between channels of 15 mV
with an absolute accuracy about 2%. We may have
voltage values reading to 0.15 mV precision, but the
accuracy is only to the nearest +/50 mV.
With a simple calibration process, we can do much
better.
Calibration
I assume a simple linear connection between the
ADU value from the ADC and the voltage it corresponds
to. By applying two different well-known voltages (Vref_hi
and Vref_lo) and recording the ADU value of each (adu_hi
and adu_lo), I can build a simple calibration equation to
convert any ADU value into the voltage value. The
V = V0 + aduValue x Volts_per_adu
I calculate the slope term, Volts_per_adu, from:
The intercept term, V0, I calculate from:
V0 = Vref_hi – Volts_per_adu x adu_hi
The two reference voltages I use in the calibration
are inputs grounded, with 0V and inputs connected to
the 2.500V reference.
For each channel, I measure the ADU value at the
two voltages and store these in the sketch. Whenever I
want to record a calibrated voltage, I use these
correction factors and this conversion equation.
After calibration, the absolute accuracy of the
voltage recorded is within 1 mV of 2.500V — the limit to
the accuracy of the reference voltage. This is now better
than 0.1% absolute accuracy.
Getting Data into Excel
Back in June 2015, I wrote an article in Nuts & Volts
about using the free tool, PLX-DAQ to suck data from the
serial port directly into Excel. This tool was originally
written for a Parallax microcontroller, but surprisingly,
worked for the Uno. It opened up the use of the Arduino
as a real scientific data acquisition instrument. Once into
Excel, we can apply the power of this program to display
and analyze the real world measurements (see Resource 7).
Unfortunately, I could not get PLX-DAQ to work with
the Due. The reset command never got sent to the Due,
so it never heard the command to send the data on the
serial port. I had come so close to having a really cool
data acquisition system using a high performance
microcontroller, a souped-up ADC, and the simple yet
powerful Excel for data analysis. Unfortunately, I couldn’t
get the data into Excel.
Again, I looked over dozens of forums about using the
Due and finally, after days of hunting and just about giving
up, I found one obscure forum where the solution was
posted (see Resource 8). Even now, this link is difficult to
find using a Google search, knowing what search terms to
use. Its buried in the 758 items returned. Thanks to the
heroic efforts of Jonathan Arndt (also known as NetDevil),
we now have a freeware tool which works as an open
source macro in Excel to read data correctly formatted on
the serial port and parse it directly into an Excel
spreadsheet. He’s labeled it as PLX-DAQ v2.9.
I can build a simple graph to display the data, and
after it is brought in, push the calculate button and there is
my data — plotted up (see Figure 5).
One problem is that the serial port can write data
much faster than it can be read into Excel. By trying many
different baud rates, I found the highest baud rate I could
June 2017 19
■ FIGURE 5. Example of the voltage stability of a few AA
batteries and the temperature stability in a closed
chamber. Note: The voltage scale is 1 mV per division and
0.05 °C per division, over a 13 minute period.
(Vref_hi – Vref_lo) Volts_per_adu =
(adu_hi – adu_lo)