Ashiq's Portfolio
Toggle sidebar
From IoT Sensor to Emergency W...
Article
5 min read

From IoT Sensor to Emergency Web Portal

Java MySQL GPS Full Stack IoT
From IoT Sensor to Emergency Web Portal

A crash alert that only reaches a family member is a tragedy with witnesses. The whole point of Accident Aid โ€” my B.Tech project covered in part one and part two โ€” was that the alert also reaches people who can dispatch help: hospitals and police stations. That required a web application, and building it was, without me realising it at the time, the start of my full-stack career.

What the portal had to do

The requirements sound simple until you list them honestly:

  • Three kinds of users โ€” vehicle owners, hospitals, police stations โ€” each with their own registration and their own view of the system.
  • Vehicle owners register with their details, vehicle number, and up to three family phone numbers that receive the SMS alerts.
  • Hospitals and police stations register with their name, contact details, and โ€” critically โ€” their latitude and longitude, so alerts can reach the nearby responders, not all of them.
  • When a crash fires, an accident record lands in the database: coordinates, vehicle number, timestamp. It appears in the hospital and police dashboards as a live list.
  • One click on an alert opens the location on Google Maps โ€” a pin, not a paragraph of directions.
  • Hospitals mark deployment status, so everyone can see whether help is already on the way โ€” which prevents both the double-dispatch and the nobody-dispatched failure modes.

The stack: Java, JSP, and MySQL

The 2017 build was Java (JSP/J2EE) on the front, MySQL behind โ€” the standard college stack of its era, and honestly a good teacher. Every concept I use daily in Laravel existed there in a rawer form:

  • Database design first. Tables for users, hospitals, police stations, and accidents; primary keys; the accident table holding coordinates and status. Getting the schema right before writing pages โ€” a habit that survives every framework change.
  • Registration and login per role, with each role routed to its own home page โ€” the primitive ancestor of the auth guards I now configure in Laravel HRMS builds.
  • Server-rendered pages that query the database and print HTML. No SPA, no API layer โ€” request in, rows out, page rendered. It taught the request/response cycle with nothing hiding it.
  • An external map API (Google Maps) embedded with the accident's coordinates โ€” my first third-party integration, and my first lesson that the integration point is where systems break.

Data flow diagrams โ€” vehicle device in, registration and update flows, hospital and police views โ€” forced the discipline of drawing the system before building it. I still sketch the boxes and arrows before the first migration.

The hard part nobody warned me about: the seam

The genuinely difficult engineering wasn't the Arduino code or the JSP pages โ€” it was the seam between them. An embedded device speaking GSM on one side; a web application speaking HTTP and SQL on the other. The Raspberry Pi bridged that gap, holding the registered numbers and getting accident data into the portal's database.

Every integration problem I've solved professionally since โ€” WooCommerce to Shopify syncs, payment gateways to order systems, middleware between platforms that were never designed to meet โ€” is the same problem wearing different clothes: two systems with different vocabularies, and the real work living in the translation layer. I met that problem here first.

Testing it like it mattered

The project went through the full testing ladder โ€” unit, integration, validation, system, regression โ€” and while some of that was academic ritual, two parts earned their keep:

  • Validation testing on every form: names must be characters, phone numbers must be ten digits, registration blocked until everything passes. My first encounter with the rule that the server trusts nothing โ€” today that's a Form Request in Laravel, but the principle was learned here.
  • Integration testing at the seam: does a sensor trigger actually become a database row that actually renders in the dashboard? The unit tests all passed long before the pipeline worked end-to-end. That gap between "each part works" and "the system works" is where real projects live or die.

Common pitfalls

  1. Building the dashboard before the data path. A beautiful accident list with no reliable way for accidents to arrive is a mockup. Prove the pipeline with ugly pages first.
  2. Storing location as an address string. Coordinates are unambiguous, sortable by distance, and render on a map. Text addresses are none of those.
  3. One shared login for organisations. Hospitals and police needed separate roles and views from day one โ€” bolting on roles later is far more painful than designing them in.
  4. No status field on alerts. "Deployed / not deployed" is one column, and it's the difference between coordination and chaos when multiple responders see the same alert.
  5. Treating validation as UI polish. It's the security boundary. Every rule enforced only in the browser is a rule that doesn't exist.

From that portal to this one

The through-line from that JSP application to what I do now is direct: the registration flows became authentication systems, the accident list became admin dashboards, the Google Maps embed became a hundred API integrations, and the MySQL schema became years of database design. The Raspberry Pi that bridged the device to the web now runs my entire self-hosted infrastructure โ€” including this site.

If I rebuilt Accident Aid today it would be Laravel and Livewire: webhook ingestion instead of a Pi bridge, queued notifications with delivery tracking instead of raw SMS calls, Filament dashboards for the responders, and a proper test suite across the seam. The tools are a decade better. The lessons haven't changed at all.

FAQ

Why did hospitals and police register themselves rather than using official data?
Scope. For a student prototype, self-registration proved the workflow โ€” real deployment would integrate with official emergency service systems and verified facility databases.
How did alerts get from the device into the web database?
The Raspberry Pi acted as the bridge: it stored registered numbers permanently and connected the embedded pipeline to the portal's MySQL database, so a detection became both an SMS and a dashboard row.
Would you still choose server-rendered pages for this?
For the responder dashboards โ€” absolutely, though today with Livewire polling or websockets so new alerts appear without a refresh. Emergency UIs should be boring, fast, and readable under stress.
What's the single biggest upgrade a 2026 rebuild would get?
Reliability engineering around the alert path: queued jobs with retries, delivery confirmation, dead-letter handling, and monitoring โ€” so a failed notification is a visible incident, not a silent one. In an emergency system, the failure mode is the product.

From embedded prototypes to production Laravel platforms โ€” if you need a developer who owns the whole pipeline, get in touch.