Maintainers: Sera Ermolenko (Project Lead)
The DAQ system collects, logs, displays, and transmits real-time sensor data from the vehicle to support driver safety, performance analysis, and debugging. The current ESP32-based firmware interfaces with analog and digital sensors, streams selected data over CAN to the VCU and dashboard, and sends telemetry/logging data over UART radio and SD card storage.
- Overview
- System Context
- Project Status
- Hardware
- Firmware / Software
- DAQ Additional Information
- Getting Started
- PlatformIO Setup
- Data Preprocessing
- Data Visualization
- Antenna Telemetry
- Logic & Functionality
- Configurations & Toggles
- Calibration & Procedures
- Additional Notes
- Safety & FSAE Compliance
- Maintainers
- License
The purpose of the DAQ system is to monitor, log, and analyze sensor data in real time for driver feedback and engineering development. It consolidates analog and digital signals into runtime state, CAN messages, SD CSV logs, and telemetry UART output. The system also computes a cooling fault condition and transmits that status to the VCU.
Key Features
- Reads analog and digital sensor signals (4 wheel speed, 2 flow, 2 temperature, 1 steering angle, and 4 suspension).
- Communicates over CAN with the VCU and Dash.
- Supports telemetry UART output for validation and radio transmission.
- Supports internal SD card data logging for validation, driver feedback, and debugging.
- Supports sensor simulation for bench validation without attached hardware.
- Modular firmware for easy addition of new sensors.
Design Goals
- Reliability under track conditions.
- Easy calibration and debugging.
- FSAE rule compliance (DAQ required for scrutineering).
- Expandability for future sensors.
-
Current state:
-
Bench-tested on ESP32 dev kits with CAN, telemetry/logging flow, and task-based runtime. Firmware now supports temperature, pulse-based flow, wheel speed, steering angle, suspension, SD logging, telemetry UART, and sensor simulation. Hardware validation is still required for the latest revision and wiring.
-
Focus areas: Finalize wiring harness pinout, expand calibration coverage for additional sensors, and document the warm-up/fault behavior for the VCU team. Finalizing perf board for additional sensors.
-
Current board/major revision: Rev 5 (ESP32-based DAQ board)
-
Last validated on: 2026-07-11
-
Health:
-
Sensor bring-up, CAN messaging, and logging are stable; remaining tasks are workflow polish and extended testing.
-
MCU / ICs: ESP32, ADS1115 (I^2C), CAN transceiver (SN65HVD230).
-
Files: DAQ Rev 4 Schematic
-
Language/SDK: C++ with Arduino-ESP32 framework, Python for preprocessing and visualization utilities.
-
Build System: PlatformIO (VS Code or CLI via
pio).
Key Modules
| Module | Location | Purpose | Notes |
|---|---|---|---|
| Main firmware | DAQ_FW/src/main.cpp |
Initializes hardware and starts runtime tasks. | Sets up UART, CAN, SD, sensors, and watchdog. |
| Runtime scheduler | DAQ_FW/lib/runtime |
Runs FreeRTOS tasks for sensors, logging, CAN, and telemetry. | Controls task rates and mode-dependent behavior. |
| Sensor service | DAQ_FW/lib/sensors |
Aggregates critical and chassis sensors into the shared snapshot. | Uses shared ADS1115 chip objects for ADC-backed sensors. |
| IADC Sensor drivers | DAQ_FW/lib/iadcSensor |
ADS1115 abstractions for coolant temperature, steering angle, and suspension. | Logical sensors own channels, not ADC chips. |
| Flow pulse module | DAQ_FW/lib/flowPulse |
Counts Hall-effect flow pulses and converts them to L/min. | Uses GPIO interrupts and a configurable sample window. |
| Service layer | DAQ_FW/lib/services |
Snapshot state, telemetry CSV, SD logging, and fault handling. | snapshotService uses targeted field updates to avoid task overwrite races. |
| CAN (TWAI) layer | DAQ_FW/lib/can |
Configures ESP32 CAN driver and transmits frames. | canInit() validates loopback; canSendInt16() sends packed integers. |
| Wheel speed | DAQ_FW/lib/wheelSpeed |
Captures interrupts and computes wheel/vehicle speed. | Use wheelSpeedReset() + getters in runtime tasks. |
| Simulation | DAQ_FW/lib/simulation |
Generates fake sensor data for bench validation without hardware. | Drives the same snapshot/logging/telemetry pipeline as real sensors. |
| Global config | DAQ_FW/include/systemConfig.h |
Shared pins, modes, thresholds, and feature toggles. | Includes telemetry UART and flow constants. |
| Antenna receiver (PC) | antenna/telemetry_receiver.py |
Logs incoming telemetry radio CSV to timestamped files. | Reads serial port at configured baud (57600). |
Note:
- The original DAQ project was developed in Python for the Raspberry Pi 4.
- Due to supply shortages, the project switched to an ESP32 microcontroller.
- The codebase for the original project can be found in this branch: https://github.com/sfuphantom/DAQ/tree/RaspberryPi-Archive-2021.
- Clone & Open –
git clonethe repo, open it in VS Code or your preferred editor/terminal. - Install Dependencies – PlatformIO will pull firmware libraries from
platformio.iniautomatically, or runpio pkg install. For Python tooling, runpip install -r requirements.txt. - Review Config – Configure modes, sensor toggles, limits, and telemetry settings in
DAQ_FW/include/systemConfig.h. - Build –
pio run(targets[env:esp32dev]by default). - Flash –
pio run -t uploadwith the ESP32 connected over USB. - Monitor –
pio device monitor -b 115200to view logs (Logger::notice/trace/erroroutput status and snapshots). - Verify Bench Behavior – Confirm SD init, UART telemetry init, and expected mode behavior (
MODE_FULL,MODE_CAN_ONLY, orMODE_SENSORS_ONLY). - Optional No-Hardware Validation – Set
ENABLE_SENSOR_SIMULATION = 1inDAQ_FW/include/systemConfig.hand test telemetry / SD outputs without attached sensors. - Telemetry Receiver (PC) – Run
python3 antenna/telemetry_receiver.py --port <PORT> --baud 57600to capture radio telemetry CSV logs.
pip install platformio # or install the VS Code PlatformIO IDE extension
pio run # build
pio run -t upload # flash
pio device monitor -b 115200 # serial monitor (matches BAUD_RATE)
- Environment:
[env:esp32dev]inplatformio.ini. - Dependencies: ArduinoLog, Adafruit ADS1X15, SPI, LSM6DS, Unified Sensor (auto-resolved by PlatformIO).
- Serial monitor uses the baud defined in
include/systemConfig.h(BAUD_RATE = 115200).
Prerequisites
- ESP32 dev board wired to ADS1115 modules, coolant sensors, wheel-speed sensors, flow pulse inputs, and CAN transceiver (TX = GPIO4, RX = GPIO5).
- PlatformIO Core (
pip install platformio) or VS Code with the PlatformIO IDE extension. - USB cable for flashing and serial monitoring.
- Access to the vehicle CAN bus or a bench CAN interface for testing.
- Location:
daq_data_preprocessing/preprocessing.py - Purpose: takes CSV logs from SD card
unprocessed/, normalizes timeline, filters outliers, fills short gaps, and writes cleaned files into the processed directory.
Install Python dependencies:
pip install -r requirements.txtRun:
python3 daq_data_preprocessing/preprocessing.py /path/to/SDNotes:
- Requires
DRIVE_ROOTindaq_local_config.py. - Expects source logs at
<SD>/unprocessed. - Moves original CSV files to
processed/rawafter processing.
- Location:
daq_data_visualization/visualization.py - Purpose: generates run summaries and plots (speed, flow, temperature, suspension, correlation heatmaps) from processed CSV files.
Run with real processed data:
python3 daq_data_visualization/visualization.pyRun with simulated data:
python3 daq_data_visualization/visualization.py --simulateNotes:
- Uses
daq_data_visualization/sim_test.pyfor simulation mode. - Writes outputs under
processed/plotsandprocessed/summaries(ordaq_data_visualization/test_datain simulation mode).
- Location:
antenna/telemetry_receiver.py - Purpose: receives telemetry CSV over serial from the 915 MHz telemetry radio link and saves timestamped log files.
Install Python dependencies:
pip install -r requirements.txtRun:
python3 antenna/telemetry_receiver.py --port COM7 --baud 57600Notes:
- Default output directory:
antenna/logs. - Telemetry CSV format currently includes:
critical_timestamp_ms,chassis_timestamp_ms,wheel_speed_timestamp_ms,temp1_c,temp2_c,flow1_lpm,flow2_lpm,susp1,susp2,susp3,susp4,steering_angle_deg,speed_kmh - For firmware-side streaming, use
SYSTEM_MODE = MODE_FULL.
-
Setup Path (
DAQ_FW/src/main.cpp)- Starts Serial, I2C, SPI, logger, SD logging, telemetry UART, and CAN (when enabled by mode/flags).
- Initializes enabled real sensors through
sensorServiceInit()when simulation is off. - Initializes fault service and starts FreeRTOS tasks via
runtimeStartTasks(). - Sends a startup cooling fault status frame (
CoolingFault = 0) when CAN is enabled.
-
Task-Based Runtime (
DAQ_FW/lib/runtime/taskScheduler.cpp)CriticalSensorsTaskreads temperature/flow sensors and evaluates fault state.WheelSpeedTaskupdates wheel speed values and transmits CAN wheel speed when enabled.ChassisSensorsTaskreads suspension and steering channels.LoggerTaskprints snapshots and appends SD logs when enabled.TelemetryTaskstreams CSV snapshots over telemetry UART when enabled.SimulatedSensorsTaskcan replace the real sensor tasks with generated data.
-
Fault Behavior (
DAQ_FW/lib/services/faultService.cpp)- Uses warm-up suppression and debounce timers before asserting a fault.
- Checks flow and temperature against configured min/max bounds.
- Transmits
CoolingFaultCAN status (0/1) when CAN is enabled.
-
Shared Snapshot Model (
DAQ_FW/lib/services/snapshotService.cpp)- Producer tasks update only the fields they own instead of overwriting the entire snapshot.
- Logging, SD logging, and telemetry consume the shared latest-value state.
(in DAQ_FW/include/systemConfig.h)
SYSTEM_MODE(MODE_FULL,MODE_CAN_ONLY,MODE_SENSORS_ONLY) controls which subsystems run.ENABLE_SENSOR_SIMULATIONswaps real sensor acquisition for generated data.ENABLE_TELEMETRY_OUTPUTandENABLE_SD_LOGGING_OUTPUTallow antenna and SD validation independently.- Sensor toggles (
ENABLE_TEMP_SENSOR_*,ENABLE_FLOW_SENSOR_*,ENABLE_SUSP_SENSOR_*,ENABLE_WHEEL_SPEED_SENSORS) control active channels. - Safety bounds (
MAX_TEMP_1,MAX_TEMP_2,MIN_TEMP,MIN_FLOW_LPM,MAX_FLOW_LPM) define fault thresholds. - Telemetry settings (
TELEMETRY_UART,TELEMETRY_TX_PIN,TELEMETRY_RX_PIN,TELEMETRY_BAUD,TELEMETRY_PERIOD_MS) configure the radio serial link. - Flow conversion constants (
FLOW_SENSOR_HZ_PER_LPM,FLOW_SENSOR_SAMPLE_WINDOW_MS,FLOW_SENSOR_*_PIN) tune pulse-based flow-rate math. - CAN pins and message IDs (
CAN_TX_PIN,CAN_RX_PIN,CANMessageId) should only be changed in sync with VCU expectations.
Keep
systemConfig.haligned with the actual harness wiring and calibration sheet before flashing.
-
Sensor Verification
- Enable one channel at a time with
ENABLE_*toggles. - Use
pio device monitor -b 115200to confirm stable values and no ADC init errors. - Tune
MAX_TEMP_*andMIN/MAX_FLOW_LPMagainst trusted references. - For flow sensors, verify pulse polarity, pull-up voltage, and
FLOW_SENSOR_HZ_PER_LPMagainst the actual sensor.
- Enable one channel at a time with
-
Warm-Up Buffer Check
- With cold sensors, boot DAQ and confirm no immediate fault assertion during warm-up.
- After warm-up, force a known out-of-range value and confirm
CoolingFaulttransitions high. - Restore normal conditions and confirm fault clears.
-
Wheel-Speed Validation
- Spin wheel inputs manually and verify wheel speed values update and CAN wheel-speed messages transmit when enabled.
-
Telemetry Radio Validation
- Set
SYSTEM_MODEtoMODE_FULLand runantenna/telemetry_receiver.pyon the PC. - Confirm steady CSV reception at expected rate (
TELEMETRY_PERIOD_MS), with valid field count and timestamps. - Verify radio link quality at increasing distance before dynamic testing.
- Set
-
No-Hardware Validation
- Set
ENABLE_SENSOR_SIMULATION = 1. - Use
ENABLE_TELEMETRY_OUTPUT/ENABLE_SD_LOGGING_OUTPUTto test antenna-only, SD-only, or both. - Validate console logs, CSV formatting, CAN behavior, and fault transitions without attached sensors.
- Set
-
In-Car Procedure
- Ensure coolant is circulating before enabling strict fault thresholds.
- Coordinate expected CAN IDs and startup behavior with VCU/dash teams.
- Record both SD and radio telemetry for first integration runs.
- For antenna-only or SD-only bench tests, use
ENABLE_TELEMETRY_OUTPUT/ENABLE_SD_LOGGING_OUTPUTin addition toSYSTEM_MODE. - Flow sensing is now pulse-based via GPIO interrupts, not ADC voltage-to-frequency conversion.
- When adding sensors, extend
sensorService,snapshotService, logging/telemetry serializers, and visualization schema together. - Share wiring and calibration updates with the team so this README and config remain accurate.
- EV.7.1.4 – BMS, IMD, and BSPD must each have independent circuits capable of opening the shutdown system.
- EV.4.6 – Series-provided energy meter must monitor TS voltage/current. DAQ supplements this by logging additional sensor data for analysis.
- Accumulator monitoring – At least one temperature sensor required inside the accumulator; DAQ can optionally mirror these values.
- Wheel speed (T.11.x) – Required for scrutineering; DAQ measures and provides wheel speed data to the dashboard and logs for inspection.
- Cooling system monitoring – While not explicitly mandated, DAQ logs coolant flow/temperature and raises fault signals to the VCU to protect HV components.
Current Project Lead: Sera Ermolenko
-
Sera Ermolenko (2025-2026 major revision): Authored RTOS/task-based firmware architecture (
runtime/services/sensors), firmware addition and testing of 4 suspension sensors, steering angle sensor, two flow sensors, revision of wheel-speed sensors and temperature sensors, active CAN implementation and integration/testing, telemetry antenna integration, SD card integration, preprocessing pipeline, and visualization pipeline. -
Amraz (2025-2026 major hardware revision):
-
Hardware workaround with perf board
Old revision History
- Sera: Coolant and temperature sensors (later rewritten and replaced with flow sensors)
- Igor: Hardware rev3 re-design.
- Ritesh: Hardware rev2 design (later rewritten in current revision).
- Andrew: Legacy CAN driver implementation and IAD sensor class.
- Lona: Earlier wheel-speed implementation (later rewritten in current revision).
Licensed under the MIT License.
