# namrathalb/safe-ride architecture

> Architecture diagram of the GitHub repository namrathalb/safe-ride, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/namrathalb/safe-ride
- Repository: https://github.com/namrathalb/safe-ride

## Overview

Safe-Ride is a road-hazard sensing and awareness project: vehicle-mounted accelerometer and GPS readings are intended to locate potholes and humps, then inform later drivers. The clearest implemented capture workflow is Method 1, which reads both sensors and appends timestamped readings to a CSV; Method 2 is an alternative live-reading script. The README describes cloud storage and range-based voice alerts, but the sampled code does not implement them. Classification materials and standalone GPS experiments are included; their detailed runtime relationships are not established by the excerpts.

Main entry points: [`Classification Algorithm/Algorithm.ipynb`](https://github.com/namrathalb/safe-ride/blob/master/Classification%20Algorithm/Algorithm.ipynb) (Hazard classification), [`Source/Method 1/sf1.py`](https://github.com/namrathalb/safe-ride/blob/master/Source/Method%201/sf1.py) (GPS + sensor capture), [`Source/Method 2/sf2.py`](https://github.com/namrathalb/safe-ride/blob/master/Source/Method%202/sf2.py) (Live GPS + sensor), [`accelemeter/MPU6050.py`](https://github.com/namrathalb/safe-ride/blob/master/accelemeter/MPU6050.py) (Accelerometer reader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Sensor capture"]
  node_capture1["GPS + sensor capture<br/>[sf1.py]"]
  node_capture2["Live GPS + sensor<br/>[sf2.py]"]
  node_sensorreader["Accelerometer reader<br/>[MPU6050.py]"]
  node_readings["Sensor readings CSV"]
end

subgraph group_gps["GPS experiments"]
  node_gpsserial["Serial GPS reader<br/>[GPS.py]"]
  node_gpsparser["NMEA GPS parser<br/>[Neo6mGPS.py]"]
  node_gpsd["gpsd polling<br/>[gpsdData.py]"]
end

subgraph group_classification["Hazard classification"]
  node_classification["Hazard classification<br/>[Algorithm.ipynb]"]
  node_dataset1["Classification dataset 1<br/>[Dataset-1.csv]"]
  node_dataset2["Classification dataset 2<br/>[Dataset-2.csv]"]
  node_dataset3["Classification dataset 3<br/>[Dataset-3.csv]"]
  node_potholes["Pothole results view<br/>[Potholes.html]"]
  node_speedbreakers["Speed-breaker results"]
  node_map["Hazard map<br/>[map.html]"]
end

subgraph group_awareness["Road awareness"]
  node_cloud[("Road hazard cloud database")]
  node_alerts["Proximity voice alerts"]
end

node_driver(("Driver"))
node_raspberry["Raspberry Pi"]
node_mpu["MPU6050 sensor"]
node_gpshw["GPS receiver"]

node_raspberry -->|"runs on"| node_capture1
node_mpu -->|"provides readings"| node_capture1
node_gpshw -->|"provides NMEA"| node_capture1
node_capture1 -->|"appends readings"| node_readings
node_raspberry -->|"runs on"| node_capture2
node_mpu -->|"provides readings"| node_capture2
node_gpshw -->|"provides NMEA"| node_capture2
node_raspberry -->|"runs on"| node_sensorreader
node_mpu -->|"provides readings"| node_sensorreader
node_gpshw -->|"provides NMEA"| node_gpsserial
node_gpshw -->|"provides NMEA"| node_gpsparser
node_gpsd -->|"prints fix data"| node_driver
node_dataset1 -.->|"classification input"| node_classification
node_dataset2 -.->|"classification input"| node_classification
node_dataset3 -.->|"classification input"| node_classification
node_classification -.->|"hazard results"| node_potholes
node_classification -.->|"hazard results"| node_speedbreakers
node_classification -.->|"mapped results"| node_map
node_driver -.->|"reads road data"| node_cloud
node_cloud -.->|"supplies hazard locations"| node_alerts
node_alerts -.->|"voices warnings"| node_driver
node_capture1 -.->|"stores sensed data"| node_cloud

click node_capture1 "https://github.com/namrathalb/safe-ride/blob/master/Source/Method%201/sf1.py"
click node_capture2 "https://github.com/namrathalb/safe-ride/blob/master/Source/Method%202/sf2.py"
click node_sensorreader "https://github.com/namrathalb/safe-ride/blob/master/accelemeter/MPU6050.py"
click node_readings "https://github.com/namrathalb/safe-ride/blob/master/Source/Method%201/sensor_readings.csv"
click node_gpsserial "https://github.com/namrathalb/safe-ride/blob/master/GPS%20Module/Approch-1/GPS.py"
click node_gpsparser "https://github.com/namrathalb/safe-ride/blob/master/GPS%20Module/Appraoch%202/Neo6mGPS.py"
click node_gpsd "https://github.com/namrathalb/safe-ride/blob/master/GPS%20Module/Appraoch%202/gpsdData.py"
click node_classification "https://github.com/namrathalb/safe-ride/blob/master/Classification%20Algorithm/Algorithm.ipynb"
click node_dataset1 "https://github.com/namrathalb/safe-ride/blob/master/Classification%20Algorithm/Dataset-1.csv"
click node_dataset2 "https://github.com/namrathalb/safe-ride/blob/master/Classification%20Algorithm/Dataset-2.csv"
click node_dataset3 "https://github.com/namrathalb/safe-ride/blob/master/Classification%20Algorithm/Dataset-3.csv"
click node_potholes "https://github.com/namrathalb/safe-ride/blob/master/Classification%20Algorithm/Potholes.html"
click node_speedbreakers "https://github.com/namrathalb/safe-ride/blob/master/Classification%20Algorithm/Speed_Breakers.html"
click node_map "https://github.com/namrathalb/safe-ride/blob/master/Classification%20Algorithm/map.html"

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_capture1,node_capture2,node_sensorreader,node_readings toneBlue
class node_gpsserial,node_gpsparser,node_gpsd toneAmber
class node_classification,node_dataset1,node_dataset2,node_dataset3,node_potholes,node_speedbreakers,node_map toneMint
class node_cloud,node_alerts toneRose
class node_driver,node_raspberry,node_mpu,node_gpshw toneIndigo
```

## Components

### Sensor capture

- [GPS + sensor capture](https://github.com/namrathalb/safe-ride/blob/master/Source/Method%201/sf1.py): `Source/Method 1/sf1.py`
- [Live GPS + sensor](https://github.com/namrathalb/safe-ride/blob/master/Source/Method%202/sf2.py): `Source/Method 2/sf2.py`
- [Accelerometer reader](https://github.com/namrathalb/safe-ride/blob/master/accelemeter/MPU6050.py): `accelemeter/MPU6050.py`
- [Sensor readings CSV](https://github.com/namrathalb/safe-ride/blob/master/Source/Method%201/sensor_readings.csv): `Source/Method 1/sensor_readings.csv`

### GPS experiments

- [Serial GPS reader](https://github.com/namrathalb/safe-ride/blob/master/GPS%20Module/Approch-1/GPS.py): `GPS Module/Approch-1/GPS.py`
- [NMEA GPS parser](https://github.com/namrathalb/safe-ride/blob/master/GPS%20Module/Appraoch%202/Neo6mGPS.py): `GPS Module/Appraoch 2/Neo6mGPS.py`
- [gpsd polling](https://github.com/namrathalb/safe-ride/blob/master/GPS%20Module/Appraoch%202/gpsdData.py): `GPS Module/Appraoch 2/gpsdData.py`

### Hazard classification

- [Hazard classification](https://github.com/namrathalb/safe-ride/blob/master/Classification%20Algorithm/Algorithm.ipynb): `Classification Algorithm/Algorithm.ipynb`
- [Classification dataset 1](https://github.com/namrathalb/safe-ride/blob/master/Classification%20Algorithm/Dataset-1.csv): `Classification Algorithm/Dataset-1.csv`
- [Classification dataset 2](https://github.com/namrathalb/safe-ride/blob/master/Classification%20Algorithm/Dataset-2.csv): `Classification Algorithm/Dataset-2.csv`
- [Classification dataset 3](https://github.com/namrathalb/safe-ride/blob/master/Classification%20Algorithm/Dataset-3.csv): `Classification Algorithm/Dataset-3.csv`
- [Pothole results view](https://github.com/namrathalb/safe-ride/blob/master/Classification%20Algorithm/Potholes.html): `Classification Algorithm/Potholes.html`
- [Speed-breaker results](https://github.com/namrathalb/safe-ride/blob/master/Classification%20Algorithm/Speed_Breakers.html): `Classification Algorithm/Speed_Breakers.html`
- [Hazard map](https://github.com/namrathalb/safe-ride/blob/master/Classification%20Algorithm/map.html): `Classification Algorithm/map.html`

### Road awareness

- **Road hazard cloud database**
- **Proximity voice alerts**

### Other components

- **Driver**
- **Raspberry Pi**
- **MPU6050 sensor**
- **GPS receiver**

## Connections

- Raspberry Pi → GPS + sensor capture: runs on (evidence: `Source/Method 1/sf1.py`)
- MPU6050 sensor → GPS + sensor capture: provides readings (evidence: `Source/Method 1/sf1.py`)
- GPS receiver → GPS + sensor capture: provides NMEA (evidence: `Source/Method 1/sf1.py`)
- GPS + sensor capture → Sensor readings CSV: appends readings (evidence: `Source/Method 1/sf1.py`)
- Raspberry Pi → Live GPS + sensor: runs on (evidence: `Source/Method 2/sf2.py`)
- MPU6050 sensor → Live GPS + sensor: provides readings (evidence: `Source/Method 2/sf2.py`)
- GPS receiver → Live GPS + sensor: provides NMEA (evidence: `Source/Method 2/sf2.py`)
- Raspberry Pi → Accelerometer reader: runs on (evidence: `accelemeter/MPU6050.py`)
- MPU6050 sensor → Accelerometer reader: provides readings (evidence: `accelemeter/MPU6050.py`)
- GPS receiver → Serial GPS reader: provides NMEA (evidence: `GPS Module/Approch-1/GPS.py`)
- GPS receiver → NMEA GPS parser: provides NMEA (evidence: `GPS Module/Appraoch 2/Neo6mGPS.py`)
- gpsd polling → Driver: prints fix data (evidence: `GPS Module/Appraoch 2/gpsdData.py`)
- Classification dataset 1 → Hazard classification: classification input
- Classification dataset 2 → Hazard classification: classification input
- Classification dataset 3 → Hazard classification: classification input
- Hazard classification → Pothole results view: hazard results
- Hazard classification → Speed-breaker results: hazard results
- Hazard classification → Hazard map: mapped results
- Driver → Road hazard cloud database: reads road data (evidence: `README.md`)
- Road hazard cloud database → Proximity voice alerts: supplies hazard locations (evidence: `README.md`)
- Proximity voice alerts → Driver: voices warnings (evidence: `README.md`)
- GPS + sensor capture → Road hazard cloud database: stores sensed data (evidence: `README.md`)
