Skip to content

About

AI-powered smart riding helmet with alcohol detection, drowsiness monitoring, GPS tracking, rider safety alerts, and machine learning-based risk assessment.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart Riding Helmet

Machine Learning module for the AI-Based Smart Riding Helmet system. This module analyzes rider behavior using alcohol detection and drowsiness monitoring data to classify rider safety risk levels.


Overview

The Smart Riding Helmet uses sensor data collected from the MQ3 Alcohol Sensor and Eye Blink Sensor to evaluate rider safety. A Support Vector Machine (SVM) model is trained to classify riders into different risk categories based on their behavior and sensor readings.

The trained model can be integrated with the ESP32-based monitoring system and dashboard to provide intelligent safety recommendations and alerts.


Objective

The objective of this module is to:

  • Detect unsafe riding conditions.
  • Analyze alcohol consumption levels.
  • Monitor drowsiness indicators.
  • Classify rider risk levels.
  • Support real-time rider safety monitoring.

Dataset Features

The dataset contains rider behavior and sensor readings collected during testing.

Feature Description
alcohol_level MQ3 sensor alcohol reading
blink_rate Number of eye blinks per minute
eye_closure_duration Eye closure duration in milliseconds
speed Vehicle speed during monitoring
risk_status Target label

Risk Classes

Class Description
Safe Normal riding condition
Caution Moderate risk detected
Danger High-risk riding condition

Feature Engineering

The preprocessing pipeline performs:

  • Duplicate removal
  • Missing value handling
  • Drowsiness score calculation
  • Alcohol risk categorization
  • Speed risk categorization
  • Combined risk score generation
  • Target label encoding

Generated Features:

  • drowsiness_score
  • alcohol_risk
  • speed_risk
  • combined_risk
  • risk_status_encoded

Machine Learning Model

Support Vector Machine (SVM)

Support Vector Machine was selected because it performs well on structured sensor data and provides reliable classification for rider safety prediction.

Configuration

SVC(
    kernel='rbf',
    C=1.0,
    gamma='scale',
    probability=True,
    random_state=42
)

Project Structure

model_training/
│
├── rider_dataset.csv
├── processed_dataset.csv
├── feature_engineering.py
├── svm_training.ipynb
├── train_svm.py
├── svm_model.pkl
├── scaler.pkl
├── confusion_matrix.png
├── accuracy_curve.png
├── requirements.txt
└── README.md

Technologies Used

  • Python
  • Pandas
  • NumPy
  • Scikit-Learn
  • Support Vector Machine (SVM)
  • Matplotlib
  • Joblib
  • Jupyter Notebook

Installation

Install required packages:

pip install -r requirements.txt

Training the Model

Step 1: Feature Engineering

python feature_engineering.py

Output:

processed_dataset.csv

Step 2: Train SVM Model

python train_svm.py

Outputs:

svm_model.pkl
scaler.pkl
confusion_matrix.png
accuracy_curve.png

Model Evaluation

The model is evaluated using:

  • Accuracy
  • Precision
  • Recall
  • F1 Score
  • Confusion Matrix

Generated visualizations:

  • confusion_matrix.png
  • accuracy_curve.png

Sample Prediction Workflow

MQ3 Alcohol Sensor
        +
Eye Blink Sensor
        +
Vehicle Speed
        ↓
Feature Engineering
        ↓
SVM Classifier
        ↓
Risk Prediction
        ↓
Safe / Caution / Danger

Integration with Smart Riding Helmet

The trained SVM model can be integrated with:

  • ESP32 Controller
  • Smart Riding Helmet Dashboard
  • Rider Alert System
  • GPS Tracking Module

to provide intelligent rider safety monitoring and decision support.


Future Improvements

  • Real-time model inference
  • Larger rider dataset
  • GPS-aware risk prediction
  • Deep learning-based drowsiness detection
  • Mobile application integration
  • Cloud-based analytics dashboard

License

This project is developed for educational, research, and portfolio purposes.


Author

Janani V

Machine Learning | IoT | Embedded Systems

GitHub: https://github.com/Janviswa

LinkedIn: https://www.linkedin.com/in/jananiv05/

About

AI-powered smart riding helmet with alcohol detection, drowsiness monitoring, GPS tracking, rider safety alerts, and machine learning-based risk assessment.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages