# saisundarp/smart-rover-safety-telemetry-module architecture

> Architecture diagram of the GitHub repository saisundarp/smart-rover-safety-telemetry-module, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saisundarp/smart-rover-safety-telemetry-module
- Repository: https://github.com/saisundarp/smart-rover-safety-telemetry-module

## Overview

SSTM is an embedded rover safety module: it samples battery, temperature, motion, and proximity sensors, evaluates faults, then reports state over UART and warns locally with an LED and buzzer. The firmware’s task orchestration is concentrated in main.c, with sensor drivers, shared state, and telemetry framing as supporting layers. The repository also includes component, electronics, and PCB design artifacts. Firmware relationships below are grounded in the sampled source and SOURCE INDEX; design-artifact nodes reflect the documented project scope, not an inspected implementation workflow.

Main entry points: [`firmware/src/main.c`](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/main.c) (Sensor acquisition), [`firmware/inc/sensor_state.h`](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/inc/sensor_state.h) (Shared sensor state), [`docs/04_electronics_design.md`](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/docs/04_electronics_design.md) (Electronics design), [`firmware/src/drivers/mpu6050.c`](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/drivers/mpu6050.c) (Motion sensor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Firmware runtime"]
  node_sensor_state["Shared sensor state<br/>[sensor_state.h]"]
  node_fault_config["Fault thresholds<br/>[fault_config.h]"]
  node_acquisition["Sensor acquisition<br/>[main.c]"]
  node_fault_eval["Fault evaluation<br/>[main.c]"]
end

subgraph group_sensing["Sensor drivers"]
  node_ina226["Battery monitor<br/>[ina226.c]"]
  node_tmp102["Temperature sensor<br/>[tmp102.c]"]
  node_mpu6050["Motion sensor<br/>[mpu6050.c]"]
  node_vl53l0x["Proximity sensor<br/>[vl53l0x.c]"]
end

subgraph group_safety_io["Safety and communications"]
  node_telemetry_tx["Telemetry task<br/>[main.c]"]
  node_telemetry_frame["Frame encoding<br/>[telemetry.c]"]
  node_indicator["Local warning<br/>[main.c]"]
  node_watchdog["Task watchdog<br/>[main.c]"]
end

subgraph group_design["Engineering design"]
  node_electronics["Electronics design"]
  node_pcb_design["PCB design<br/>[05_pcb_design.md]"]
  node_bom["Bill of materials<br/>[BOM.xlsx]"]
end

node_rover(("Rover computer"))

node_acquisition -->|"reads battery"| node_ina226
node_acquisition -->|"reads temperature"| node_tmp102
node_acquisition -->|"reads motion"| node_mpu6050
node_acquisition -->|"reads range"| node_vl53l0x
node_acquisition -->|"resets sensor"| node_vl53l0x
node_acquisition -->|"updates state"| node_sensor_state
node_fault_eval -->|"reads snapshot"| node_sensor_state
node_fault_eval -->|"uses thresholds"| node_fault_config
node_fault_eval -->|"calculates tilt"| node_mpu6050
node_fault_eval -->|"triggers on fault"| node_telemetry_tx
node_telemetry_tx -->|"reads state"| node_sensor_state
node_telemetry_tx -->|"builds frame"| node_telemetry_frame
node_telemetry_tx -->|"sends UART"| node_rover
node_indicator -->|"reads faults"| node_sensor_state
node_watchdog -->|"checks liveness"| node_acquisition
node_watchdog -->|"checks liveness"| node_fault_eval
node_watchdog -->|"checks liveness"| node_telemetry_tx
node_watchdog -->|"checks liveness"| node_indicator
node_electronics -.->|"guides layout"| node_pcb_design
node_bom -.->|"lists components"| node_electronics

click node_sensor_state "https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/inc/sensor_state.h"
click node_fault_config "https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/inc/fault_config.h"
click node_acquisition "https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/main.c"
click node_ina226 "https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/drivers/ina226.c"
click node_tmp102 "https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/drivers/tmp102.c"
click node_mpu6050 "https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/drivers/mpu6050.c"
click node_vl53l0x "https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/drivers/vl53l0x.c"
click node_fault_eval "https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/main.c"
click node_telemetry_tx "https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/main.c"
click node_telemetry_frame "https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/telemetry.c"
click node_indicator "https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/main.c"
click node_watchdog "https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/main.c"
click node_electronics "https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/docs/04_electronics_design.md"
click node_pcb_design "https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/docs/05_pcb_design.md"
click node_bom "https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/bom/BOM.xlsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_sensor_state,node_fault_config,node_acquisition,node_fault_eval toneBlue
class node_ina226,node_tmp102,node_mpu6050,node_vl53l0x toneAmber
class node_telemetry_tx,node_telemetry_frame,node_indicator,node_watchdog toneMint
class node_electronics,node_pcb_design,node_bom toneRose
class node_rover toneIndigo
```

## Components

### Firmware runtime

- [Shared sensor state](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/inc/sensor_state.h): `firmware/inc/sensor_state.h`
- [Fault thresholds](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/inc/fault_config.h): `firmware/inc/fault_config.h`
- [Sensor acquisition](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/main.c): `firmware/src/main.c`
- [Fault evaluation](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/main.c): `firmware/src/main.c`

### Sensor drivers

- [Battery monitor](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/drivers/ina226.c): `firmware/src/drivers/ina226.c`
- [Temperature sensor](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/drivers/tmp102.c): `firmware/src/drivers/tmp102.c`
- [Motion sensor](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/drivers/mpu6050.c): `firmware/src/drivers/mpu6050.c`
- [Proximity sensor](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/drivers/vl53l0x.c): `firmware/src/drivers/vl53l0x.c`

### Safety and communications

- [Telemetry task](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/main.c): `firmware/src/main.c`
- [Frame encoding](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/telemetry.c): `firmware/src/telemetry.c`
- [Local warning](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/main.c): `firmware/src/main.c`
- [Task watchdog](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/firmware/src/main.c): `firmware/src/main.c`

### Engineering design

- [Electronics design](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/docs/04_electronics_design.md): `docs/04_electronics_design.md`
- [PCB design](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/docs/05_pcb_design.md): `docs/05_pcb_design.md`
- [Bill of materials](https://github.com/saisundarp/smart-rover-safety-telemetry-module/blob/main/bom/BOM.xlsx): `bom/BOM.xlsx`

### Other components

- **Rover computer**

## Connections

- Sensor acquisition → Battery monitor: reads battery (evidence: `firmware/src/main.c`)
- Sensor acquisition → Temperature sensor: reads temperature (evidence: `firmware/src/main.c`)
- Sensor acquisition → Motion sensor: reads motion (evidence: `firmware/src/main.c`)
- Sensor acquisition → Proximity sensor: reads range (evidence: `firmware/src/main.c`)
- Sensor acquisition → Proximity sensor: resets sensor (evidence: `firmware/src/main.c`)
- Sensor acquisition → Shared sensor state: updates state (evidence: `firmware/src/main.c`)
- Fault evaluation → Shared sensor state: reads snapshot (evidence: `firmware/src/main.c`)
- Fault evaluation → Fault thresholds: uses thresholds (evidence: `firmware/src/main.c`)
- Fault evaluation → Motion sensor: calculates tilt (evidence: `firmware/src/main.c`)
- Fault evaluation → Telemetry task: triggers on fault (evidence: `firmware/src/main.c`)
- Telemetry task → Shared sensor state: reads state (evidence: `firmware/src/main.c`)
- Telemetry task → Frame encoding: builds frame (evidence: `firmware/src/main.c`)
- Telemetry task → Rover computer: sends UART (evidence: `firmware/src/main.c`)
- Local warning → Shared sensor state: reads faults (evidence: `firmware/src/main.c`)
- Task watchdog → Sensor acquisition: checks liveness (evidence: `firmware/src/main.c`)
- Task watchdog → Fault evaluation: checks liveness (evidence: `firmware/src/main.c`)
- Task watchdog → Telemetry task: checks liveness (evidence: `firmware/src/main.c`)
- Task watchdog → Local warning: checks liveness (evidence: `firmware/src/main.c`)
- Electronics design → PCB design: guides layout (evidence: `README.md`)
- Bill of materials → Electronics design: lists components (evidence: `README.md`)
