Skip to the content
2 layers65 × 65 mmVaporTrack Board, the printed circuit board in 3D

VaporTrack Board

Samuel-Habib/VaporTrack

Autonomous Gas Sensing Rover - Spring 2026 Capstone

Size
65 × 65 mm
Copper layers
2
Thickness
1.6 mm
Parts
29
Nets
57
Pads
138
Tracks, vias
269, 60
Pours
1
Routed
Yes
KiCad
KiCad 7 (file 20221018)
Created
28 Mar 2026
Updated
27 Sep 2026

Overview

VaporTrack Board is an open-source printed circuit board by Samuel-Habib, from the Samuel-Habib/VaporTrack repository on GitHub, published under the MIT licence. It is a 2-layer board of 65 × 65 mm with 29 parts on 57 nets, routed with 269 tracks and 60 vias.

It is built around the L298N and AMS1117-3.3. Its parts include 9 capacitors, 9 connectors, 4 resistors, 2 ICs and 1 diode. It belongs with the robots and motor control boards and the STM32 boards of this library.

Main components

2

README

README.md

VaporTrack: Autonomous Gas-Detection Rover

License: MIT Platform RTOS Toolchain

VaporTrack is an autonomous robotic rover powered by an STM32F446RE (ARM Cortex-M4F @ 180 MHz) running FreeRTOS. The rover characterizes spatial volatile organic compound (VOC) gas distributions in indoor environments, computes 2D spatial gradients ($\nabla G = [\partial G/\partial x, \partial G/\partial y]$) via weighted planar least-squares regression, and tracks plume sources while executing reactive obstacle avoidance using a 3-sensor ultrasonic array.


1. System Architecture

text
                         ┌─────────────────────────┐
                         │   NUCLEO-F446RE (ARM)   │
                         │   180 MHz Cortex-M4F    │
                         │                         │
                         │   FreeRTOS (CMSIS-V2)   │
                         └────────────┬────────────┘
                                      │
             ┌────────────────────────┼────────────────────────┐
             │                        │                        │
        I2C1 (PB6/PB7)           TIM4 / GPIO             TIM1 PWM (PA8/PA10)
             │                        │                        │
      ┌──────┼──────┐           ┌─────┴─────┐            ┌─────┴─────┐
      │      │      │           │           │            │           │
    BME688 BNO055 OLED      HC-SR04 x3   Heartbeat     L298N H-Bridge
    (Gas)  (IMU)  (Diag)   (PC0 - PC5)     (PA5)             │
                                                       ┌─────┴─────┐
                                                       │           │
                                                   Left 4WD    Right 4WD

2. Hardware Specification

SubsystemComponentBus / InterfaceOperational ParametersRole in System
MCUSTM32F446RET6 (Nucleo-64)On-chip180 MHz, 512 KB Flash, 128 KB SRAM, FPUMain controller, RTOS scheduler, spatial math
RTOSFreeRTOS Kernel v10.3.1SoftwareCMSIS-RTOS v2 API, preemptive schedulingTask timing, thread synchronization, IPC
Gas / EnvironmentBosch BME688I2C1 (0x77, 100 kHz)Forced mode, 320°C heater (150 ms dwell)MOX gas resistance ($R_{gas}$), T, P, RH
IMU / HeadingBosch BNO055I2C1 (0x28, 100 kHz)NDOF fusion mode, internal sensor fusionAbsolute Euler yaw ($\theta$), dead-reckoning
Diagnostics DisplaySSD1306 0.96" OLEDI2C1 (0x3C, 100 kHz)128x64 monochrome framebufferReal-time telemetry, state, gradient vector
Distance Ranging3x HC-SR04 UltrasonicGPIO + TIM4 (1 MHz)Sequential 10 µs trigger, 1 µs timing resolutionFront, Left, and Right obstacle distance
Motor DriverL298N Dual H-BridgeTIM1 PWM + GPIO20 kHz PWM (ARR=8999), 2A max per channel4WD differential steering control
Chassis & MotorsYIKESHU 4WD ChassisMechanical4x DC gearmotors (1:48 gear ratio)Differential mobility platform
Power RegulationDFRobot DFR0831 BuckDC-DC Step-Down7.4V input $\rightarrow$ 5.0V regulated (3A max)Clean 5V logic & ultrasonic sensor supply
Battery Source2x 18650 Li-ion CellsSeries Pack (2S)7.4V nominal (8.4V peak), 2600 mAhPrimary rover energy source

Schematic

Schematic

PCB Layout (Top)

PCB Layout


3. Electrical & Power Architecture

text
   2S 18650 Li-ion Battery
      (7.4V - 8.4V)
           │
           ├───[ Main Switch ]───┬───────────────────────────────► L298N VMS (Motor Power)
           │                     │
           │                     ▼
           │           DFRobot Buck Converter (DFR0831)
           │                 (7.4V -> 5.0V Regulated)
           │                     │
           │                     ├───► HC-SR04 Ultrasonic Array (VCC = 5.0V)
           │                     │
           │                     ▼
           │           Nucleo-64 5V / E5V Rail
           │                     │
           │                     ▼
           │           On-Board LDO (5.0V -> 3.3V)
           │                     │
           │                     ├───► STM32F446RE MCU Core & Peripherals
           │                     ├───► Bosch BME688 Gas Sensor (VDD = 3.3V)
           │                     ├───► Bosch BNO055 9-DOF IMU (VDD = 3.3V)
           │                     └───► SSD1306 128x64 OLED Display (VDD = 3.3V)
           │
           └─────────────────────────────────────────────────────► Common Ground Bus (GND)

[!NOTE] Ground Isolation & Noise Mitigation: The motor return current path through the L298N is tied to the central battery ground tab to prevent high-current switching noise from inducing ground bounce on the 3.3V analog and I2C lines. Echo pins PC1, PC3, and PC5 on the STM32F446RE are true 5V-tolerant (FT) inputs, allowing direct interface with 5V HC-SR04 echo signals without resistive voltage dividers.


4. Hardware Pinout Map

Signal NameSTM32 PinFunction / Alternate FunctionElectrical CharacteristicsNotes
I2C1_SCLPB6AF4 (I2C1)Open-Drain, 4.7 kΩ pull-upShared I2C bus clock (BME688, BNO055, SSD1306)
I2C1_SDAPB7AF4 (I2C1)Open-Drain, 4.7 kΩ pull-upShared I2C bus data line
ENA (Left PWM)PA8AF1 (TIM1_CH1)Push-Pull, 20 kHz PWMLeft motor bank duty cycle (ARR=8999)
ENB (Right PWM)PA10AF1 (TIM1_CH3)Push-Pull, 20 kHz PWMRight motor bank duty cycle (ARR=8999)
IN1PB10GPIO OutputPush-Pull, Low SpeedLeft motor forward control
IN2PB4GPIO OutputPush-Pull, Low SpeedLeft motor reverse control
IN3PB5GPIO OutputPush-Pull, Low SpeedRight motor forward control
IN4PB3GPIO OutputPush-Pull, Low SpeedRight motor reverse control
USS_FRONT_TRIGPC0GPIO OutputPush-Pull, High SpeedFront ultrasonic 10 µs trigger pulse
USS_FRONT_ECHOPC1GPIO Input (FT 5V-tolerant)Floating / Internal Pull-downFront echo pulse width measurement
USS_LEFT_TRIGPC2GPIO OutputPush-Pull, High SpeedLeft ultrasonic 10 µs trigger pulse
USS_LEFT_ECHOPC3GPIO Input (FT 5V-tolerant)Floating / Internal Pull-downLeft echo pulse width measurement
USS_RIGHT_TRIGPC4GPIO OutputPush-Pull, High SpeedRight ultrasonic 10 µs trigger pulse
USS_RIGHT_ECHOPC5GPIO Input (FT 5V-tolerant)Floating / Internal Pull-downRight echo pulse width measurement
STATUS_LEDPA5AF1 (TIM2_CH1)Push-Pull PWMActivity heartbeat LED (duty $\propto$ motor drive)

5. Software Architecture & FreeRTOS Tasks

The application runs 6 prioritized, decoupled FreeRTOS tasks. Inter-task communication follows a producer-consumer snapshot model: sensors update a shared state struct protected by a FreeRTOS mutex (g_sensor_mutex), and consumer tasks copy local snapshots to eliminate torn reads without holding the bus.

In addition, access to the shared physical I2C1 bus (hi2c1) between SensorTask (reading BME688 and BNO055) and DisplayTask (flushing 1024-byte framebuffer to SSD1306) is serialized using a dedicated FreeRTOS mutex (g_i2c_mutex). To prevent bus starvation during BME688 gas sensor heating, the driver splits forced-mode triggering and data readout: SensorTask initiates the measurement, yields CPU execution via osDelay(160) while the heater stabilizes, and acquires g_i2c_mutex again only when measurement registers are ready to fetch.

text
                   SensorTask       UltrasonicTask
                  (BME688/BNO055)     (HC-SR04 x3)
                        │                  │
                        ▼                  ▼
                ┌─────────────────────────────────┐
                │    Thread-Safe Sensor Snapshot  │  (sensors.c: g_sensors)
                └────────────────┬────────────────┘
                                 │
                     ┌───────────┴───────────┐
                     ▼                       ▼
                MappingTask           NavigationTask (State Machine)
             (2D Least-Squares)              │
                     │                       ▼
                     └──────────────►   MotorTask (L298N PWM/GPIO)
                                             │
                                             ▼
                                        DisplayTask (SSD1306 OLED)

Task Scheduling Table

Task NamePeriodPriorityStack SizeRole & Responsibilities
MotorTask50 msosPriorityHigh (40)256 words (1 KB)Translates navigation velocity commands to TIM1 PWM compare values and GPIO directions.
SensorTask250 msosPriorityAboveNormal (32)512 words (2 KB)Triggers BME688 forced-mode gas read and polls BNO055 Euler heading in NDOF mode.
NavTask150 msosPriorityAboveNormal (32)512 words (2 KB)Dead-reckoning position integration, state machine updates, and obstacle avoidance overrides.
USSTask100 msosPriorityNormal (24)256 words (1 KB)Sequentially fires HC-SR04 triggers using TIM4 1 MHz counter with 1 ms inter-ping decay gaps.
MapTask500 msosPriorityNormal (24)512 words (2 KB)Logs spatial samples and solves 2D planar weighted least-squares system for $\nabla G$.
DispTask500 msosPriorityBelowNormal (16)512 words (2 KB)Formats telemetry strings and flushes 1024-byte framebuffer to SSD1306 OLED over I2C.

6. Gas Mapping & Gradient Localization Theory

Standard plume-tracking approaches rely on instantaneous concentration thresholds (if gas > threshold -> move forward). In indoor environments, turbulent eddies and diffusion create local pockets of high concentration, causing naive rovers to stall or oscillate. VaporTrack uses a two-pass planar spatial gradient estimation:

1. Spatial Sample Acquisition

As the rover maneuvers, it logs discrete coordinate tuples: $$S_i = (x_i, y_i, \theta_i, G_i)$$ Where $(x_i, y_i)$ is dead-reckoned position derived from heading $\theta_i$ and differential wheel displacement.

Because the BME688 metal-oxide semiconductor (MOX) sensor's raw resistance $R_{\text{gas}}$ drops when reducing VOC vapors interact with its heated sensing layer, the rover converts raw resistance into relative conductance $G_i$ ($\mu\text{S}$): $$G_i = \frac{10^6}{R_{\text{gas}, i}}$$ This inversion guarantees that $G_i$ increases proportionally with gas plume concentration, allowing standard gradient ascent to naturally steer toward the gas source without sign inversion.

2. Weighted Planar Least-Squares Regression

In the localization phase, the rover models the local gas distribution in a neighborhood of radius R as a first-order planar surface centered at (x, y).

Setting up the normal equations:

text
[ Sum(dx^2)    Sum(dx*dy) ] [ b ] = [ Sum(dx*G) ]
[ Sum(dx*dy)   Sum(dy^2)  ] [ c ] = [ Sum(dy*G) ]

Solving via Cramer's rule:

text
D = Sum(dx^2)*Sum(dy^2) - Sum(dx*dy)^2

b = (Sum(dx*G)*Sum(dy^2) - Sum(dy*G)*Sum(dx*dy)) / D
c = (Sum(dx^2)*Sum(dy*G) - Sum(dx*dy)*Sum(dx*G)) / D

3. Gradient Ascent Steering

The estimated gradient vector gives the direction of steepest concentration change:

text
Grad(G) = [b, c]
target_heading = atan2(c, b)

The rover computes heading error $e_\theta = \theta_{\text{target}} - \theta_{\text{current}}$ and applies differential steering proportional to $e_\theta$. When $|\nabla G|$ drops below the planar detection threshold and $G$ exceeds the plume peak threshold, the rover transitions to NAV_STATE_SOURCE_FOUND.


7. Navigation State Machine & Safety Overrides

text
    ┌──────────────┐
    │  STATE_BOOT  │
    └──────┬───────┘
           │ Hardware peripherals ready
           ▼
    ┌──────────────┐
    │ INIT_SENSORS │
    └──────┬───────┘
           │ I2C devices acknowledged
           ▼
    ┌──────────────┐
    │ CALIBRATION  │◄────────┐ BNO055 NDOF cal dance
    └──────┬───────┘         │ (sys >= 1, gyro+mag >= 2)
           │ Calibration OK  │
           ▼                 │
    ┌──────────────┐         │
    │   MAPPING    ├─────────┘
    └──────┬───────┘
           │ Waypoint quota reached (>= 64 samples)
           ▼
    ┌──────────────┐
    │ LOCALIZATION │
    └──────┬───────┘
           │ Valid gradient computed (|grad| > threshold)
  • Obstacle Preemption: If dist_front_cm < 20.0 cm or either side sensor detects an obstacle < 15.0 cm, the rover immediately halts forward movement and transitions into NAV_STATE_OBSTACLE_AVOID.
  • Escape Maneuver: The rover pivots away from the closer side until clearance exceeds 40.0 cm, then restores the previous state to resume gradient navigation.

8. Repository Layout

text
VaporTrack/
├── Core/
│   ├── Inc/
│   │   ├── bme688.h           # Bosch BME688 MOX gas & environmental driver header
│   │   ├── bno055.h           # Bosch BNO055 9-DOF IMU & Euler orientation header
│   │   ├── hcsr04.h           # 3-channel HC-SR04 ultrasonic driver header
│   │   ├── ssd1306.h          # 128x64 OLED framebuffer driver & font header
│   │   ├── motor.h            # L298N differential drive & PWM interface header
│   │   ├── sensors.h          # Mutex-protected thread-safe sensor snapshot header
│   │   ├── mapping.h          # 2D spatial sample grid & least-squares gradient header
│   │   ├── navigation.h       # Autonomous finite state machine & obstacle avoidance header
│   │   ├── main.h             # Pin assignments, peripheral exports, and clock macros
│   │   └── FreeRTOSConfig.h   # FreeRTOS kernel configuration (32 KB heap, FPU enabled)
│   └── Src/
│       ├── bme688.c           # BME688 register access & datasheet compensation formulas
│       ├── bno055.c           # BNO055 NDOF mode setup & Euler heading acquisition
│       ├── hcsr04.c           # TIM4 microsecond pulse width timing & distance calculation
│       ├── ssd1306.c          # Framebuffer manipulation & 6x8 ASCII font renderer
│       ├── motor.c            # TIM1 PWM duty update & GPIO direction control
│       ├── sensors.c          # Global sensor snapshot & FreeRTOS mutex synchronization
│       ├── mapping.c          # Planar regression solver using Cramer's rule
│       ├── navigation.c       # Navigation state machine, steering laws & obstacle overrides
│       ├── main.c             # System clock setup, peripheral init & FreeRTOS task threads
│       └── stm32f4xx_hal_msp.c# Low-level MSP peripheral clock and GPIO initialization

9. Building and Flashing

Toolchain Prerequisites

  • CMake $\ge$ 3.22
  • Ninja or Make
  • GNU Arm Embedded Toolchain (arm-none-eabi-gcc $\ge$ 10.3)
  • stlink-tools or OpenOCD

Compilation

bash
# Clone repository
git clone https://github.com/Samuel-Habib/VaporTrack.git
cd VaporTrack

# Configure build directory
cmake -DCMAKE_TOOLCHAIN_FILE=cmake/gcc-arm-none-eabi.cmake -DCMAKE_BUILD_TYPE=Debug -B build

# Build ELF and generate binary
cmake --build build -j$(nproc 2>/dev/null || sysctl -n hw.logicalcpu)

Flashing to STM32 Target

bash
# Flash using CMake target (via st-flash)
cmake --build build --target flash

# Or flash binary directly with st-flash
st-flash --connect-under-reset --reset write build/vapor_track.bin 0x08000000

# Or using OpenOCD
openocd -f openocd.cfg -c "program build/vapor_track.elf verify reset exit"

10. Bench Calibration & Verification

  1. IMU Heading Calibration: On power-up, the rover remains stationary for 3 seconds to let the gyroscope calibrate, then executes a slow rotational pivot. The OLED displays CAL S:<sys> G:<gyro> M:<mag>. Once mag >= 2 and gyro == 3, calibration locks.
  2. Ultrasonic Ranging Verification: Each channel can be probed on PC1, PC3, and PC5 with a logic analyzer. A 10 µs pulse on trigger generates an echo high pulse between 116 µs (2 cm) and 23.2 ms (400 cm).
  3. VOC Sensor Response Verification: Exposing the BME688 to an isopropyl alcohol vapor source causes the MOX sensor resistance $R_{gas}$ to drop sharply from ~150 kΩ to < 10 kΩ. The OLED reflects real-time $R_{gas}$ drops and computes gradient vector arrows on the display.
  4. Motor Differential Trim: If the chassis drifts slightly under equal PWM duty cycles due to motor gearbox variance, adjust NAV_SPEED_CRUISE offsets in Core/Inc/navigation.h.

11. License

This project is licensed under the MIT License - see the LICENSE file for details.

Parts

29
QtyValueFootprintReferences
4CCapacitor_SMD:C_0805_2012MetricC6, C7, C8, C9
2100nFCapacitor_SMD:C_0805_2012MetricC3, C5
210uFCapacitor_SMD:C_0805_2012MetricC1, C2
24.7kResistor_SMD:R_0805_2012MetricR2, R3
110kResistor_SMD:R_0805_2012MetricR1
12.2uFCapacitor_SMD:C_0805_2012MetricC4
1330Resistor_SMD:R_0805_2012MetricR4
1AMS1117-3.3Package_TO_SOT_SMD:SOT-223-3_TabPin2U1
1Conn_01x02Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJ1
1Conn_01x05Connector_PinHeader_2.54mm:PinHeader_1x05_P2.54mm_VerticalJ2
1J_BME688Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ3
1J_BNO055Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ4
1J_HC_SR04_1Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ6
1J_HC_SR04_2Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ7
1J_HC_SR04_3Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ8
1J_OLEDConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ5
1L298NConnector_PinHeader_2.54mm:PinHeader_1x07_P2.54mm_VerticalJ9
1LEDLED_SMD:LED_0805_2012MetricD1
1STM32F446RETxPackage_QFP:LQFP-64_10x10mm_P0.5mmU2

The 25 most common of 29 parts.

Similar boards

  • 2 layers99.9 × 99.9 mmMaquina compostaje, the printed circuit board in 3D

    Maquina compostaje

    dani0421/Compostaje

    El SDA se conecta al pin 33 del ESP32 y el SCL al pin 36 de ESP32, cabe resaltar que en la placa no quedaran orificios para la pantalla, unicamente los pines para hacer la conexión.

    103 parts
  • 4 layers142.3 × 80.5 mmFinal Version, the printed circuit board in 3D

    Final Version

    elshazlio/ecng4504-maze-solver_team_5

    ECNG 4504 (AUC, Spring 2026): autonomous maze-learning & solving robot — MCU (Arduino), Python BLE host app, KiCAD/docs, team deliverables. Single monorepo per course charter.

    99 partsMIT
  • 2 layers204.5 × 100.3 mmCarrinho remoto, the printed circuit board in 3D

    Carrinho remoto

    phbnascimento/carrinho-pizza

    Código fonte, documentação, esquemáticos e PCB do projeto "Gigantes de MDF"

    48 parts
  • 2 layers216.3 × 115.1 mmElectric AI Wheelchair, the printed circuit board in 3D

    Electric AI Wheelchair

    prisca7c/Customized-AI-Electric-Wheelchair

    Manual wheelchair turned electric! This wheelchair uses electronic components such as modules and a PCB to make this wheelchair much for user interactive (and helps make life easier when you can't walk).

    129 parts
  • 2 layers70 × 85 mmXkong13 battlebot, the printed circuit board in 3D

    Xkong13 battlebot

    yuxinz310/antweight-battlebot

    ESP32-based Wi-Fi-controlled antweight combat robot featuring two-motor differential drive, custom PCB design, a servo-actuated weapon, and integrated safety mechanisms.

    30 parts
  • 2 layers80 × 90.5 mmLine Follower, the printed circuit board in 3D

    Line Follower

    Zaworek03/Line-Follower

    67 parts
  • 2 layers76.1 × 85 mmFlypi, the printed circuit board in 3D

    Flypi

    amchagas/Flypi

    This is the repository for the flypi project

    45 parts88GPL-2.0

Questions

How big is the VaporTrack Board PCB?

It measures 65 × 65 mm and has 2 copper layers, 1.6 mm thick.

What parts does the VaporTrack Board use?

29 parts, built around the L298N and AMS1117-3.3. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the VaporTrack Board KiCad files?

From the Samuel-Habib/VaporTrack repository on GitHub, at the commit this page was made from: the board is hardware/VaporTrack_Board.kicad_pcb and its schematic hardware/VaporTrack_Board.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the VaporTrack Board design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).