GPS Hardware and Connectivity: Choosing the Right OBD-II and IoT Stack
The first decision you will make is which hardware plugs into your vehicles. This choice determines everything downstream: data frequency, reliability, cost per vehicle, and which telemetry fields you can access. Get it wrong and you are stuck with a 6-month hardware swap across your entire fleet.
OBD-II dongles are the fastest path to market. Devices like the CalAmp LMU-3640, Geotab GO9, or Quectel EG25-G plug directly into the vehicle's diagnostic port and start transmitting GPS coordinates, engine RPM, fuel level, and diagnostic trouble codes within seconds. Budget $50-150 per device at scale (1,000+ units). The tradeoff: OBD-II only works with vehicles manufactured after 1996, and some data fields vary by manufacturer.
For newer fleets, CAN bus integration gives you richer data. You get access to tire pressure, transmission temperature, brake pad wear sensors, and EV battery state of charge. This requires custom firmware or partnerships with telematics hardware vendors like Samsara, CalAmp, or Continental.
Cellular Connectivity Options
Your devices need cellular connectivity to transmit data back to your servers. The three realistic options in 2026:
- LTE-M (Cat-M1): Best overall choice for fleet tracking. 375 kbps throughput, excellent building penetration, low power consumption. Monthly data costs run $2-5 per device through carriers like Hologram, Soracom, or 1NCE.
- NB-IoT: Lower cost ($1-3/month) but higher latency (1-10 seconds). Works for cargo tracking where you only need updates every 5-60 minutes. Not suitable for real-time driver behavior monitoring.
- 4G LTE (Cat-1/Cat-4): Full bandwidth for dashcam video streaming, firmware OTA updates, and high-frequency telemetry. $8-15/month per device. Use this if your platform includes in-cab video.
Plan for data transmission frequency from the start. Real-time tracking at 1-second intervals generates roughly 2.5 MB per vehicle per day. At 10-second intervals, that drops to 250 KB. Most fleet platforms use adaptive frequency: 1-second during active driving, 60-second when idling, and GPS-off when the ignition is off.
Real-Time Architecture: MQTT, Kafka, and Time-Series Storage
Fleet telemetry is a firehose. A fleet of 5,000 vehicles transmitting at 10-second intervals generates 500 messages per second, each containing GPS coordinates, speed, heading, engine metrics, and diagnostic codes. Your architecture must ingest, process, store, and serve this data without dropping messages or introducing latency that makes the live map useless.
MQTT for Vehicle-to-Cloud Communication
MQTT is the standard protocol for IoT telemetry, and fleet management is no exception. Each vehicle publishes to a topic like fleet/{vehicleId}/telemetry. Your MQTT broker (EMQX, HiveMQ, or AWS IoT Core) handles connection management, message persistence, and QoS levels. Use QoS 1 (at least once delivery) for GPS data. QoS 2 is unnecessary overhead for positional data that arrives every few seconds anyway.
Structure your MQTT topics hierarchically: fleet/{fleetId}/{vehicleId}/{dataType}. This lets your backend subscribe to fleet/+/+/alert for all alerts across all fleets, or fleet/acme-corp/truck-42/# for everything from a specific vehicle. EMQX handles 1M+ concurrent connections on a single cluster, which covers fleets up to 100,000 vehicles.
Kafka for Event Processing
Between MQTT ingestion and storage, you need an event processing layer. Apache Kafka (or AWS MSK, Confluent Cloud) serves as the durable message bus that decouples your ingestion from your processing. Raw telemetry lands in a Kafka topic, then multiple consumers process it in parallel: one writes to TimescaleDB, another runs geofence checks, a third calculates driver safety scores, and a fourth feeds the real-time dashboard.
Partition your Kafka topics by vehicle ID. This guarantees ordered processing per vehicle (critical for calculating trip segments and detecting harsh braking events) while allowing horizontal scaling across partitions. For 5,000 vehicles, 50 partitions gives you room to grow to 50,000.
TimescaleDB for GPS and Telemetry Storage
Standard PostgreSQL falls over when you try to query millions of GPS points across time ranges. TimescaleDB (a PostgreSQL extension) handles time-series data natively with automatic partitioning by time (hypertables), built-in compression (10-20x), and continuous aggregates for pre-computing hourly/daily rollups.
Your core telemetry table stores: timestamp, vehicle_id, latitude, longitude, speed, heading, engine_rpm, fuel_level, odometer, and a JSONB column for device-specific fields. With TimescaleDB compression enabled, expect roughly 50 bytes per row after compression. A 5,000 vehicle fleet at 10-second intervals generates about 13 billion rows per year, consuming approximately 650 GB compressed. That is entirely manageable on a single TimescaleDB instance with proper chunk intervals (1 day for recent data, 1 week for historical).
For real-time architecture patterns beyond fleet management, see our dedicated guide on WebSocket connections, pub/sub systems, and conflict resolution.
Driver Behavior Monitoring and ELD Compliance
Driver behavior analytics separate a basic GPS tracker from a real fleet management platform. Insurance companies offer 10-20% premium discounts for fleets that demonstrate active driver safety monitoring. That alone justifies the development cost for most logistics companies.
Harsh Event Detection
Detecting harsh braking, rapid acceleration, and aggressive cornering requires accelerometer data from the OBD-II device (or the driver's phone if you are building a phone-based solution). The algorithm is straightforward: calculate the G-force from accelerometer readings and flag events exceeding thresholds.
- Harsh braking: Deceleration exceeding 0.4G sustained for 1+ seconds
- Rapid acceleration: Acceleration exceeding 0.35G sustained for 2+ seconds
- Harsh cornering: Lateral G-force exceeding 0.3G
- Speeding: Vehicle speed exceeding posted speed limit by 10+ mph (requires speed limit database from HERE, TomTom, or OpenStreetMap)
Smooth the accelerometer data with a low-pass filter before threshold comparison. Raw accelerometer readings are noisy, especially on rough roads. A simple exponential moving average with alpha=0.3 works well. Without smoothing, you will generate false positives every time a vehicle hits a pothole.
Driver Safety Scores
Aggregate individual events into a composite safety score per driver per week. Weight the events by severity: speeding incidents (3 points), harsh braking (2 points), rapid acceleration (1 point), harsh cornering (2 points). Normalize against miles driven so that drivers covering more ground are not unfairly penalized. A driver logging 3,000 miles with 5 events is safer than one logging 500 miles with 4 events.
ELD and Hours of Service Compliance
If your platform targets commercial vehicles over 10,001 lbs in the US, Electronic Logging Device (ELD) compliance is mandatory under FMCSA regulations. Your platform must track: driving time, on-duty time, off-duty time, and sleeper berth time. Drivers cannot exceed 11 hours of driving within a 14-hour on-duty window after 10 consecutive hours off-duty.
ELD certification requires passing FMCSA's self-certification process and registering on the official ELD list. The technical requirements include: automatic recording of engine hours, vehicle miles, date/time, location (within 1 mile), and driver identification. Your system must support data transfer to law enforcement via Bluetooth, USB, or email in a standardized output format.
Build HOS tracking as a state machine: OFF_DUTY, SLEEPER_BERTH, DRIVING, ON_DUTY_NOT_DRIVING. Transitions happen automatically (engine on = driving) or manually (driver taps "off duty" in the app). Display remaining drive time prominently in the driver app. Alert at 30 minutes and 15 minutes remaining before violation.
Predictive Maintenance: From Reactive to Proactive
Unplanned breakdowns cost commercial fleets an average of $750 per incident in towing, emergency repairs, and missed deliveries. Predictive maintenance uses real-time engine diagnostics and historical patterns to catch failures before they happen. This is where your fleet platform delivers undeniable ROI.
Diagnostic Trouble Codes (DTCs)
Every OBD-II device can read standardized diagnostic codes from the vehicle's ECU. There are over 11,000 standardized DTCs (P0xxx for powertrain, C0xxx for chassis, B0xxx for body, U0xxx for network). Your platform should monitor for active codes, parse their severity, and trigger appropriate workflows.
- Critical (immediate attention): P0217 (engine overheating), P0520 (oil pressure sensor), P06xx (ECM/PCM processor faults). Notify dispatch immediately. Consider routing vehicle to nearest service center.
- Warning (schedule service within 48 hours): P0420 (catalytic converter efficiency), P0171/P0174 (fuel system lean). Vehicle can operate but needs attention.
- Informational (next scheduled maintenance): P0442 (EVAP system small leak, often a loose gas cap), P0455 (large EVAP leak). Low urgency.
Mileage-Based and Time-Based Maintenance Scheduling
Build a maintenance rules engine that tracks service intervals per vehicle. Each vehicle type has different intervals: oil change every 7,500 miles (synthetic) or 3,000 miles (conventional), tire rotation every 5,000 miles, brake inspection every 12,000 miles, transmission fluid every 60,000 miles. Let fleet managers customize these intervals per vehicle or vehicle class.
Track actual odometer readings from the OBD-II device rather than relying on estimated mileage. Calculate projected service dates based on average daily mileage. If a vehicle averages 150 miles per day and the next oil change is due in 2,000 miles, surface that as "service needed in approximately 13 days."
Pattern-Based Failure Prediction
After 6-12 months of collecting telemetry data across a fleet, you have enough signal to build predictive models. Common patterns that precede failures: gradual increase in engine temperature over 2-3 weeks (cooling system degradation), increasing fuel consumption without load changes (injector clogging), intermittent DTC codes appearing then clearing (electrical connection issues about to become permanent).
Start simple. A rules-based system that flags anomalies (engine temp 15% above rolling 30-day average) delivers 80% of the value. Save the machine learning models for after you have 12+ months of failure data to train on. Most startups waste months building ML pipelines when a few SQL queries against TimescaleDB continuous aggregates would have caught the same issues.
EV Fleet Integration: Battery Management and Charging Optimization
By 2026, 15-20% of new commercial fleet orders are electric vehicles. Your platform needs native EV support or you will lose customers to competitors who have it. EV fleet management introduces challenges that do not exist for ICE vehicles: range anxiety, charging infrastructure, battery degradation, and energy cost optimization.
Battery State of Charge and Range Estimation
EV telemetry includes battery state of charge (SoC, 0-100%), state of health (SoH, battery degradation over time), current range estimate, and charging status. Pull this data via the vehicle's CAN bus or through manufacturer APIs (Tesla Fleet API, Rivian Commercial API, Ford Pro Telematics).
Range estimation for fleet operations is more complex than the number on the dashboard. Actual range depends on cargo weight, ambient temperature, HVAC usage, driving style, terrain, and highway vs. city routing. Build a range model specific to each vehicle that accounts for these variables. A Ford E-Transit loaded with 3,000 lbs of cargo in 20 degree weather has a very different effective range than the same van empty in 70 degree weather.
Charging Station Routing and Scheduling
Integrate charging station data from OCPP (Open Charge Point Protocol) networks, or aggregate from APIs like Open Charge Map, PlugShare, and the NREL Alternative Fuels Station Locator. Your routing engine must factor in: current SoC, distance to destination, available chargers along the route, charger power level (Level 2 vs DC fast charging), and estimated wait times.
For depot charging (vehicles that return to a home base nightly), build a charging schedule optimizer. If you have 50 EVs and 20 Level 2 chargers (7.7 kW each), you cannot charge everything simultaneously. The optimizer should consider: departure time per vehicle, current SoC, required SoC at departure, electricity rate schedules (off-peak rates are typically 40-60% cheaper between 11 PM and 6 AM), and demand charges (penalties for exceeding peak kW draw).
Battery Health Tracking
Track battery degradation over the vehicle's lifetime. SoH drops gradually (typically 2-3% per year for modern lithium-ion packs) but accelerates with frequent DC fast charging, deep discharge cycles, and extreme temperatures. Alert fleet managers when SoH drops below 80% (common warranty threshold) and project when each vehicle will need a battery replacement based on its degradation curve.
This is conceptually similar to IoT app development patterns where you track device health metrics over time and surface anomalies before they become failures.
Geofencing, Route Optimization, and Live Map Dashboard
Geofencing transforms passive GPS tracking into active fleet control. Instead of watching dots move on a map, fleet managers define zones and let the system notify them when something unexpected happens. Route optimization reduces fuel costs by 10-15%. The live map is where dispatchers spend their entire day. These three features together form the operational core of your platform.
Geofence Implementation
Store geofences as PostGIS geometry objects in PostgreSQL. Each geofence has a polygon boundary, a type (customer site, warehouse, restricted zone, city boundary), and associated rules (notify on entry, notify on exit, alert if dwell time exceeds 30 minutes). Use the ST_Contains function to check if a GPS point falls within a polygon.
The naive approach (check every GPS point against every geofence) does not scale. With 5,000 vehicles and 10,000 geofences, that is 50 million spatial queries per update cycle. Instead, use a spatial index (R-tree in PostGIS) and only check geofences within the vehicle's bounding area. Better yet, precompute a spatial hash grid: divide your coverage area into cells, map geofences to cells, and only check a vehicle against geofences in its current cell and adjacent cells.
Common geofence use cases: customer delivery confirmation (vehicle entered customer geofence = delivery attempted), unauthorized vehicle use (vehicle left depot geofence outside business hours), route deviation (vehicle exited the geofence corridor around its planned route), and compliance zones (vehicle entered a low-emission zone without proper certification).
Route Optimization
For multi-stop delivery routes, integrate a route optimization engine. Build on top of OSRM (Open Source Routing Machine) or Valhalla for self-hosted routing, or use commercial APIs from Google Routes, HERE, or Mapbox Optimization. The vehicle routing problem (VRP) solver must handle: time windows per stop, vehicle capacity constraints, driver HOS limits, and real-time traffic conditions.
For fleets under 100 vehicles, the Mapbox Optimization API ($0.10 per optimized route) or Google Routes API ($0.01 per route computation) is cost-effective. Above 100 vehicles, self-host an OSRM instance with a custom VRP solver (Google OR-Tools is free and excellent) to avoid per-request API costs that add up quickly at scale.
Live Map Dashboard
Build the live map with Mapbox GL JS (or MapLibre GL for open source). Render vehicle positions as markers that update in real-time via WebSocket. At 5,000 vehicles with 10-second updates, you are pushing 500 position updates per second to the browser. Use WebSocket with binary encoding (MessagePack or Protocol Buffers) rather than JSON to reduce bandwidth by 40-60%.
Cluster vehicles at lower zoom levels. Showing 5,000 individual markers on a zoomed-out continental view is unusable. Use Supercluster (a fast spatial clustering library) to group nearby vehicles into numbered clusters that expand on zoom. At street level, show individual vehicles with heading indicators (arrows showing direction of travel).
Key dashboard metrics to display alongside the map: fleet utilization rate (% of vehicles in active use), idle time per vehicle, total miles driven today, active alerts count, vehicles needing maintenance, and fuel/energy cost per mile.
Tech Stack, Cost Breakdown, and Development Timeline
After building fleet management platforms for logistics startups, here is the tech stack we recommend and what it actually costs to get to market.
Recommended Tech Stack
- Driver mobile app: React Native with Expo. One codebase for iOS and Android. Background location tracking via react-native-background-geolocation ($300 license, worth every dollar for its battery optimization and motion detection).
- Fleet manager dashboard: Next.js with Mapbox GL JS for the live map. Recharts or Tremor for analytics visualizations. TanStack Query for real-time data synchronization.
- Backend API: Node.js (Express or Fastify) for the REST API. Go for the telemetry ingestion service that handles MQTT messages. Go handles concurrent connections more efficiently, which matters when you have thousands of vehicles maintaining persistent connections.
- Message broker: EMQX (self-hosted on AWS) or AWS IoT Core (managed). EMQX is cheaper at scale ($0 software cost, just compute). AWS IoT Core is simpler to operate ($1 per million messages).
- Event streaming: Apache Kafka on AWS MSK or Confluent Cloud. 3-broker cluster for production ($800-1,200/month on MSK).
- Database: PostgreSQL with TimescaleDB extension for telemetry, PostGIS for spatial queries. Standard PostgreSQL for application data (users, vehicles, maintenance records). Redis for pub/sub (broadcasting real-time updates to dashboard WebSockets) and caching.
- Infrastructure: AWS or GCP. EKS/GKE for container orchestration. Budget $2,000-4,000/month for a production environment supporting 5,000 vehicles.
Cost Breakdown for MVP
Getting a fleet management MVP to market (GPS tracking, live map, basic geofencing, driver app, admin dashboard) takes 4-5 months with a team of 3-4 engineers. Adding predictive maintenance, EV support, and route optimization adds another 3-4 months. Total development cost ranges from $150,000-250,000 depending on whether you hire in-house or partner with a development firm.
Hardware costs per vehicle: $80-120 for the OBD-II device, $3-8/month for cellular connectivity, $0.50-2/month for cloud infrastructure allocation per vehicle. At 1,000 vehicles, your monthly operational cost (excluding development) runs approximately $6,000-12,000.
Development Phases
Phase 1 (Months 1-2): Core telemetry pipeline. MQTT ingestion, Kafka processing, TimescaleDB storage, basic REST API. Test with 10-20 vehicles. Phase 2 (Months 3-4): Driver app, live map dashboard, geofencing, trip history. Phase 3 (Months 5-6): Driver behavior scoring, maintenance scheduling, reporting. Phase 4 (Months 7-8): Route optimization, EV support, API for third-party integrations.
Ship Phase 1 and 2 as your MVP. Real fleets will pay for live tracking and geofencing alone. Use revenue from early customers to fund the advanced features in Phase 3 and 4. Do not build everything before talking to paying customers.
Ready to build your fleet management platform? We have helped logistics startups go from concept to launched product in under 6 months, with architecture that scales from 100 to 100,000 vehicles without rebuilding. Book a free strategy call to discuss your fleet management requirements and get a detailed technical roadmap.
Need help building this?
Our team has launched 50+ products for startups and ambitious brands. Let's talk about your project.