DEV Community

Isa Sadiq Ahmad
Isa Sadiq Ahmad

Posted on Edited on

Building ArewaSafe: How We Used Gemma 4 & Disguise UX to Protect Highway Commuters in Northern Nigeria

Interstate highway travel across Northern Nigeria—such as the vital Kaduna–Zaria highway, the Abuja–Kaduna expressway, and the Birnin Gwari corridor—presents extreme personal safety risks. For millions of commercial bus commuters, students, traders, and families, the threat of armed highway ambushes, vehicle hijackings, and bandit abductions is an everyday reality.

When an ambush occurs, traditional safety solutions completely collapse:

  1. Conspicuous SOS apps get victims targeted: When armed assailants board a bus, phones are scrutinized. Having an open "Emergency Tracker" or panic button on screen invites immediate violence.
  2. Rural cellular dead-zones break tracking: Forest stretches like Rijana, Buruku, and Katari have frequent cellular blindspots where telemetry drops.
  3. Ambushed vehicles are forced into the bush: Hijacked buses are systematically steered off paved asphalt into hidden dirt paths at low speeds to evade military highway patrols.
  4. Surrounding communities receive zero warning: Local farmers, vigilantes, and oncoming motorists just 2 to 3 kilometers down the road are completely blind to the danger ahead.

To solve this, we built ArewaSafe (Kariya AI)—an open-source, end-to-end travel safety ecosystem combining a covert disguise mobile app, an under-seat telematics blackbox, geometric bush-deviation heuristics, and bilingual open-weight Gemma 4 AI intelligence for tactical community dispatch.

At Hacktoberfest Hack Day Kaduna (hosted by SynapGrid Technologies and MLH), ArewaSafe was awarded:

  • 🏆 Winner: Best Open-Source AI Project (built using the Best Use of Gemma 4 track)

Here is the complete engineering breakdown of how we built it.


🏗️ System Architecture

[ Commuter Phone: Disguise Calculator ]   [ Under-Seat ESP32 Blackbox ]
                 │                                      │
                 ▼                                      ▼
         [ Pre-Shared Device Authentication Gateway (X-Device-Token) ]
                                 │
                                 ▼
                 [ Express & SQLite WAL Core Engine ]
                   ├── Multi-Corridor Geofencer
                   ├── Bush Deviation Detector (Kinematic Vector Analysis)
                   └── Dead-Man Watchdog Timer
                                 │
                 ┌───────────────┴───────────────┐
                 ▼                               ▼
     [ Gemma 4 Tactical Dispatcher ]   [ Real-Time Operations Dashboard ]
     ├── Structured Incident SitRep    ├── Leaflet Live OpenStreetMap
     ├── Ranked Egress Projections     ├── Rapid Intercept Outpost Vector
     └── Vernacular Hausa Warnings     └── 1-Click Printable SitRep Brief
                 │                               │
                 └───────────────┬───────────────┘
                                 ▼
             [ 5km Hyperlocal Flash Broadcast Gateway ]
               (Africa's Talking / Twilio GSM SMS)
Enter fullscreen mode Exit fullscreen mode

1. The Covert Disguise UX (Casio fx-82 Calculator)

We rejected the idea of an obvious "Safety App". Instead, the mobile client is built as an ordinary, realistic Casio fx-82 scientific calculator in React Native and Expo (upgraded to the latest Expo SDK 58, React 19, and React Native 0.88).

  • Full Scientific Functionality: Commuters can use it for real calculations (sin, cos, tan, powers, square roots, parentheses) with an authentic retro S-V.P.A.M. LCD display and tactile mechanical keypress vibration.
  • The Silent Trigger (911=): If threatened, the commuter simply types 911=. The calculator evaluates the number normally on screen, but a hidden background buffer immediately captures the sequence and dispatches a silent POST /alert with live GPS coordinates.
  • The Safe Arrival Code (000=): Entering 000= silently marks a safe trip arrival (POST /trips/:id/end).
  • Offline FIFO Queue: When driving through cellular blackouts, telemetry isn't lost. An in-memory FIFO queue buffers up to 150 pings (~25 minutes of travel history) and automatically flushes them sequentially the moment a 2G/3G handshake succeeds.
  • Covert SMS Fallback: If cellular mobile data is turned off, the 911= trigger automatically formats an encrypted emergency SMS intent sent directly to the command center emergency gateway.

2. Autonomous Under-Seat Blackbox Hardware (ESP32)

Not all passengers have smartphones, and drivers need an automated defense mechanism. We developed autonomous vehicle blackbox firmware in C++ for the ESP32, u-blox NEO-6M GPS, and SIM800L GPRS module:

// Hardware Watchdog Timer to prevent rural cellular modem lockup
esp_task_wdt_init(30, true);
esp_task_wdt_add(NULL);

// Covert microswitch wired under driver footwell (Active LOW)
if (digitalRead(FOOT_SWITCH_PIN) == LOW) {
  sendEmergencyAlert("MANUAL_FOOT_SWITCH");
}

// Digital collision / rollover impact sensor
if (digitalRead(CRASH_SENSOR_PIN) == HIGH) {
  sendEmergencyAlert("CRASH_ROLLOVER");
}
Enter fullscreen mode Exit fullscreen mode
  • Watchdog Reliability: The firmware uses ESP32's hardware Watchdog Timer (WDT) to automatically reboot if the cellular modem freezes during rural cell-tower handovers.
  • Low-Power Ignition Management: Detects the bus's 12V/24V ACC wire via optocoupler isolation. When the engine is switched off, the blackbox transitions into deep sleep to protect the vehicle battery, waking periodically or on panic switch press.

3. Detecting Ambush Diversions: Geometric Bush Deviation

The hallmark signature of an interstate highway abduction is steering a commercial transit bus off the paved road into dense bush trails at low crawling speeds.

We created a deterministic vector engine that tracks vehicles against pre-calibrated multi-corridor highway coordinates (Kaduna–Zaria, Abuja–Kaduna, Birnin Gwari, and Kano–Katsina):

// A strike is registered if:
// 1. Perpendicular distance to nearest highway segment > 300 meters
// 2. Off-corridor divergence angle > 60°
// 3. Vehicle speed < 25 km/h
if (distToHighwayMeters > 300 && speedKmh <= 25) {
  strikes++;
  if (strikes >= 2) {
    createIncident(tripId, 'BUSH_DEVIATION');
  }
}
Enter fullscreen mode Exit fullscreen mode

Requiring two consecutive strikes prevents roadside tire changes or temporary gas station stops from triggering false alarms.


4. Bilingual Tactical Intelligence with Gemma 4

When an incident occurs, responders need actionable facts, and nearby communities need warnings they understand in their native language.

We integrated Gemma 4 (Google's lightweight open-weight model) accessed through the Gemini API and supported on self-hosted Ollama / llama.cpp edge runners for air-gapped security centers:

{
  "sitrep": "Vehicle departed Kaduna–Zaria highway at 10.7420, 7.5250 moving northwest into dense bush at 10 km/h. Last ping received at 16:42 WAT.",
  "likely_directions": [
    { "direction": "NW", "confidence": 0.82, "reason": "Consistent bearing into Buruku forest corridor" }
  ],
  "hausa_warning": "Gargadi: an samu rahoton matsalar tsaro a hanyar Kaduna zuwa Zariya kusa da Maraban Jos. Ku nisanci yankin, ku sanar da jami’an tsaro.",
  "english_warning": "Security alert: emergency reported on the Kaduna–Zaria road near Maraban Jos. Avoid the area and notify security personnel.",
  "recommended_actions": [
    "Dispatch patrol from Jaji Cantonment checkpoint",
    "Alert vigilante outposts along the northwestern bush track"
  ]
}
Enter fullscreen mode Exit fullscreen mode
  • Why Open-Weights Matter: Operations in rural Africa cannot depend exclusively on subscription cloud endpoints. Quantized Gemma 4 can run entirely offline on a small server inside a police barracks or vigilante post without internet access.
  • Vernacular Hausa Alert: The generated Hausa message is immediately ready for GSM SMS flash broadcast to registered community leaders, farmers, and vigilante groups (CJTF) within a 5km radius.

5. Tactical Command Operations Dashboard

The web dashboard (dashboard/index.html) is built for real-world tactical operations rooms:

  • Daylight & Night Themes: High-contrast daylight Harmattan Sand palette for field laptops and dark projector theme for dimly-lit operations centers.
  • Rapid Intercept Response Vectors: When an incident is selected, the system calculates the nearest military checkpoint or police outpost (e.g. Jaji Cantonment, 4.2 km away), estimates response travel time (~6 mins), and draws a dashed tactical intercept vector on the Leaflet map.
  • Web Audio Synthesizer: Synthesizes custom dual-tone alert klaxons for panic alarms and ascending chimes for broadcast confirmations.
  • 1-Click Official SitRep Briefing: Formats a clean, classified tactical SitRep document ready for instant printing or PDF archiving.

🛠️ Reproducibility & Open Source

We believe software that protects lives must be transparent, verifiable, and open source:

  • GitHub Repository: github.com/isasadiq/arewaSafe (MIT License)
  • Automated Production Verification: Run node scripts/verify-production.js to execute the 8-stage automated test suite covering authentication, telemetry ingestion, bush deviation, and AI dispatch.
  • 1-Click Docker Deployment: docker compose up -d launches the containerized engine with health monitoring (/health).

Building ArewaSafe was an incredible journey of combining practical disguise UX, robust hardware design, and local open-weight AI for meaningful social impact. Technology is at its best when it solves real, pressing problems for real people.

Built for Hacktoberfest Hack Day Kaduna 2026. Code freely available on GitHub.

Top comments (0)