A digital systems project for detecting and analyzing road anomalies using ESP32 and gyroscope sensors to quantify the impact of road-induced motions on driver health parameters.
Road conditions significantly influence driver health through Whole-Body Vibration (WBV) and Driver Stress (DS). This mobile application works in conjunction with ESP32 hardware to collect real-world, low-cost road data and link measurable road-induced motions with physiological outcomes.
- WBV from road surfaces affects driver vigilance and increases stress
- 55.30% of professional drivers experience Low Back Pain (LBP)
- Poor road conditions impair attention and decision-making ability
- Long-term exposure leads to musculoskeletal disorders and increased accident risk
Using ESP32 microcontrollers with integrated gyroscope and accelerometer sensors, we collect comprehensive road quality data including:
- Multi-sensor motion data (gyroscope, accelerometer)
- GPS coordinates per sample
- Weather conditions per session
- Exportable CSV data for analysis
- Node.js (LTS version) - Download here
- Expo Go app on your smartphone (iOS | Android)
- Computer and smartphone on the same WiFi network
git clone https://github.com/yourusername/MyGyroApp.git
cd MyGyroAppnpm install# Copy the example environment file
cp .env.example .env
# Edit .env with your API keys and configuration
# Required variables:
# - API_URL: Your backend API endpoint (default: https://dummyjson.com/)
# - SECRET_KEY: Application secret key
# - WEATHER_API_KEY: Weatherstack API key for weather data (get free key at https://weatherstack.com/)
# - VAR_NUMBER: Numeric configuration variable
# - VAR_BOOL: Boolean configuration variablenpm start- iOS: Open Camera app and scan the QR code
- Android: Open Expo Go app and scan the QR code
The app will load automatically on your device!
Record comprehensive motion data from your device's sensors including:
- Gyroscope: Angular velocity measurements (X, Y, Z axes)
- Accelerometer: Linear acceleration data
- Magnetometer: Orientation and heading information
- Configurable sampling rate for different use cases
- Real-time location tracking during recording sessions
- GPS coordinates captured per sample
- Location accuracy indicators
- Distance and speed calculations
- Route visualization on maps
- Driving History Map: Interactive map showing all recorded routes with start/end points
- Interactive Markers: Tap on route to see detailed sensor data at that location
- Real-time Monitoring: Dedicated dashboard for G-force monitoring
- Shock Detection: Automatically flags road anomalies (>1.5g)
- Impact Mapping: Red markers on the map pinpointing where impacts occurred
- Severity Classification: Distinguishes between minor bumps and severe impacts
- Automatic weather data collection per session
- Temperature, humidity, and atmospheric pressure
- Weather conditions (clear, rainy, cloudy, etc.)
- Correlation between weather and road conditions
- CSV Export: Export all recorded data in CSV format
- Session Management: View, organize, and delete recording sessions
- Data Visualization: Charts and graphs for sensor data
- Sharing: Share exported data via email or cloud storage
- Onboarding: Comprehensive project overview and feature introduction
- Project Overview: Detailed explanation of research goals and methodology
- Recording Interface: Real-time sensor data visualization
- History: Browse and manage past recording sessions
- Settings: Customize app preferences and language
- Multi-language support (English, Arabic)
- RTL (Right-to-Left) layout support
- Easy language switching in settings
- Light and dark mode support
- Automatic theme detection based on system preferences
- Smooth theme transitions
Comprehensive introduction to MyGyroApp and its research objectives
Detailed explanation of the road anomaly detection methodology
Real-time sensor data visualization during active recording
Browse and manage past recording sessions
Main dashboard for sensor monitoring and recording controls
App configuration, language selection, and theme preferences
Interactive map showing GPS routes and impact markers
Real-time G-force meter and impact history
- React Native (0.81.5) - Cross-platform mobile development
- Expo (~54.0.25) - Development platform and tooling
- Expo Router (~6.0.15) - File-based navigation system
- TypeScript (~5.9.2) - Type-safe JavaScript
- NativeWind (4.1.21) - Tailwind CSS for React Native
- Tailwind CSS (^3.4.0) - Utility-first CSS framework
- Lucide React Native (^0.554.0) - Icon library
- Moti (^0.30.0) - Animations library
- MobX (^6.15.0) - Reactive state management
- MobX React Lite (^4.1.1) - React bindings for MobX
- MobX Persist Store (^1.1.8) - State persistence
- React Hook Form (^7.63.0) - Form handling
- Zod (^4.1.11) - Schema validation
- @hookform/resolvers (^5.2.2) - Validation resolvers
- React Native Gifted Charts (^1.4.68) - Charts and graphs
- React Native SVG (15.11.2) - SVG rendering
- Expo Sensors (~15.0.7) - Gyroscope, accelerometer, magnetometer
- Expo Location (~19.0.7) - GPS and location services
- Expo Device (~8.0.9) - Device information
- React Native Maps (1.20.1) - Interactive map components
- Expo File System (~19.0.19) - File operations
- Expo Sharing (~14.0.7) - File sharing capabilities
- AsyncStorage (2.2.0) - Local data persistence
- Axios (^1.7.5) - HTTP client
- @tanstack/react-query (^5.90.2) - Data fetching and caching
- i18next (^25.5.3) - Internationalization framework
- react-i18next (^16.0.0) - React bindings for i18next
- ESLint (^9.25.1) - Code linting
- Prettier (^3.2.5) - Code formatting
- Babel (^7.20.0) - JavaScript compiler
- Offline Mode: Weather data requires internet connection
- Battery Consumption: Continuous sensor recording drains battery faster
- Storage: Large recording sessions may consume significant device storage
- Background Recording: iOS limitations on background sensor access
- iOS: Background location tracking requires additional permissions
- Android: Some devices may have sensor calibration issues
-
Real-time Analysis
- On-device machine learning for road quality classification
- Instant anomaly detection alerts
- Severity scoring for detected anomalies
-
Cloud Integration
- Automatic cloud backup of recording sessions
- Collaborative data sharing with research teams
- Centralized database for road quality mapping
-
Enhanced Visualization
- 3D road surface reconstruction
- Heat maps for road quality
- Interactive route playback with sensor overlay
-
Hardware Integration
- Direct ESP32 Bluetooth connectivity
- Real-time data streaming from external sensors
- Multi-device synchronization
-
Advanced Analytics
- Driver health impact predictions
- Route optimization based on road quality
- Comparative analysis across different road types
-
Social Features
- Community-driven road quality reports
- Crowdsourced road anomaly database
- Driver health statistics and insights
- Integration with vehicle OBD-II data
- Correlation with traffic accident statistics
- Long-term driver health monitoring
- Policy recommendation generation
MyGyroApp/
βββ src/
β βββ app/ # Application screens (file-based routing)
β β βββ (app)/ # Protected app screens
β β β βββ index.tsx # History/Home screen
β β β βββ style.tsx # Project Overview screen
β β β βββ mygyro.tsx # Sensor dashboard
β β β βββ map.tsx # Driving history map
β β β βββ impacts.tsx # Impact detection monitor
β β β βββ profile.tsx # User profile
β β β βββ settings.tsx # App settings
β β β βββ _layout.tsx # Tab navigation layout
β β βββ (auth)/ # Authentication screens
β β β βββ onboarding.tsx # Onboarding flow
β β β βββ login.tsx # Login screen
β β βββ providers/ # Context providers
β β βββ _layout.tsx # Root layout
β βββ components/ # Reusable UI components
β β βββ ui/ # Base UI components
β β βββ settings/ # Settings components
β β βββ weather-widget.tsx # Weather display
β βββ stores/ # MobX state stores
β β βββ auth-store.ts # Authentication state
β β βββ ui-language-store.ts # Language preferences
β β βββ ui-theme-store.ts # Theme preferences
β βββ lib/ # Utilities and helpers
β β βββ i18n/ # Internationalization
β β βββ logger.ts # Logging utilities
β βββ translations/ # Language files
βββ assets/ # Images, fonts, etc.
βββ .env.example # Environment variables template
βββ app.config.js # Expo configuration
βββ eas.json # EAS Build configuration
βββ package.json # Dependencies
This application is part of a comprehensive study on:
- Whole-Body Vibration (WBV) effects on professional drivers
- Driver Stress (DS) correlation with road geometry
- Low Back Pain (LBP) prevalence in occupational driving
- Road infrastructure impact on public health
- Quantify measurable road-induced motions
- Link road quality data to physiological outcomes
- Provide evidence for road infrastructure improvements
- Support occupational health policies for professional drivers
Important: Never commit sensitive values to the repository.
| Variable | Description | Required | Default |
|---|---|---|---|
API_URL |
Backend API endpoint | No | https://dummyjson.com/ |
SECRET_KEY |
Application secret key | No | - |
WEATHER_API_KEY |
Weatherstack API key | Yes | Fallback provided |
VAR_NUMBER |
Numeric configuration | No | 0 |
VAR_BOOL |
Boolean configuration | No | false |
The app uses Weatherstack for weather data:
- Sign up for a free API key at weatherstack.com
- Add
WEATHER_API_KEY=your_key_hereto your.envfile - Note: A fallback key is provided in
src/lib/env.tsfor development, but you should use your own key
- Copy
.env.exampleto.env - Fill in your API keys and configuration
- The
.envfile is gitignored by default
Use your CI provider's secret management:
- GitHub Actions: Repository Settings β Secrets
- EAS Build:
eas secret:create
Example GitHub Actions workflow:
env:
API_URL: ${{ secrets.API_URL }}
SECRET_KEY: ${{ secrets.SECRET_KEY }}
WEATHER_API_KEY: ${{ secrets.WEATHER_API_KEY }}- Ensure both devices are on the same WiFi network
- Restart the Metro bundler:
npm start -- --reset-cache - Clear Expo cache:
expo start --clear - Restart Expo Go app on your device
- Check device permissions (Location, Motion & Fitness)
- Ensure sensors are available on your device
- Try restarting the app
- Check device sensor calibration
- Enable Location Services in device settings
- Grant location permissions to Expo Go
- Ensure you're outdoors or near a window for better signal
- Check if location services are enabled for the app
- Grant storage permissions
- Ensure sufficient device storage
- Check file system permissions
- Try a different export format
Built with β€οΈ for safer roads and healthier drivers