BY DAN GRAVATT
As mentioned earlier, the
maximum value for this
variable can be anywhere
from 1 to 5.
A datalogger isn’t
much good without some
sort of time reference associated with your data. The
code provides a relative
time stamp for each set
of data through a pause
command, which is
calibrated to provide the
desired delay between data
acquisitions. This calibration is accomplished using
the “test pulse out” signal
on pin RB1 and an external
frequency counter.
The code as written
will collect data every 0.1
seconds using a pause
value of 94 milliseconds, as
near as my frequency
counter could resolve. A
pause value of 994 milliseconds should give a one
second interval between
data acquisitions, and so
on. Remember to recalibrate
this pause interval whenever
you make changes to the
code in the data acquisition loop.
Once your datalogger is full,
power it down and connect it to a
standard serial (not USB) port. Only
the receive data and signal ground
pins on the computer’s serial port
need to be connected.
The computer should be running
a terminal emulation program set at
2400 baud, no parity, eight data bits,
and one stop bit (2400 N81). Also,
make sure that the software is not set
to use hardware handshaking. It’s a bit
slow downloading this way — taking a
minute or two to dump the whole
memory — but this makes it very
tolerant of different circuit construction techniques and unshielded
data cables.
Before powering up the datalogger, you must install the mode select
jumper so the program will begin
■ FIGURE 1. Four
channel datalogger
schematic.
downloading the data. If you don’t,
the PIC will begin collecting more
data and overwriting whatever was
there before. The data dump loop formats the data into separate lines for
each time reference, with the values in
each line separated by commas,
starting with the first ADC channel.
The data can then be
easily imported into a
spreadsheet in a comma-separated variable (CSV)
format, and processed
or graphed as needed.
Depending on the exact
number of data sets
recorded, the last line of
data may contain some invalid values
that will need to be ignored.
Application — Rocket
Accelerometer
My rocket-borne implementation
of this circuit is shown in Figure 2. I’m
■ FIGURE 2. Rocket
datalogger circuit with
two-axis accelerometer
daughterboard.
January 2008 43