Inspiration
We live near Sudbury, a mining town, so the danger of underground gas isn't abstract to us. What struck us is that mines have no internet and no cell signal because rock blocks the radio. When methane builds up in a working zone, crews often find out too late. And any system that leans on the cloud or a central server goes dark in the exact moment it matters most, during a roof fall or an incident, when comms get cut. We wanted to build something that actually fits how a mine works: offline, at the edge, zone by zone.
What it does
Mine Guardian watches every zone of a mine in real time and reacts to gas before it becomes an emergency.
It tracks methane, CO, temperature, and airflow per zone. The core idea is trend, not just threshold. It doesn't wait for gas to cross a danger line. It watches the recent readings and flags a zone that is climbing toward danger, so the crew gets a warning early.
When a zone goes critical, it automatically ramps the ventilation fan to push more fresh air through and dilute the gas. That is the real way mines clear methane. You never inject oxygen underground because that makes an explosion worse. It also lists the exact safety actions for that severity, like cutting power to non-flameproof equipment, stopping ignition-capable work, and withdrawing to fresh air, each one grounded in and cited to Ontario Reg 854. It speaks the alert out loud so a crew doesn't have to be staring at a screen, and once ventilation brings a zone back to safe, it announces that everything is under control.
Everything runs fully offline, on one local machine, with no internet.
How we built it
The backend is a Python FastAPI service running at the edge. It ingests per-zone gas readings over MQTT, using a local Mosquitto broker as a stand-in for the mine's wireless mesh, computes status and trend, runs the ventilation control loop, and serves it over a small local API. It also has a fallback mode that generates readings on an internal timer, so the whole system runs even with no broker.
For trend detection, we average the recent step-to-step change in methane to decide rising versus stable, with a small deadband so sensor noise doesn't trigger false alarms. We kept the math simple and explainable on purpose. When you justify a safety decision to a mine inspector, "the readings trended up" beats a black box.
Safety guidance uses fixed template answers mapped to gas type and severity, each cited to a local copy of the relevant Reg 854 section. There is no language model in the loop. For safety guidance, a fixed and traceable answer is the only acceptable behavior. A made-up procedure underground could get someone killed.
The frontend is a dark control-room dashboard built with TanStack Start, React, and Tailwind. It polls the backend every two seconds, paints each zone green, yellow, or red, shows the spinning ventilation fan and live safety actions, and uses the browser's built-in Web Speech API for offline voice.
Challenges we ran into
The hardest part was making "offline" real instead of a slogan. Every easy default broke the moment we cut the internet: cloud language models, hosted voice APIs, the hosted frontend preview. We had to rip those out and find local equivalents, like template answers instead of a cloud model and browser speech instead of a hosted voice service.
We also lost time to a localhost versus hosted issue. The hosted preview can't reach a backend running on your own laptop, which confused us until we understood that the real demo only works with the frontend and backend both running locally on one machine.
Tuning the simulation took patience too. We had to get a zone to climb to red fast enough to show in a live demo, then recover as ventilation kicks in, all while keeping sensor noise from flipping calm zones yellow.
Accomplishments that we're proud of
We shipped a system that genuinely runs with the internet switched off, end to end, which is the whole point and the thing most people assume needs the cloud. We built a real closed loop, where a zone climbs to danger, ventilation ramps up on its own, and the zone recovers to safe, with the system narrating it out loud. And every piece of safety advice it gives traces back to an actual regulation, so it's auditable rather than a guess.
What we learned
The hard limits of the environment, no internet and comms that fail during incidents, should drive the architecture from the start rather than get patched on at the end. We also learned that simple and auditable beats clever for anything safety-critical, and that most of a good build is tight integration and a clean demo, not piling on features.
What's next for Mine Guardian
In production this runs on a rugged edge box underground, ingesting from real sensor nodes over a self-healing wireless mesh, with the ventilation loop wired to actual fan controllers. The demo is the miniature. The architecture is built to deploy. From there we'd add more gas types, per-mine threshold configuration, and historical logging that syncs to the surface whenever a zone comes back into range.
Built With
- cursor
- fastapi
- mosquitto
- mqtt
- paho-mqtt
- pydantic
- python
- react
- tailwindcss
- tanstack-start
- typescript
- uvicorn
- vite
- web-speech-api
Log in or sign up for Devpost to join the conversation.