Skip to content

Circuit-Digest/Raspberry-Pi-based-Waste-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Waste Detection Using Raspberry Pi with CircuitDigest Cloud

In our busy routines, sorting waste is often neglected, leading to biodegradable and non-biodegradable waste being mixed in the same bin. This creates a manual segregation bottleneck downstream. This project introduces a smart waste detection system that automatically classifies objects as biodegradable or non-biodegradable in real-time. By utilizing a Raspberry Pi, a USB camera, and the CircuitDigest Cloud Waste Detection API, you can deploy an automated waste-segregation system without collecting datasets, labeling data, or training complex AI models locally.

Features

  • Real-Time Classification: Detects and classifies waste as biodegradable or non-biodegradable in seconds using cloud-based AI.
  • Multiple Operating Modes:
    • Keyboard Mode: Capture images manually by pressing the SPACE key.
    • Auto Mode: Automatically captures images at a fixed time interval (e.g., every 5 seconds).
    • SSH Mode: Runs in headless mode via terminal access without showing an OpenCV feed window.
  • Zero Local Overhead: Eliminates the need for GPU-heavy local processing or platforms like TensorFlow Lite and Edge Impulse.
  • Versatile Deployment: Ideal for smart bins in public places, offices, malls, or sorting facilities.

Hardware Requirements

  • Raspberry Pi (Pi 3, Pi 4, or newer, connected to external power)
  • USB Web Camera (For capturing images of waste items)
  • Laptop/PC (For initial setup and result observation)
  • MicroSD Card (with Raspberry Pi OS installed)

Hardware Setup

  1. Place the USB camera in a position where waste items can be clearly presented to it.
  2. Connect the USB camera to one of the USB ports on the Raspberry Pi.
  3. Ensure the Raspberry Pi is powered using a sufficient external power source.

Software Setup

  1. Setup your Raspberry Pi using the Raspberry Pi Imager with a standard OS installation.
  2. Create an account on the CircuitDigest Cloud.
  3. Navigate to the Waste Detection feature and copy your API Key.
  4. Open Thonny IDE (or your preferred editor) on the Raspberry Pi.
  5. Install the necessary Python packages:
    pip install opencv-python requests

Installation & Usage

  1. Clone this repository or copy the Python script to your Raspberry Pi.
  2. Edit the script to configure your parameters:
    SERVER_URL = "https://www.circuitdigest.cloud/api/v1/waste-detection/detect"
    API_KEY    = "YourApikey"  # <-- Paste your CircuitDigest API Key here
    MODE = "keyboard"          # <-- Set to "keyboard", "auto", or "ssh"
    AUTO_INTERVAL = 5          # <-- Interval in seconds for auto mode
  3. Run the script:
    python waste_detection.py
  4. Depending on the mode selected, the system will capture images of the waste, transmit them securely to the CircuitDigest Cloud API, and output whether the item is biodegradable or non-biodegradable in the terminal.

Troubleshooting

  • Camera not found! Check USB camera connection: Verify the physical connection of the camera. If multiple video devices are connected, you may need to update the device index from cv2.VideoCapture(0) to cv2.VideoCapture(1).
  • API request timeout: Verify that your Raspberry Pi has active and stable internet access. You can increase the timeout limit in the script.
  • Invalid API key error: Re-verify that your API key is correctly copied from the CircuitDigest Cloud and pasted into the script without extra spaces.
  • Incorrect waste classification result: Ensure the waste object is well-lit and fully visible to the camera. Avoid blurry shots or angled perspectives that obscure the item.
  • Program crashes during execution: Ensure OpenCV and Requests libraries are installed properly. Restart the Raspberry Pi or script if the camera stream encounters an error.

Advantages & Limitations

Advantages Limitations
Automatically segregates biodegradable & non-biodegradable waste in real time Requires a stable internet connection for cloud processing
Reduces manual work and simplifies recycling sorting Classification accuracy depends on image clarity and camera quality
Low hardware entry point using standard USB webcams Poor lighting or overlapping objects can impact results
Supports automatic intervals or manual keyboard captures API limits might apply depending on your subscription
Promotes cleaner smart city/household waste management Slight transmission latency for sending images over the network

Relevant Links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors