← Back to home

PeerDrive

PeerDrive: P2P vehicle mesh to prevent traffic and accelerate emergency response

Problem Statement

What is PeerDrive?PeerDrive is a decentralized, privacy-first vehicle network that lets nearby cars coordinate in real time to prevent traffic and improve safety.Each car becomes an intelligent node that maintains a precise, local map of nearby vehicles and cooperatively chooses actions—like easing speed to dissolve traffic waves or clearing a lane for an ambulance—without relying on a central server.The problem it solvesReactive systems fail drivers: Traditional apps learn about congestion after it forms, and centralized networks can be slow or unavailable when it matters most.No coordination between vehicles: Without direct cooperation, small disturbances amplify into stop-and-go waves and delayed emergency response.How PeerDrive works (conceptually)Two-layer communication: Uses the internet for rich, full-state awareness and a resilient, low-bandwidth radio layer for critical alerts when connectivity is poor.Local, bounded awareness: Each node tracks only its immediate vicinity (roughly hundreds of meters to a couple kilometers), enabling fast, relevant decisions.Deterministic “strategy engine”: With similar local inputs, nearby cars independently compute aligned recommendations, producing coordinated behavior without central control.What drivers experienceCalm, actionable guidance: Simple prompts like “Maintain 65 km/h for smoother flow” or “Prepare to merge left—emergency vehicle approaching.”Live neighborhood view: A clean visual of nearby vehicles and key events (e.g., hard braking ahead, hazard zones).Always-on safety: Critical alerts continue to propagate even if phones lose internet, enhancing trust during edge cases.Core capabilitiesTraffic wave dissipation: Detects emerging stop-and-go patterns and recommends small speed adjustments to prevent shockwaves from propagating.Emergency passage: Vehicles receive authenticated emergency signals and coordinate subtle lane shifts to create a “green corridor.”Hazard validation and alerting: Verifies and relays important events (accidents, debris, ice) to give drivers earlier, safer reactions.Privacy by design: Vehicles are recognized by cryptographic identities rather than personal identifiers; only minimal, necessary data is shared.Who benefitsEveryday drivers: Fewer abrupt stops, smoother commutes, earlier warnings.Emergency services: Faster, safer passage through coordinated lane clearing.Fleets and logistics: Reduced delays, better route reliability, safer driving.Cities: Insights into flow and safety dynamics without compromising individual privacy.What success looks likeSafety: Fewer collisions, higher time-to-collision margins, gentler braking.Efficiency: Lower travel-time variance, faster emergency passage, smoother flow.Resilience: Critical signals continue during outages; the network degrades gracefully, not catastrophically.Why it’s differentProactive, not reactive: Acts before waves form, not after congestion is obvious.Decentralized coordination: Eliminates single points of failure and control.Bounded, local intelligence: Focuses on the immediate environment where decisions matter most.Illustrative scenariosFive-vehicle sudden stop: With cooperative alerts, following cars brake earlier and more gently—avoiding chain collisions.Ambulance approach: Nearby vehicles get timely signals and smoothly make space; the corridor emerges organically from consistent local choices.Near-term roadmap (at a glance)Simulation and algorithm refinement → minimal viable pilot with paired vehicles → city-scale trials with early adopters and fleets → broader deployment.Built a clear, non-technical description focused on purpose, user value, behavior, and impact.Avoided implementation details to keep this distinct from the upcoming “How it’s made.”

Solution

How it’s madeCore language and architectureGomonorepo with clear module boundaries:cmd/peerdrive(CLI) andcmd/peerdrive-gui(desktop UI entrypoints)pkg/strategy/(simulation engine, scenarios, analysis/metrics)pkg/models/(shared state likeNetworkState,VehicleState)pkg/sensor/(parsers andmock.gofor synthetic data)pkg/network/(manager, rewards scaffolding)pkg/hardware/crypto.go(crypto/identity primitives)ui/(desktop UI, includingwidgets/roadmap.go)Go’s goroutines and channels orchestrate the simulation loop, event propagation, and UI updates without a heavyweight runtime.Strategy engine (simulation)Deterministic tick loop (~50 Hz) advances vehicle kinematics and scenario logic.Scenarios are started and controlled viastrategy.NewEngine(...),StartScenario(...),IsRunning(), andStopScenario().Two canonical scenarios implemented inpkg/strategy:5‑vehicle sudden stop(baseline vs V2V-enabled)Emergency vehicle priority(lane-making, passage time)Metrics computed every tick (TTC, spacing error, peak decel, collision flags, V2V response) and exported as JSON/CSV for analysis.State and data modelpkg/models/state.godefinesNetworkState(peers, alerts, recommendations) and per-vehicle state (position, velocity, acceleration, lane).The engine treats comms latency as configurable parameters to compare “no comms” vs “V2V” behaviors.Sensors and inputspkg/sensor/mock.gogenerates repeatable sensor streams for deterministic tests.pkg/sensor/parser.godefines a thin interface layer so real inputs (phone GPS/IMU or hardware) can replace mocks without touching the engine.NetworkingCurrent simulator runs locally; theintendedproduction stack (documented indocs/Readme.md) uses a hybrid mesh:Primary: internet P2P (libp2p) for full-state sync.Fallback: LoRa for tiny, critical alerts with millisecond propagation.pkg/network/manager.goandrewards.gooutline the coordination and incentive hooks the engine will call into once live networking is enabled.Crypto/identitypkg/hardware/crypto.goencapsulates cryptographic key handling to represent vehicles as keys (not license plates), enabling authenticated alerts without personal IDs.Desktop UI and visualizationcmd/peerdrive-guilaunches a desktop app that embeds a right‑panel “road map” widget (ui/widgets/roadmap.go).The widget renders a fixed 2×2 world with three vertical and two horizontal roads (0.4‑unit lanes), maintains a square aspect ratio, and exposes coordinate transforms:GetWorldBounds(),worldToPixel(x,y),pixelToWorld(x,y)Vehicles and events from the engine are drawn over a dark‑gray road grid on a green background with dotted lane dividers.Examples and automationexamples/demo_scenarios.goruns both scenarios end-to-end and writes timestamped results.examples/compare/andexamples/compare_scenarios.goare used to baseline “No Comm” vs “V2V” configurations under identical seeds.Build and runGUI:go run cmd/peerdrive-gui/main.goCLI demos:cd examples && go run demo_scenarios.goOutputs: realtime console summaries plus JSON/CSV files for post‑hoc analysis.Hardware track (prototyping path)Documented indocs/Hardware.md: a cost‑optimized “Sentinel Unit” built aroundESP32‑S3+LLCC68LoRa transceiver, USB‑C power/data, and external GPS/IMU when needed.Design-for-manufacture tips: 2‑layer FR‑4, top‑side assembly, 0805/1206 passives, simple jig for firmware flashing/self‑test.Pragmatic radio choice:LLCC68(pin‑compatible with SX1262) delivers ~1–2 km LoS at lower cost.Certification planning (FCC/CE) and staged manufacturing (proto → 100–500 pre‑prod → mass production) are laid out with BOM targets.What was hacky and worth notingA “dumb modem” approach: make the LoRa dongle act as a USB‑to‑radio bridge; let the phone/app handle all the heavy logic. This slashes firmware complexity and accelerates iteration.Deterministic mocks: the sensor/network layers are seeded so scenario runs are bit‑for‑bit comparable, which makes regression spotting trivial.Fixed world coordinates in the UI widget allow pixel‑perfect rendering and simple math for converting engine outputs to visuals without a full GIS stack.Why these technologiesGo: fast binaries, cross‑platform, simple concurrency model, great for both simulation and desktop utilities.Hybrid comms (planned): libp2p for secure peer discovery + LoRa for outage‑proof safety signals.Minimal UI surface: a custom widget beats map SDK complexity for scenario visualization and keeps the dependency tree thin.Partner/adjacent tech and impactlibp2p (planned): secure channels, NAT traversal, peer discovery for the internet layer.LoRa (LLCC68): long‑range, low‑bitrate alerts that remain operational during cellular outages.u‑blox GNSS + phone IMU (planned): high‑frequency kinematics for the strategy engine.What’s nextWire the engine to a live P2P layer, feed real sensor streams, and validate end‑to‑end emergency alert propagation with two prototype dongles and two phones.Expand scenarios (merge assist, intersection coordination) and add packet‑loss/congestion models inpkg/strategy.Focused on concrete implementation: code layout, APIs, data flow, concurrency, metrics, UI, hardware approach, and hacky shortcuts—distinct from the high‑level “what/why” description.

Hackathon

ETHGlobal New Delhi

2025

Contributors