Skip to content

McMaster-Baja-Racing/OktoDriveshaft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OktoDriveshaft

This repository contains firmware, data, and processing scripts for the Okto (ESP32-based) driveshaft strain measurement project used by McMaster Baja Racing. The project captures torsion and axial strain from an instrumented driveshaft and provides a lightweight Python pipeline to correct timestamps, filter / detrend signals, and save normalized outputs for analysis.

Contents:

  • firmware/ — ESP32 code and calibration files
  • data/ — raw and processed CSV exports from the device
  • scripts/ — Python scripts to correct timestamps, filter signals, and save normalized data

Quick summary:

  • The ESP32 firmware records sensor data to an SD card. Two firmware variants are included:
    • millis_code/: samples at ~2 kHz but timestamps are written with a millisecond resolution (so consecutive samples can share the same millisecond value). The data files contain a Timestamp [ms] column.
    • nanos_code/: samples at ~5 kHz and records timestamps in nanoseconds (Timestamp [ns]).
  • firmware/calibration/ includes an Excel calibration sheet and example csv used to compute zero-offsets and linear multipliers for converting raw sensor counts to physical units (measured in a pure torsion setup).

Data layout:

  • data/0_raw/ — CSV files straight from the ESP32 (filename prefix okto25_). These are unmodified exports.
  • data/1_time_corrected/ — CSV files produced by the time-correction step. All timestamp columns are converted to seconds, the first timestamp is zeroed, and known SD-flush/noise discontinuities are smoothed.
  • data/2_normalized/ — Final processed CSVs after filtering and EMD detrending. Signals are saved with the same okto25_ prefix and contain a Timestamp [s] column and processed measurement columns (e.g., Torque [Nm]).

Notes:

  • The millis_code firmware records timestamps in Timestamp [ms]. Because the sample rate (~2 kHz) is higher than millisecond resolution, there can be duplicate ms values. _correct_time_ms adjusts duplicates and fixes single-sample discontinuities (like SD flush artifacts) by interpolating a local mean and applying an offset to subsequent samples.
  • The nanos_code firmware records Timestamp [ns]. _correct_time_ns looks for periodic flush boundaries (1 second) and corrects large jumps near those boundaries.
  • The EMD-based detrending (PyEMD) in remove_slow_wave_emd decomposes the signal into intrinsic mode functions (IMFs). The code currently reconstructs the baseline as the difference between the original and the summed IMFs in the specified keep_imfs range — review the keep_imfs tuple to control which IMFs are treated as baseline vs signal.
  • Plots are generated when functions are called with debug=True which helps visualize filtering and detrending steps.

About

Drop site for raw and parsed "torque" data on the driveshaft during OktoBaja 2025 and for the ESP32 Code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors