-
-
Deterministic safety engine issuing 0-degree quarantine with clear policy reason
-
Tamper-evident SQLite history ledger with source labels and CSV export
-
Guided landing page previewing quarantine, hold, and recycle chute angles
-
Mobile landing view introducing PyroGate and the three chute positions
-
Intake mode selector separating live uploads from labeled diagnostic scenarios
-
Labeled diagnostic scenarios safely demonstrating clean recycling and fault paths
-
System architecture overview showing perception, deterministic safety rules, and hardware
-
In-app model performance page showing benchmark results and known weaknesses
-
Virtual Hardware Lab actuating SVG chute twin with simulated receipt
-
Hardware lab status clearly separating virtual simulation from connected ESP32
-
Mobile responsive view displaying real battery bounding box and timing
-
Mobile inspection report summarizing quarantine decision and controller acknowledgement receipt
-
Saved inspection report combining detection evidence, decision, and hardware receipt
-
Real CPU ONNX detection boxing cylindrical battery at 95.6% confidence
-
Image upload panel confirming local ONNX detector readiness before inspection
Stop Battery Fires Before They Start.
A battery discarded with ordinary recyclables can become a fire hazard the moment it reaches a compactor.
We built PyroGate to identify potential battery hazards at waste intake and help operators decide how to handle them. It combines local computer vision, an independent safety engine, and an embedded sorting controller in one inspection workflow.
AI identifies. Safety rules decide. Hardware executes.
Watch the demo | View source code | Try the ESP32 circuit
PyroGate at a Glance
| 87.78% | 22.80 ms | 347 |
|---|---|---|
| Internal hazard localization recall | P95 CPU inference latency | Diagnostic safety probes |
| 7 Object Categories | 3 Routing Positions | Local CPU Inference |
|---|---|---|
| Computer vision | Intelligent safety decisions | No dedicated GPU required |
Metrics are based on recorded internal evaluations and diagnostic testing.

Inspiration
The hidden danger inside an ordinary recycling bin
A disposable vape or an old power bank can easily end up in the same recycling bin as cardboard, plastic, and metal. The problem is that conventional moisture and weight sensors may not distinguish a dry lithium-ion battery from other dry waste.
But when that battery reaches a collection truck or recycling compactor, a single crushing or puncturing event can trigger thermal runaway.
The consequences can extend far beyond the battery itself:
- Fires inside waste collection vehicles.
- Damage to recycling facilities and machinery.
- Serious safety risks for workers.
- Expensive operational interruptions.
- Environmental damage caused by uncontrolled fires.
Traditional moisture and weight-based sorting mechanisms cannot reliably identify every hidden battery hazard. Advanced industrial sorting equipment may also be financially inaccessible to smaller waste processing facilities.
This led us to ask a fundamental question:
Why wait for a battery fire to happen when we could intervene before compaction?
That question shaped our design. We chose to focus on inspection before compaction, when there is still an opportunity to isolate a visible hazard.
What it does
PyroGate is an intelligent waste inspection and battery hazard detection system that combines computer vision, deterministic safety policies, embedded systems, and accountable decision-making.
The distinction is that detection is only the first step. PyroGate also explains its routing decision and records the controller response.
Step 1: Inspect the incoming waste
Operators can upload an image of an item or select a controlled diagnostic scenario to explore different safety conditions.
PyroGate validates the input and checks image quality before processing it through its local computer vision pipeline.


Step 2: Identify potential battery hazards
Our YOLOX-based object detection pipeline runs locally using ONNX Runtime.
The model supports seven object categories:
| Hazardous objects | Ordinary recyclable objects |
|---|---|
| Cylindrical lithium-ion batteries | Metal cans |
| Pouch batteries | PET bottles |
| Disposable vapes | Paper and cardboard |
| Powerbanks |
For each inspection, PyroGate presents:
- Object classification.
- Bounding-box localization.
- Detection confidence.
- Model information.
- Measured inference latency.
In our showcased cylindrical battery inspection, the system recorded a detection confidence of 95.6% and an inference time of 27.59 milliseconds.

Step 3: Make a safety-first decision
A neural network prediction should never have unrestricted authority over safety-critical machinery.
PyroGate introduces an independent deterministic safety engine between AI perception and hardware actuation.
The engine evaluates:
- Image quality.
- Potential battery hazards.
- Detection confidence and uncertainty.
- Multiple objects appearing in the same inspection.
- Permitted routing capabilities.
- Controller availability.
A recyclable object appearing alongside a hazardous battery cannot override the hazard.
When the system cannot establish an appropriate routing decision, safety takes priority.

Step 4: Intelligent waste routing
PyroGate demonstrates three distinct gate positions.
| Gate position | Routing decision | Purpose |
|---|---|---|
| 0 degrees | QUARANTINE | Isolate potentially hazardous items |
| 90 degrees | HOLD | Maintain the default safe position |
| 180 degrees | RECYCLE | Demonstrate authorized recyclable routing in controlled scenarios |
Live image inspections are restricted to quarantine or hold. Recycling authorization is demonstrated through controlled diagnostic scenarios.
The routing workflow is integrated with an ESP32-based controller and an interactive Virtual Hardware Lab.
Operators can observe the requested gate position, controller state, and acknowledged sorting action.

Step 5: Make every decision accountable
An inspection is useful only if operators can review the evidence and understand the resulting action:
- What was detected?
- Why was the item quarantined or held?
- What action was requested?
- Did the controller acknowledge that action?
PyroGate generates a complete inspection report containing detection results, confidence scores, inference latency, safety explanations, gate positions, and controller acknowledgements.

Every inspection is recorded in a persistent SQLite ledger with SHA-256 hash-linked records.
Operators can review previous inspections and export records as CSV for further analysis.

How we built it
Engineering intelligence beyond object detection
PyroGate was designed around three independent engineering layers:
Perception → Decision → Actuation
Separating these layers ensures that AI predictions do not directly control hardware.
System architecture
| Layer | Technology | Responsibility |
|---|---|---|
| Application | React 19, TypeScript, Vite | Guided inspection and monitoring interface |
| Backend | Python, FastAPI | API communication and workflow orchestration |
| Image Processing | OpenCV | Image validation and quality assessment |
| Computer Vision | YOLOX-Nano, ONNX Runtime | Local object detection |
| Safety Engine | Deterministic Python logic | Hazard prioritization and routing decisions |
| Communication | REST API, HTTPS | Controller command exchange |
| Embedded Controller | ESP32, Arduino C++ | Gate positioning and safety mechanisms |
| Hardware Simulation | Wokwi, Virtual Hardware Lab | Interactive controller verification |
| Persistence | SQLite, SHA-256 | Inspection records and traceability |
1. Computer vision and edge inference
We integrated a YOLOX-Nano detection model with ONNX Runtime to execute inference locally on a CPU.
This approach avoids requiring a dedicated GPU or continuous access to cloud-based inference services.
The perception pipeline performs:
- Image decoding and validation.
- Image-quality assessment using OpenCV.
- Input tensor preparation.
- Local ONNX model inference.
- Bounding-box decoding.
- Object classification and confidence filtering.
- Transfer of detection results to the safety engine.
Local processing makes PyroGate suitable for investigating deployment in environments with limited internet connectivity.
2. Deterministic safety engineering
Instead of directly connecting AI predictions to the sorting mechanism, we developed a separate hazard-first decision engine.
Its design follows several fundamental principles:
- Hazardous detections take priority over ordinary recyclables.
- Poor-quality inputs cannot authorize recycling.
- Missing model predictions do not establish that an object is safe.
- Uncertain detections trigger conservative routing.
- Hardware commands must respect defined operational restrictions.
- Recycling is restricted to authorized diagnostic scenarios.
Uncertainty is not permission to recycle. Incomplete information is never treated as evidence that an item is safe.
3. ESP32 and embedded controller
We developed an ESP32-based controller using Arduino C++.
The controller demonstrates how intelligent safety decisions can be translated into controlled mechanical actions.
Its implemented capabilities include:
- Servo-controlled gate positioning.
- Ultrasonic object-presence detection.
- Emergency stop mechanism.
- Latched emergency stop recovery.
- Short-lived command authorization.
- Communication watchdog.
- Controller acknowledgements.
- Automatic return to the hold position on communication loss.
The controller operates within explicit safety constraints rather than blindly executing model predictions.

4. Interactive hardware simulation
To make PyroGate accessible without requiring a physical hardware kit, we developed an interactive Wokwi ESP32 circuit.
Judges and developers can explore the embedded safety behavior directly from their browsers.
The simulation demonstrates:
- Object-presence verification.
- Gate position changes.
- Emergency stop activation.
- Emergency stop reset behavior.
- Refusal of unauthorized routing commands.
PyroGate provides multiple environments for evaluating system behavior:
| Environment | Purpose |
|---|---|
| Diagnostic Scenarios | Controlled verification of safety policies |
| Virtual Hardware Lab | Integrated software-based controller behavior |
| Standalone Wokwi | Interactive ESP32 circuit testing |
| Connected Wokwi | Communication with ESP32 firmware running in simulation |
5. Responsive application
We developed a complete operator-facing application using React, TypeScript, and FastAPI.
Rather than displaying isolated model predictions, the application guides users through the entire inspection workflow.
Input → Analysis → Safety Decision → Sorting → Report → History
The application includes:
- Guided inspection workflow.
- Interactive SVG hardware visualization.
- Real local inference results.
- Decision explanations.
- Controller status information.
- Inspection history.
- CSV export.
- Mobile-responsive layouts.
- Model performance documentation.

6. Persistent inspection records
PyroGate uses SQLite to persist inspection results and controller receipts.
Records are linked using SHA-256 hashes to support detection of certain forms of record modification.
Each inspection retains its origin, detection results, decision explanation, controller action, and acknowledgement.
This creates a foundation for accountable waste inspection rather than disconnected predictions.
What makes PyroGate different?
Object classification alone answers one question:
What object is this?
PyroGate addresses a more consequential question:
What should the system safely do with this object?
| Classification-only approach | PyroGate |
|---|---|
| Focuses primarily on object classification | Focuses on battery hazard interception |
| Returns a predicted category | Produces a reasoned routing decision |
| May directly connect predictions to actuators | Separates AI perception from hardware control |
| Often prioritizes classification confidence | Prioritizes hazards and uncertainty handling |
| May depend on cloud inference | Supports local CPU inference |
| Displays isolated prediction results | Maintains persistent inspection records |
| Often demonstrates basic sorting | Includes controller safeguards and acknowledgements |
Innovation 1: Safety-first AI architecture
PyroGate treats AI as a perception component rather than the final authority.
An independent safety policy determines which actions are permitted.
Innovation 2: Prevention before compaction
Instead of responding to fires after they begin, PyroGate focuses on identifying potential battery hazards at the waste intake stage.
Innovation 3: Conservative uncertainty handling
Poor-quality images, missing predictions, and uncertain detections cannot be treated as automatic permission to recycle.
Innovation 4: Accessible edge intelligence
Local CPU inference reduces dependency on expensive computing infrastructure and continuous cloud connectivity.
Innovation 5: Accountable hardware decisions
PyroGate distinguishes between an action being requested and a controller acknowledging that action.
Innovation 6: End-to-end engineering
PyroGate brings computer vision, safety logic, embedded systems, application engineering, and traceability together within a single workflow.
Challenges we ran into
Visually similar waste objects
Cylindrical batteries and metal containers can exhibit similar shapes, reflective surfaces, and textures.
This creates significant challenges for computer vision, particularly under unfamiliar lighting conditions, partial occlusion, or unusual viewing angles.
We learned that reliable hazard detection requires diverse training data and careful evaluation beyond familiar examples.
Handling model uncertainty
A high-confidence prediction is not necessarily a correct prediction.
This becomes particularly important when software decisions influence mechanical actions.
Rather than relying exclusively on confidence thresholds, we introduced independent safety rules and restricted live routing capabilities.
Integrating AI with embedded systems
Connecting a computer vision model to an ESP32 controller required more than sending an API request.
We needed to consider:
- Communication interruptions.
- Expired commands.
- Controller state.
- Missing acknowledgements.
- Object presence.
- Emergency stop conditions.
We addressed these challenges through explicit command authorization and controller safeguards.
Running computer vision locally
We wanted PyroGate to operate without requiring a dedicated GPU or continuous access to expensive cloud services.
Using ONNX Runtime and a lightweight detection architecture allowed us to perform inference on a CPU with measured millisecond-level latency.
Building a complete product experience
Getting the individual components to work was only part of the challenge. We also had to integrate and test them as a single application:
- Machine learning.
- Computer vision.
- Backend development.
- Frontend development.
- Embedded systems.
- Safety engineering.
- Database management.
- System integration.
- Testing and documentation.
Accomplishments that we're proud of
Measurable engineering results
| Evaluation | Recorded result |
|---|---|
| Internal hazard localization recall | 87.78% |
| CPU inference latency (P95) | 22.80 ms |
| Showcased cylindrical battery confidence | 95.6% |
| Showcased inference latency | 27.59 ms |
| Diagnostic safety probes | 347 |
| Quarantine outcomes | 174 |
| Hold outcomes | 173 |
| Recycling commands during safety probes | 0 |
| Supported detector categories | 7 |
| Gate routing positions | 3 |

These measurements represent internal model evaluations, an individual demonstrated detection, and controlled diagnostic testing. They are not industrial safety certification results.
Beyond the numbers
We are proud of building an integrated system that demonstrates the complete journey from visual detection to a traceable controller action.
Our accomplishments include:
- A functioning local computer vision pipeline.
- An independent deterministic safety engine.
- A responsive inspection dashboard.
- An ESP32-based embedded controller.
- An interactive Wokwi circuit.
- Emergency stop and watchdog mechanisms.
- Persistent inspection records.
- Source-aware diagnostic scenarios.
- Automated backend and frontend testing.
- Detailed technical documentation.
- Offline application operation after initial setup.
What we are most proud of is the working inspection flow, from an uploaded image to an explained safety decision and recorded controller acknowledgement.
Engineering transparency
Our internal evaluation identified weak recall for disposable vapes (15.79%) and power banks (20.00%). An earlier external cylindrical battery cohort also exposed a generalization gap, with zero localized batteries across 42 specimens. These findings highlight the need for better dataset coverage and independent validation.
These findings directly inform our conservative routing restrictions and future development roadmap.
View Detailed Model Evaluation
View System Verification and Documentation
What we learned
Working on PyroGate taught us that model accuracy is only one part of a reliable engineering system. We also had to design for situations where:
- A prediction is incorrect.
- Input quality is insufficient.
- Information is incomplete.
- Communication is interrupted.
- A controller becomes unavailable.
- An action cannot be confirmed.
Throughout development, we gained practical experience in:
Artificial Intelligence
Training, evaluating, exporting, and deploying computer vision models using local inference.
Safety engineering
Building deterministic policies around probabilistic predictions and prioritizing conservative decision-making.
Embedded systems
Developing ESP32 firmware, implementing controller safeguards, and integrating software with simulated mechanical systems.
Full-stack development
Creating responsive interfaces, backend APIs, persistent records, and end-to-end inspection workflows.
System design
Separating responsibilities across perception, decision-making, communication, actuation, and persistence.
Engineering accountability
Understanding the importance of reproducible evaluation, transparent limitations, and traceable operational decisions.
Our biggest takeaway: a useful AI system needs a clear plan for what happens when its predictions or connected components fail.
Potential real-world impact
PyroGate explores an upstream approach to waste management safety that could benefit several environments.
| Potential application | Intended benefit |
|---|---|
| Material Recovery Facilities | Earlier identification of potential battery hazards |
| Waste collection centers | Improved intake inspection |
| Municipal recycling facilities | More accessible hazard screening |
| E-waste collection facilities | Structured battery inspection |
| Waste transfer stations | Additional screening before further processing |
| Small recycling operators | Lower infrastructure requirements for inspection |
By identifying potential hazards before compaction, a properly validated future deployment could contribute to:
- Improved worker safety.
- Reduced risk of battery-related incidents.
- Better protection of recycling equipment.
- More accountable waste handling.
- Improved segregation of battery waste.
- More sustainable recycling operations.
Alignment with Sustainable Development Goals
PyroGate's intended impact aligns with:
- SDG 8: Decent Work and Economic Growth: Supporting safer working environments.
- SDG 9: Industry, Innovation and Infrastructure: Exploring accessible industrial safety technology.
- SDG 11: Sustainable Cities and Communities: Supporting safer municipal waste management.
- SDG 12: Responsible Consumption and Production: Improving waste segregation and responsible battery handling.
What's next for PyroGate?
Our long-term vision is to develop PyroGate into an accessible intake safety system for recycling and waste collection facilities.
Phase 1: Physical hardware integration
Develop an inert physical test bench integrating:
- ESP32 microcontroller.
- Camera module.
- Ultrasonic sensor.
- Servo-controlled sorting gate.
- Emergency stop mechanism.
- Controlled waste inspection chute.
This will allow us to evaluate physical controller behavior beyond simulation.
Phase 2: Improved hazard recognition
Expand our training and evaluation datasets to improve detection of:
- Disposable vapes.
- Powerbanks.
- Unfamiliar battery designs.
- Partially occluded batteries.
- Mixed waste scenes.
- Challenging lighting conditions.
- Unusual viewing angles.
Phase 3: Multimodal safety intelligence
Investigate complementary sensing technologies such as:
- Thermal imaging.
- Temperature sensors.
- Additional proximity sensors.
- Sensor fusion.
Visual detection alone cannot establish every aspect of battery safety. Combining multiple sensing modalities could improve future inspection reliability.
Phase 4: Continuous waste inspection
Extend the current image-based inspection workflow toward continuous conveyor monitoring.
Future capabilities could include:
- Continuous object detection.
- Multi-frame object tracking.
- Controlled real-time routing.
- Conveyor synchronization.
- Automated hazard event recording.
Phase 5: Facility-level monitoring
Develop centralized monitoring tools for:
- Hazard frequency.
- Inspection trends.
- Controller status.
- Maintenance records.
- Operational reporting.
- Multiple intake stations.
Phase 6: Independent validation
Conduct independent model evaluations, controlled physical testing, and facility-level assessments before pursuing industrial deployment.
Our goal is to move from a complete integrated demonstration toward a validated and accessible industrial safety solution.
Try PyroGate yourself
Watch the product demonstration
Explore the complete inspection experience, from image selection and computer vision to safety decisions and controller reporting.
Interact with the embedded controller
Test the ESP32 circuit directly in your browser without requiring a hardware kit.
Explore the source code
Review the implementation, system architecture, engineering decisions, and verification documentation.
Run locally on Windows
Requirements:
- Python 3.12
- Node.js 22 or newer
- npm
- PowerShell
Clone the repository:
git clone https://github.com/SanTiwari07/PyroGate.git
cd PyroGate
Start the application:
.\start.ps1
After the initial setup, PyroGate can also operate offline:
.\start.ps1 -Offline
The application supports diagnostic scenarios without model weights. Local AI inference requires an authorized ONNX model export, which is not distributed in the repository.
For complete installation instructions, visit the repository documentation.
Technical resources
- GitHub Repository
- Documentation Index
- Machine Learning Documentation
- Model Evaluation Results
- Safety and Security Architecture
- ESP32 Firmware
- Development Roadmap
Meet the team
We are two engineering students interested in applying computer vision and embedded systems to practical safety problems.
Sanskar Tiwari
Shambhavi Patil
PyroGate
Detect potential hazards before compaction. Make every routing decision accountable.
Built With
- arduino
- c++
- computer-vision
- css3
- edge-ai
- embedded-systems
- esp32
- fastapi
- html5
- iot
- machine-learning
- onnx
- onnx-runtime
- opencv
- playwright
- pytest
- python
- react
- rest-api
- sqlite
- typescript
- vite
- wokwi
- yolox



