SnapSort

AI-Powered Smart Waste Sorting

SnapSort leverages Google's Gemini AI to revolutionize waste management. By instantly analyzing items via webcam, it automatically directs an Arduino-controlled platform to sort waste into the correct category—Trash, Recycling (Paper), or Recycling (Plastic/Glass/Metal)—while tracking your environmental impact in real-time.


Features

  • AI Recognition: Utilizes Gemini Flash for rapid, accurate waste identification.
  • Live Dashboard: Monitors real-time sorting stats and carbon footprint reduction (kg CO2e).
  • Hardware Integration: Seamlessly communicates with Arduino to physically actuate sorting servos.
  • Demo Mode: Fully functional without hardware (Analysis only).
  • Computer Vision: Captures and processes images directly from a connected webcam.

Installation

Follow these steps to set up the SnapSort development environment.

Prerequisites

  • Node.js (v18+)
  • Arduino IDE (Optional - for hardware control)
  • A webcam connected to your PC
  • Gemini API Key

1. Backend Setup

The backend handles image processing, AI communication, and hardware control.

  1. Install Dependencies

    npm install
    
  2. Configure Environment Create a .env file in the root directory:

    cp .env.example .env
    

    Open .env and configure your API key:

    API_KEY=your_actual_api_key_here
    SERIAL_PORT=COM6  # Adjust based on your Arduino port
    
  3. Start the Server

    npx ts-node server.ts
    

    The server works on http://localhost:3000.

2. Frontend Setup

The frontend provides the user interface and stats dashboard.

  1. Navigate to Dashboard

    cd dashboard
    
  2. Install Dependencies

    npm install
    
  3. Run Development Server

    npm run dev
    

    Open your browser to http://localhost:5173.


Usage

  1. Ensure server.ts is running. (If no Arduino is detected, the system enters Demo Mode).
  2. Open the Dashboard.
  3. Place an item in front of the camera.
  4. The system will analyze the image and categorize it. (In Demo Mode, it simulates the sort).
  5. Watch your carbon savings grow on the dashboard!

Tech Stack

  • Backend: Node.js, Express, TypeScript
  • AI: Google Gemini (Flash Model)
  • Frontend: React, Vite
  • Hardware: Arduino, SerialPort, Servos

License

This project is licensed under the MIT License.

Share this project:

Updates