Data Capture

Principles of Operation

Evan Daniel, Stephen Daniel

Last Update, July 12, 2007

 

Introduction

The data capture board is designed as a low-cost system for capturing 0-5V sensor data during a test of an amateur class rocket motor. The basic goal is to capture reliable 4-channel by 12 bit data as cleanly as possible. We expect to capture data at 4 KHz, filtered by a 6th order Bessel filter calibrated to reduce gain by 70 dB at the Nyquist frequency. This should allow reasonable response out to 500 Hz.

NOTE: first build-out will only populate two of the four channels.

Captured data is stored on an MMC memory card. The memory card is transported to a computer for analysis.

Major Components

Physical

The data capture system will be mounted in an all-metal box for both fire safety and electrical noise reasons. The box will be approximately 9" by 6" by 2.5" deep. All external connections will be made to connectors mounted on the front pannel.

Electrical

Electrically the data capture system has two major subsystems. The analog subsystem is responsible for cleaning amplifying and filtering all sensor data. The digital subsystem converts the data to digital format and stores it on the MMC card.

External Connections

 
Power Connector None. Powered by an internal 9v battery.
MMC Card Slot TBD. There will be an MMC card slot. Needs protection from exhaust gasses.
Analog Sensors QTY4. Each provides power, ground, and signal return. Built from 4-write AMP. Analog signals are 0-5 volts working. Diode protected to the rails. Diodes rated to at least 100 mA..
Serial Port DB-9 RS 232.
Digital Input QTY 4: Connectors TBD.
Clock Out Signal and ground, for daisy chain. Not really implemented in first build-out.

External Controls

 
Power Switch
Start Button
Stop Button

External Indicators

 
Battery Good / Power LED
Error LED
Active LED
Memory Space Low LED

Configuration

The system has no configuration options.

Operating States

Idle

When the system is powered up, it enters with an error state or an idle state. In the idle state the system believes it is ready to record. All sensors are sampled once per second and the sensor values are sent to the RS232 port once per second.

During the idle state the system is also available to receive commands over the RS232 line.

Command Input

If the system is in idle state and a '^C' character is received on the RS232 line it will enter the command input mode. Entering a blank line will return the system to idle mode. Pressing the start button will force the system into the run mode.

Error

If any error occurs the system enters an error state. In this state the error light is lit and an error message is sent to the RS232 port once per second.

The following error messages are possible:

  • Out of memory -- Ran out of memory during the previous data collection

The only way to clear the error state is to power off the system.

Run

The system enters this state if the Start button is pressed while the system is in either the idle or command input state.

During the run the system records sensor data at 4KHz to the data file.

The system may enter an error state at any time during the run.

The system can go from Run to Idle by pressing the Stop button.

Each time the Run button is pressed a new data file is created. Data files are named DATAnnn.dat, where nnn is a sequence number. The system finds the lowest number nnn such that there is no file named DATAnnn.dat on the MMC card. The system cannot format the MMC card, overwrite a file, nor erase a file.

While running the system will write data to the MMC card at just under 48 KB per second.

Memory Low

If the system is completely out of memory, this is an error state. Both the Memory Low LED and the Error LED will be lit.

If the memory low LED is lit solid, then the system has less than 5 minutes of data space available. This is a warning that can occur during either run or idle state.

If the memory low LED is blinking slowly (once every two seconds), then the system has less than 30 minutes of memory. This is a warning that can occur during either run or idle state.

30 minutes of space is equivalent to about 84 MB of memory.

File Format

Overview

Data files have 3 sections. Each file begins with a header, contains a binary data section, and ends with an end marker.

The formats are designed to be complete, simple to create, and somewhat extensible.

Header

The header is an integral number of 512 byte blocks. The blocks are filled with ASCII data, terminated by a null byte. After the first null byte the 512 byte block is null padded.

The header consists of multiple lines. Each line contains a keyword, one or more white space characters, a value, zero or more white space characters, and a linefeed.

The following keywords are generated by the first version of the system:

 
Keyword Value
StartTime Start time in some TBD format
FileName Original File Name
RunNumber Unique run number, starting at 0 for the first run after system initialized
RunSequence The run number since power up.
SerialNumber The Serial Number of the DAC system
FirmwareVersion DAC Software version number as a sequential build number.
AnalogChannels Number of channels supported by this board
DigitalChannels Number of digital channels supported by this board

Data

The data records are binary. Each is 12 bytes long. 12 byte records are placed into each 512-byte block until either data capture stops or there is no more room. Any unused bytes will be zero. (Note: the last 8 bytes of any data block will always be zero. Typically the system will put 42 records in each block.

Each data record contains a sequence number. These are necessary because if the MMC card is slow then datra records may be dropped. This should not happen under normal circumstances, but if it does lost records can be detected by gaps in the sequence numbers.

 
Byte Number Contents
0 Reserved. Must be zero.
1 Digital Inputs: The high order 4 bits will contain zeros. The low order 4 bits track the state of the digital inputs.
2 Sample number, high order 8 bits. The sample number is a 24-bit unsigned integer. If the run has more than 2**24 samples this number will wrap back to zero.
3 Sample number, middle 8 bits
4 Sample number, low 8 bits.
5 Analog channel 0, high order 8 bits. Each analog value is a 12 bit unsigned binary number.
6 Analog channel 0, low order 4 bits are stored in the 4 high order bits of this byte. Analog channel 1 4 high order bits are stored in the low order bits of this byte.
7

Analog channel 1, low order 8 bits

8 Analog channel 2, high order 8 bits
9 Analog channel 2, low order 4 bits, plus analog channel 3, high order 4 bits.
10 Analog channel 3 low order 8 bits.
11 Reserved. Must be zero.

End Marker

After the last data record the system writes an end marker, consisting of 12 consecutive bytes of all ones.

Serial Port Communication

All serial port communcation happens at 9600 baud, 1 start bit, 1 stop bit, 8 data bits, no parity bit.

Idle Mode

When the system is idling, it will transmit the state of its inputs once per second. The four digital inputs are sent as a string of 4 digits, each a one or a zero. Each analog channel's state is sent as a decimal number in the range 0-4095, preceded by a space, with leading zeros.

Command Input Mode

The system enters command input mode when a '^C' character is received on the serial port. In this mode the waits for input.

Each input command is a single letter, followed zero or more whitespace characters, the data for that command, and then a newline.

As part of processing the command the system may send data back to the operator. Once the command execution is complete the system returns to idle mode.

The following commands are processed by the system:

 
Command Data
T Date and time in TBD format