Signal Conditioning and Data Acquisition System

117603
Back to Signal Conditioning and Data Acquisition System

Module 5: Data Processing

  1. Q1(i). The main objective of data processing is to: (i) Reduce microcontroller load (ii) Extract meaningful insights (iii) Increase clock frequency (iv) Improve battery capacity2025?m

    Module 5: Data Processing

    The main objective of data processing is to:
    (i) Reduce microcontroller load
    (ii) Extract meaningful insights
    (iii) Increase clock frequency
    (iv) Improve battery capacity

    View this question on its own page →
    Worked Solution

    Answer

    Correct option: (ii) Extract meaningful insights

    Explanation

    Data processing converts raw acquired data into useful information that can be interpreted or used for decision-making.

    Typical processing operations include:

    • Data cleaning and removal of invalid values.
    • Noise reduction and filtering.
    • Calibration and scaling.
    • Averaging and statistical calculations.
    • Feature extraction.
    • Conversion into engineering units.
    • Preparation of data for visualization or control.

    For example, raw vibration samples can be processed to calculate RMS vibration, peak amplitude or frequency components, helping identify a machine fault.

    Therefore, the correct answer is (ii).

  2. Q1(j). Which of the following is not a data storage device used in embedded systems? (i) EEPROM (ii) SRAM (iii) SD card (iv) Transformer2025?m

    Module 5: Data Processing

    Which of the following is not a data storage device used in embedded systems?
    (i) EEPROM
    (ii) SRAM
    (iii) SD card
    (iv) Transformer

    View this question on its own page →
    Worked Solution

    Answer

    Correct option: (iv) Transformer

    Explanation

    Embedded systems commonly use different types of memory and storage devices, including:

    • EEPROM: Non-volatile memory used for storing configuration data and calibration values.
    • SRAM: Fast volatile memory used for variables and temporary runtime data.
    • SD card: Removable non-volatile storage suitable for large amounts of logged data.

    A transformer is an electrical power/isolating component. It is not a data-storage device.

    Therefore, the correct answer is (iv).

  3. Q6(a). Explain the complete data processing cycle in a microcontroller-based system.20257m

    Module 5: Data Processing

    Explain the complete data processing cycle in a microcontroller-based system.

    View this question on its own page →
    Worked Solution

    Solution: Complete Data Processing Cycle

    Definition

    Data processing converts raw acquired samples into meaningful information that can be stored, displayed, transmitted or used for control.

    Processing Cycle

    Data Acquisition
          ↓
    Data Validation
          ↓
    Pre-processing / Filtering
          ↓
    Calibration & Scaling
          ↓
    Feature Extraction / Computation
          ↓
    Analysis
          ↓
    Storage / Display / Communication / Control
    

    1. Data Acquisition

    Sensors and ADCs generate digital samples at a selected sampling rate.

    2. Data Validation

    The system checks for missing, out-of-range or corrupted values.

    3. Pre-processing

    Noise may be reduced using averaging or digital filters. Signals can also be normalized or resampled when appropriate.

    4. Calibration and Scaling

    ADC codes are converted into engineering units such as °C, V, Pa or rpm.

    5. Feature Extraction

    Useful quantities are calculated from raw samples, such as peak, RMS, mean, frequency or heart rate.

    For a set of NN samples xix_i, the mean is:

    xˉ=1Ni=1Nxi\bar{x}=\frac{1}{N}\sum_{i=1}^{N}x_i

    6. Analysis

    Statistical, frequency-domain or trend analysis can be applied depending on the application.

    7. Storage and Output

    Processed or raw data can be saved to flash, EEPROM, SD card or a computer and displayed or transmitted.

    Real-Time Considerations

    The processing time must be sufficiently small compared with the sampling interval. Buffering and interrupts/DMA can help prevent sample loss.

    Conclusion

    A complete data-processing cycle transforms raw sensor samples into reliable, useful information through validation, filtering, calibration, computation and analysis.

  4. Q6(b). Describe various data storage options available in microcontroller systems and explain how data can be logged or stored using programming techniques.20257m

    Module 5: Data Processing

    Describe various data storage options available in microcontroller systems and explain how data can be logged or stored using programming techniques.

    View this question on its own page →
    Worked Solution

    Solution: Data Storage Options and Data Logging

    Data Storage Options

    Storage Nature Typical use
    SRAM Volatile, fast Temporary buffers
    EEPROM Non-volatile Calibration/configuration data
    Internal Flash Non-volatile Firmware and small datasets
    External Flash Non-volatile Larger embedded storage
    SD card Removable, high capacity Continuous data logging
    USB/Computer External Long-term transfer/storage

    Data Logging Process

    Sensor → ADC → MCU → RAM Buffer → Storage Interface → File/Memory
    

    Steps

    1. Initialize the sensor and ADC.
    2. Configure the sampling timer.
    3. Acquire a sample at every sampling instant.
    4. Convert the ADC code into the required format.
    5. Add a timestamp or channel identifier when necessary.
    6. Store samples in a RAM buffer.
    7. When the buffer is sufficiently full, write a block to non-volatile storage.
    8. Repeat until logging ends.

    Why Buffering is Important

    Storage devices such as SD cards may have variable write latency. A RAM buffer allows acquisition to continue while data is being written in blocks.

    Example Pseudocode

    while (logging)
    {
        sample = read_adc();
        buffer[index++] = sample;
    
        if (index == BUFFER_SIZE)
        {
            storage_write(buffer, BUFFER_SIZE);
            index = 0;
        }
    }
    

    A real implementation should also handle write failures, buffer overflow, timestamps, file-system errors and safe shutdown.

    Storage Selection

    • Use EEPROM for small calibration/configuration data.
    • Use Flash for firmware and moderate non-volatile data.
    • Use SD cards for large continuous logs.
    • Use computer/USB/network storage when very large datasets must be transferred or archived.

    Conclusion

    Efficient data logging depends on selecting suitable storage, using buffering and ensuring that the sustained storage throughput is greater than the incoming data rate.

  5. Q8(a). A microcontroller system needs to store real-time vibration data at 10 kSamples/s, each sample being 16 bits. (i) Calculate the minimum memory size required for storing 5 minutes of data. (ii) Suggest a suitable data storage interface (SPI/I2C/Parallel) and justify with bandwidth calculations.20257m

    Module 5: Data Processing

    A microcontroller system needs to store real-time vibration data at 10 kSamples/s, each sample being 16 bits.
    (i) Calculate the minimum memory size required for storing 5 minutes of data.
    (ii) Suggest a suitable data storage interface (SPI/I2C/Parallel) and justify with bandwidth calculations.

    View this question on its own page →
    Worked Solution

    Solution: Vibration Data Storage Calculation

    Given:

    • Sampling rate = 10 kSamples/s = 10,00010,000 samples/s
    • Sample size = 16 bits = 2 bytes/sample
    • Duration = 5 minutes = 300 s

    (i) Minimum Memory Required

    Data rate:

    10,000×16=160,000 bits/s10,000\times16=160,000\text{ bits/s}

    Convert to bytes/s:

    160,0008=20,000 bytes/s\frac{160,000}{8}=20,000\text{ bytes/s}

    For 300 seconds:

    20,000×300=6,000,000 bytes20,000\times300=6,000,000\text{ bytes}

    Therefore:

    6,000,000 bytes6 MB\boxed{6,000,000\text{ bytes}\approx6\text{ MB}}

    Using binary units, this is approximately:

    6,000,0001,048,5765.72 MiB\frac{6,000,000}{1,048,576}\approx5.72\text{ MiB}

    So at least 6 MB decimal storage is required, excluding filesystem overhead and metadata.

    (ii) Suitable Interface

    The raw required throughput is:

    20,000 bytes/s=20 kB/s20,000\text{ bytes/s}=20\text{ kB/s}

    or:

    160 kbps=0.16 Mbps160\text{ kbps}=0.16\text{ Mbps}

    SPI

    SPI is the best choice among the given options for a typical embedded data logger because it provides high throughput with simple hardware and is widely supported by SD cards and external memory.

    Even a modest SPI clock of 1 MHz can theoretically transfer:

    1 Mbit/s=125 kB/s1\text{ Mbit/s}=125\text{ kB/s}

    which is well above the required 20 kB/s, leaving margin for protocol and storage overhead.

    I²C

    I²C is convenient for sensors and EEPROMs, but its lower typical speed makes it less attractive for continuous high-rate storage.

    Parallel

    Parallel interfaces can provide high throughput but require more pins and hardware complexity.

    Final Answer

    • Minimum data storage: 6,000,0006,000,000 bytes ≈ 6 MB
    • Raw data rate: 0.16 Mbps = 20 kB/s
    • Recommended interface: SPI, because it easily provides sufficient bandwidth with low pin count and is well suited to SD-card/external-memory logging.
  6. Q9(a). A DAQ system samples 4 channels simultaneously at 25 kS/s per channel. Each sample is 12 bits. The microcontroller writes data to an SD card via SPI at 12 Mbps. The SD card uses 512-byte sectors and write operations must be in whole sectors. The MCU packs samples channel-wise into frames and writes continuously. (i) Compute the raw data rate in Mbps and the required sustained write throughput in MB/s (account for packing). (ii) Design a framing strategy: pack samples into 512-byte sectors with minimal wasted space—compute how many samples per sector and how many sectors per second must be written.20257m

    Module 5: Data Processing

    A DAQ system samples 4 channels simultaneously at 25 kS/s per channel. Each sample is 12 bits. The microcontroller writes data to an SD card via SPI at 12 Mbps. The SD card uses 512-byte sectors and write operations must be in whole sectors. The MCU packs samples channel-wise into frames and writes continuously.
    (i) Compute the raw data rate in Mbps and the required sustained write throughput in MB/s (account for packing).
    (ii) Design a framing strategy: pack samples into 512-byte sectors with minimal wasted space—compute how many samples per sector and how many sectors per second must be written.

    View this question on its own page →
    Worked Solution

    Solution: Multichannel DAQ Data Rate and SD-Card Framing

    Given:

    • Number of channels = 4
    • Sampling rate per channel = 25 kS/s
    • ADC resolution = 12 bits/sample
    • SPI rate to SD card = 12 Mbps
    • Sector size = 512 bytes

    (i) Raw Data Rate

    Total samples per second across all channels:

    4×25,000=100,000 samples/s4\times25,000=100,000\text{ samples/s}

    Each sample contains 12 bits, so:

    Rraw=100,000×12=1,200,000 bits/sR_{raw}=100,000\times12=1,200,000\text{ bits/s}

    Therefore:

    Rraw=1.2 Mbps\boxed{R_{raw}=1.2\text{ Mbps}}

    In bytes/s:

    1,200,0008=150,000 bytes/s\frac{1,200,000}{8}=150,000\text{ bytes/s}

    So:

    Rraw=0.15 MB/s\boxed{R_{raw}=0.15\text{ MB/s}}

    Account for packing

    Because SD-card writes are byte-addressable, 12-bit samples cannot simply occupy 12 bits independently unless the firmware packs them.

    A convenient packing scheme stores two 12-bit samples in 3 bytes:

    2×12=24 bits=3 bytes2\times12=24\text{ bits}=3\text{ bytes}

    Thus efficient packing produces exactly the theoretical raw rate of 0.15 MB/s, excluding filesystem and protocol overhead.

    The available SPI bandwidth is:

    12 Mbps=1.5 MB/s12\text{ Mbps}=1.5\text{ MB/s}

    Therefore the nominal raw data rate is only:

    0.151.5=10%\frac{0.15}{1.5}=10\%

    of the stated SPI link capacity, leaving substantial bandwidth margin.

    (ii) 512-Byte Sector Framing

    A 512-byte sector contains:

    512×8=4096 bits512\times8=4096\text{ bits}

    With 12-bit samples, the maximum number of complete samples is:

    409612=341 samples\left\lfloor\frac{4096}{12}\right\rfloor=341\text{ samples}

    341 samples use:

    341×12=4092 bits=511.5 bytes341\times12=4092\text{ bits}=511.5\text{ bytes}

    So one sector can contain 341 complete 12-bit samples if the packing is bit-level, leaving:

    40964092=4 bits4096-4092=4\text{ bits}

    unused.

    However, a cleaner byte-aligned scheme is to pack 340 samples:

    340×12=4080 bits=510 bytes340\times12=4080\text{ bits}=510\text{ bytes}

    leaving exactly 2 bytes for metadata, a timestamp, frame counter, CRC, or padding.

    Recommended framing

    Use 340 samples per 512-byte sector and reserve 2 bytes for metadata, or use a 341-sample bit-packed payload with 4 unused bits plus a defined header/trailer.

    At 100,000 samples/s:

    100,000340=294.12 sectors/s\frac{100,000}{340}=294.12\text{ sectors/s}

    Thus the system needs approximately:

    295 sectors/s\boxed{295\text{ sectors/s}}

    with 340 samples/sector, ignoring additional metadata.

    For maximum packing efficiency using 341 samples/sector:

    100,000341=293.26 sectors/s\frac{100,000}{341}=293.26\text{ sectors/s}

    so approximately 294 sectors/s are required.

    Final Answer

    • Raw data rate: 1.2 Mbps = 0.15 MB/s
    • SPI capacity: 12 Mbps = 1.5 MB/s
    • Maximum complete 12-bit samples in 512 bytes: 341 samples
    • Efficient practical framing: 340 samples + 2 bytes metadata/padding
    • Sectors/s: approximately 295 sectors/s for 340-sample frames, or 294 sectors/s with 341-sample bit packing.

    The stated SPI bandwidth is comfortably sufficient for the raw acquisition rate.