Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Dashboard UI

ESP32 IoT Vehicle Tracking System

Overview

This project is an autonomous IoT vehicle tracking system built using an ESP32 microcontroller. The device automatically detects journeys using a combination of GPS and accelerometer data, records telemetry to local storage, and seamlessly uploads completed trip information to a server when a trusted Wi-Fi network becomes available. The collected data can be visualized through a companion web application to review routes, monitor driving behavior, and analyze vehicle usage.

Key Features

  • Automatic Journey Tracking: Detects trip start and end automatically using a finite state machine; no user interaction required during normal operation.
  • Local Data Logging: Writes telemetry data to a microSD card in CSV format, preventing data loss when internet connectivity is unavailable.
  • Auto Wi-Fi Uploads: Connects to a predefined Wi-Fi network upon returning to a "home zone" to upload trip files and download remote configuration updates via HTTP.
  • Power Management: Utilizes ESP32 deep sleep and wakeup timers when inactive to reduce energy consumption.
  • Fault Indication & Manual Override: Includes an LED to alert users to operational issues (e.g., GPS fix failure, SD card errors, failed uploads) and a push button to trigger manual data uploads.
  • Remote Configuration: Downloads operational parameters remotely via a stable HTTPS endpoint, avoiding the need to reflash firmware.

Hardware Components

  • ESP32 Microcontroller: Central controller managing peripherals and Wi-Fi communication.
  • NEO-6M GPS Module: Captures latitude, longitude, speed, altitude, time, and satellite count via UART communication.
  • LIS3DH Accelerometer: Measures XYZ acceleration for movement detection via I2C communication.
  • microSD Card Module: Provides local storage for trip CSV files via SPI communication.
  • Power Source: Power bank (used to avoid high 12V car voltage).

System Logic & State Machine

The system operates on a state machine to prevent false trip recordings from brief movements or GPS inaccuracies. The states include: IDLE -> MOVING_CANDIDATE -> TRIP_ACTIVE -> STOPPED_CANDIDATE -> TRIP_ENDED -> UPLOADING -> SLEEPING

  • Start: Triggered by GPS speed exceeding a configurable threshold OR sustained accelerometer movement for a set confirmation period.
  • End: Triggered when GPS speed falls below the threshold AND the accelerometer indicates the vehicle is stationary for a configurable duration.

Data Format

Trip files are stored locally in standard CSV format, allowing easy import into databases or spreadsheet software.

Example record:

timestamp, lat, lon, gps_speed_kmph, altitude, satellites, accel_g
2026-06-04T17:10:15Z, 51.294750, 1.062858, 34.2, 73.4, 7, 1.02

Network Communication & Security

  • Protocol: HTTP over Wi-Fi (chosen for native ESP32 support and REST API integration).
  • Endpoints: Uses Cloudflare Tunnels and a custom domain to provide stable HTTPS endpoints, resolving dynamic IP and local network restriction issues.
  • Security: Trusted Wi-Fi network uploads and server-controlled device configurations.

Future Work

  • Battery operation optimization.
  • Complete GPS power mode switching and LIS3DH interrupt-based wakeup.
  • Authentication tokens for improved security.
  • Machine Learning (ML) crash detection.
  • External cloud deployment of backend analytics and mobile application development.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages