DEV Community

Darlington Mbawike
Darlington Mbawike

Posted on

๐ŸŒ DecoScan: AI Environmental Intelligence

DEV Weekend Challenge: Earth Day

*This is a submission for [Weekend Challenge:]

๐ŸŒ DecoScan: AI Environmental Intelligence

Scan Smart. Dispose Right. Empowered by Gemini AI.

๐Ÿ’ก The Problem

In the global fight against waste, the biggest hurdle isn't the will to recycleโ€”itโ€™s uncertainty. Users struggle to know if an item is truly recyclable, often defaulting to "wish-cycling" which contaminates waste streams. Existing solutions are either too slow, require constant internet, or provide generic, non-actionable advice.

๐Ÿš€ Our Solution: DecoScan

DecoScan is a production-grade, offline-first environmental intelligence system. It doesnโ€™t just label waste; it understands the context. By merging high-speed on-device ML with the reasoning power of Google Gemini, DecoScan provides an instant, personalized sustainability roadmap for every item you hold.


โœจ Key "Wow" Features

1. ๐Ÿง  Smart Eco Coach (Gemini AI Driven)

Our 3-Stage Intelligence Pipeline uses Gemini 1.5 Flash to perform a real-time environmental audit:

  • Analysis: Multi-object material detection (Plastic, Glass, Metal, Wood, Fabric, Ceramic, Stone, Paper).
  • Correction: A safety layer that uses AI reasoning to fix common classification biases (e.g., distinguishing metallic polymers from pure metals).
  • Personalized Coaching: Actionable advice based on the user's specific Eco Level, EcoScore, and Behavioral History.

2. ๐Ÿงฌ Contextual Memory System

DecoScan learns from you. Using a lightweight behavioral engine built on Jetpack DataStore, the app tracks your last 10 scans to identify patterns. If the system notices you excel at recycling glass but struggle with plastic, the Smart Eco Coach adapts its tips to encourage improvement in your weak areas.

3. ๐Ÿ›ก๏ธ Mission-Critical "Offline First"

Core functionality never fails. Using CameraX and a custom-optimized TensorFlow Lite model, the app identifies materials instantly without a signal. We even engineered an Advanced HSV Heuristics Engine that analyzes physical light properties to ensure 100% accuracy even when the cloud is out of reach.

4. ๐ŸŽฎ Gamified Impact Tracking

We turned sustainability into a mission:

  • EcoScore: A dynamic scoring system that rewards difficult material sorting.
  • CO2 Impact Helper: Translates abstract grams into real-world wins (e.g., "You've saved enough CO2 to power a LED bulb for 5 hours").
  • Eco Achievements: A sleek badge collection system (๐ŸŒฑ First Step, ๐ŸŒŠ Ocean Friend, ๐ŸŒฒ Nature Lover) that rewards consistent habits.

๐Ÿ› ๏ธ The Tech Stack

  • UI: 100% Jetpack Compose (Material 3) with premium micro-interactions and animated state transitions.
  • AI/ML: Google Gemini Pro (LLM Reasoning), TensorFlow Lite (On-device Vision).
  • Vision Verification: Custom HSV Heuristics Engine for classification bias correction.
  • Persistence: Jetpack DataStore for Behavioral Memory, Last-Known Insights, and Secure Auth.
  • Architecture: Clean Architecture + MVVM (Strict separation of Data, Domain, and Presentation).
  • Networking: OkHttp with resilient 2-second timeout and JSON-parsing failsafes.

๐Ÿ—๏ธ Technical Challenges & Solutions

  • The "Everything is Plastic" Bug: Neural networks often over-classify objects as plastic in low light. I solved this by building a Vision Verification Pipeline that cross-references ML results with physical color theory data (Hue, Saturation, Value) before finalizing the result.
  • Cloud Latency: To keep the app snappy, we implemented a Non-Blocking Enhancement Pattern. The result is shown instantly via local ML, while the Gemini Coach "thinks" in the background, updating the UI with "Live Intelligence" only when ready.

๐Ÿ† Final Impact

DecoScan transforms a mundane chore into an engaging, educational experience. It demonstrates that the future of AI isn't just in the cloudโ€”it's in the seamless bridge between on-device reliability and cloud-based reasoning.

Build the Future. Scan Smart. Dispose Right.
DecoScan by Darchums AI
arth Day Edition](https://dev.to/challenges/weekend-2026-04-16)*

What I Built

Demo

https://youtube.com/shorts/ioq2UvH3dTo?si=XdQXXOC1u4Egfl46

Code

https://github.com/darchumsone-collab/DecoScan

How I Built It

I designed DecoScan using a hybrid AI architecture that combines fast on-device processing with cloud-based reasoning for deeper intelligence.


๐Ÿ” 1. On-Device Vision System

To ensure speed and reliability, I implemented real-time material detection using:

  • TensorFlow Lite for lightweight, optimized inference
  • CameraX for seamless camera integration

This enables instant material classification, even without internet connectivity.


๐Ÿง  2. Vision Verification Pipeline (Key Innovation)

A major challenge was the tendency of models to over-classify objects as โ€œplastic,โ€ especially in low-light conditions.

To address this, I built a custom HSV Heuristics Engine:

  • Analyzes Hue, Saturation, and Value (HSV) from the camera feed
  • Cross-references ML predictions with physical color properties
  • Adjusts outputs to improve real-world accuracy

This acts as a second validation layer, significantly increasing prediction reliability.


๐Ÿค– 3. Gemini-Powered Smart Eco Coach

For advanced reasoning and user guidance, I integrated Google Gemini (1.5 Flash).

Gemini is responsible for:

  • Interpreting detected materials in context
  • Generating clear, actionable recycling instructions
  • Delivering personalized coaching based on user behavior

To maintain a smooth UX, I implemented a non-blocking enhancement pattern:

  • Local ML results appear instantly
  • Gemini processes insights asynchronously
  • UI updates dynamically with refined intelligence

๐Ÿงฌ 4. Contextual Memory System

To personalize the experience, I built a behavioral memory system using Jetpack DataStore:

  • Stores the userโ€™s last 10 scans
  • Identifies recycling patterns and weak areas
  • Feeds behavioral context into Gemini for adaptive coaching

This transforms DecoScan into a learning system that evolves with the user.


๐ŸŽฎ 5. Gamification Layer

To drive engagement and retention, I implemented:

  • EcoScore system based on recycling difficulty and accuracy
  • COโ‚‚ impact estimation, translated into real-world equivalents
  • Achievement badges to reward consistency and progress

This encourages long-term behavioral change.


๐Ÿ›๏ธ 6. Architecture & UI

The application follows Clean Architecture with MVVM:

  • Clear separation between data, domain, and presentation layers
  • Improved scalability and maintainability

UI was built using:

  • Jetpack Compose (Material 3)
  • Smooth animations and micro-interactions for a premium feel

โšก 7. Performance & Reliability

  • Offline-first design ensures core features always work
  • OkHttp networking layer with timeouts and fail-safes
  • Lightweight local storage for fast state persistence

๐Ÿ”š Summary

By combining on-device ML, AI reasoning, and behavioral intelligence, I built a system that is fast, adaptive, and reliable in real-world conditions โ€” not just in ideal environments.

Prize Categories

๐Ÿ† Prize Categories

๐Ÿง  Best Use of Google Gemini

DecoScan leverages Google Gemini (1.5 Flash) as the core reasoning engine behind its Smart Eco Coach.

Rather than using Gemini for simple text generation, it is deeply integrated into a 3-stage intelligence pipeline:

  • Interprets real-world material detection results
  • Corrects classification ambiguity using contextual reasoning
  • Generates personalized, actionable recycling guidance

Gemini operates within a non-blocking enhancement architecture, where:

  • On-device ML delivers instant results
  • Gemini refines insights asynchronously
  • The UI updates dynamically with โ€œlive intelligenceโ€

Additionally, Gemini is enhanced with behavioral context (via Jetpack DataStore), allowing it to adapt recommendations based on the userโ€™s recycling habits and history.

This transforms Gemini from a generic assistant into a personalized environmental intelligence engine.


๐Ÿ’ป Best Use of GitHub Copilot (Optional, if applicable)

GitHub Copilot was used to accelerate development across:

  • Jetpack Compose UI components
  • MVVM architecture scaffolding
  • Networking and data handling layers

This enabled rapid prototyping while maintaining clean, production-level code quality.


๐ŸŒ Overall Impact

DecoScan showcases a powerful hybrid model where:

  • On-device AI ensures speed and reliability
  • Gemini provides deep reasoning and personalization

This creates a seamless, real-world AI experience that is fast, intelligent, and impactful.

Built solo by @darlington_mbawike_9a7a87

Top comments (0)