BUDGET EDGE-AI VISION • UNDER ₹4,000

Vision-Based Automated E-Waste Sorter & Battery Hazard Detector

Replace expensive ₹25,000+ GPU boards with a thumb-sized, sub-₹2,200 Seeed XIAO ESP32S3 Sense. Powered by Edge Impulse FOMO object detection and dual servo diverter gates, this complete college prototype spots dangerous Lithium-Ion batteries on a mini conveyor belt before they cause recycling fires.

BoardSeeed XIAO ESP32S3 Sense (~₹1,600–₹2,200)
Vision AIEdge Impulse FOMO (96×96, ~5 FPS)
ActuationDual MG90S Servo Diverter Gates
Complete Build Cost~₹3,150 (< ₹4,000)

1. How It Works — 4-Stage Budget Edge-Vision Pipeline

Real-time object detection and physical sorting running completely on a microcontroller with 8 MB PSRAM.

STAGE 1 • TRIGGER

IR Trigger & OV2640 Capture

When an e-waste item breaks the FC-51 IR proximity sensor beam (D2/GPIO3), the onboard OV2640 camera immediately snaps a crisp 96×96 frame directly into 8 MB PSRAM.

STAGE 2 • TINYML VISION

On-Device FOMO Object Detection

The dual-core ESP32-S3 runs a quantized FOMO (MobileNetV2 0.35) neural network locally in ~160 ms—detecting item centroids and class labels with zero cloud latency or GPU cost.

STAGE 3 • ACTUATION

Dual-Servo Sorting & Hazard Interlock

Lithium-Ion batteries immediately swing Gate 1 (D0) into the fire-safe hazard bin while firing the Red LED & buzzer; PCBs/Cables divert via Gate 2 (D1); plastics pass straight through.

STAGE 4 • IOT ANALYTICS

Wi-Fi MQTT Analytics

Every sorted object updates the local 0.96″ SSD1306 OLED and publishes live JSON telemetry (item class, confidence %, total hazards prevented) to a recycling facility dashboard.

2. Interactive Real Wiring Diagram (Seeed XIAO ESP32S3 Sense)

Filter each circuit group below to trace the external 5V 2A servo power rail, I2C OLED bus, IR trigger, and hazard alert bank.

5V 2A SERVO RAIL 3.3V LOGIC RAIL I2C SDA (D4) I2C SCL (D5) SERVO 1 SIG (D0) IR (D2) OV2640 Camera (Sense) U.FL Wi-Fi XIAO ESP32S3 8MB PSRAM D8–D10 Free for microSD USB-C D0/G1 D1/G2 D2/G3 D3/G4 D4/SDA D5/SCL D6/G43 5V GND 3V3 D10 (SD) D9 (SD) D8 (SD) D7/G44 FC-51 IR Object Trigger Power @ 3.3V! VCC GND OUT 0.96" SSD1306 OLED FOMO E-WASTE AI LI-ION HAZARD! 93% | 158ms I2C Addr: 0x3C VCC GND SDA SCL External 5V 2A DC Power Adapter 470μF Prevents Servo Brownout +5V GND Servo 1 (MG90S) Battery Hazard Diverter Gate SIG 5V GND Servo 2 (MG90S) PCB / Cable Recovery Gate SIG 5V GND Hazard Alert Bank Buzzer (D3) 220Ω Red (D6) 220Ω Green (D7) All Cathodes & Buzzer (−) → GND 5V 2A Servo Rail 3.3V Logic Common GND Servos (D0/D1) IR Trig (D2) I2C OLED (D4/D5) Buzzer (D3) Red/Grn LEDs (D6/D7)
All Circuits Shown: An external 5V 2A adapter with a 470μF capacitor powers both MG90S servos and the XIAO 5V pin, while the XIAO's 3.3V rail cleanly powers the FC-51 IR trigger and SSD1306 OLED. Pins D8–D10 remain free for the Sense board's onboard microSD slot.

Hardware Safety & Pinout Notes (Read Before Powering On)

  1. Never Power Servos from XIAO's 3V3 Pin: MG90S/SG90 servos draw 400–700 mA spikes when swinging. Always power them from an external 5V 2A DC supply tied to Common GND with a 470μF decoupling capacitor across 5V and GND to prevent ESP32-S3 brownout resets during camera capture.
  2. Keep D8–D10 Free for microSD Logging: On the Seeed XIAO ESP32S3 Sense expansion board, pins D8 (GPIO7), D9 (GPIO8), and D10 (GPIO9) are shared with the onboard microSD card SPI bus. Keeping them free lets you save captured e-waste training photos straight to an SD card.
  3. Power the FC-51 IR Sensor at 3.3V: The ESP32-S3 is strictly 3.3V logic. Powering the FC-51 IR proximity module from the XIAO 3V3 pin guarantees its digital OUT signal never exceeds 3.3V on D2 (GPIO3).

3. Pin-to-Pin Wiring Table & Under-₹4,000 Bill of Materials

Complete pin mapping and realistic Indian-market component costs totaling ~₹3,150.

Component Module Pin XIAO ESP32S3 Pin ESP32-S3 GPIO Function
Servo 1 (Battery Hazard) SIG / VCC / GND D0 / Ext 5V / GND GPIO1 Swings Gate 1 to divert Li-Ion batteries to Fire-Safe Bin
Servo 2 (PCB Recovery) SIG / VCC / GND D1 / Ext 5V / GND GPIO2 Swings Gate 2 to divert PCBs & Cables to Recovery Bin
FC-51 IR Proximity Sensor OUT / VCC / GND D2 / 3V3 / GND GPIO3 Active-LOW trigger when e-waste enters OV2640 camera zone
Active Piezo Buzzer + (Pos) / − (Neg) D3 / GND GPIO4 Audible fire-hazard alarm when a Lithium battery is spotted
0.96" SSD1306 I2C OLED SDA / SCL / VCC / GND D4 / D5 / 3V3 / GND GPIO5 / GPIO6 Live status readout (Class, Confidence %, Inference ms, Counts)
Red Hazard LED (+220Ω) Anode / Cathode D6 / GND GPIO43 Flashes Red strobe on Lithium-Ion battery detection
Green Safe LED (+220Ω) Anode / Cathode D7 / GND GPIO44 Lights steady Green when sorting non-hazardous items
External 5V 2A + 470μF +5V / GND 5V / GND Power Bus Clean high-current power rail for dual servos & XIAO board

Under-₹4,000 Bill of Materials (Indian Market Pricing)

Component Recommended Part / Spec Qty Approx. Price (INR)
Edge-AI Vision Board Seeed XIAO ESP32S3 Sense (OV2640 Cam + 8MB PSRAM + Mic) 1 ₹1,600 – ₹2,200 (avg ₹1,900)
Diverter Gate Servos MG90S Metal-Gear (or SG90) Micro Servo Motors 2 ₹320
Object Trigger Sensor FC-51 Infrared Obstacle Avoidance Sensor Module 1 ₹60
OLED Status Display 0.96" I2C OLED Display (SSD1306, 128×64) 1 ₹220
Servo Power & Filtering 5V 2A DC Power Adapter + Barrel Jack + 470μF 16V Capacitor 1 set ₹250
Hazard Alert Parts Active Buzzer, Red/Green 5mm LEDs, 220Ω Resistors, Jumper Wires 1 set ₹150
Mini Conveyor Structure Cardboard / Foamboard Frame + Small DC Gear Motor Belt (or Ramp) 1 set ₹250
Complete Build Cost (Well Under the ₹4,000 Student Budget!) ~₹3,150

Other Under-₹4,000 Vision Boards from IoTInfo

Kendryte K210 Maix Bit ~₹2,444 – ₹3,835

Includes a dedicated KPU AI accelerator capable of ~15–20 FPS Tiny-YOLO, but has no built-in Wi-Fi and a smaller beginner community than ESP32-S3.

Raspberry Pi Zero 2 W + Pi Cam ~₹2,600 – ₹3,200

Runs full Linux + Python + OpenCV/TFLite, great for software students, though 512 MB RAM limits heavy models and SD card boot takes 25+ seconds.

ESP32-CAM (AI-Thinker) ~₹500 – ₹720

Ultra-cheap option with OV2640, but requires an external FTDI USB programmer, has slower ESP32-D0WD CPU (no S3 AI vector instructions), and very few free GPIOs.

4. Interactive Live Conveyor & FOMO Vision Simulator

Drop e-waste items onto the moving conveyor belt to watch the IR trigger, Edge Impulse FOMO centroid detection, dual servo gates, and battery hazard interlock in action.

TOP-DOWN MINI CONVEYOR • OV2640 96×96 FOMO INSPECTION BELT: RUNNING
SSD1306 OLED (D4/D5) ~5.4 FPS
READY: SCANNING
CLASS: WAITING FOR IR
CONF: --% | INF: -- ms
TOTAL SORTED: 0
Red Hazard (D6)
OFF
Green Safe (D7)
READY
Batteries Caught0
PCBs Recovered0
Cables Recovered0
Plastics General0
MQTT: recycle/line01/ewaste Wi-Fi Live

        

5. 4-Step TinyML Vision Guide (Edge Impulse FOMO)

Train an accurate 4-class e-waste detector in your browser for free—no Python setup or cloud GPU required.

1

Capture 60–80 Photos Per Class

Mount the XIAO ESP32S3 Sense 15–20 cm above your conveyor belt under a steady white desk lamp. Capture 60–80 varied angles each of battery, pcb, cable, and plastic.

2

Label Bounding Boxes

Upload your images to Edge Impulse Studio (choose Object Detection project type). Draw tight bounding boxes around every e-waste object in the Labeling Queue—taking just 10 minutes.

3

Train FOMO (MobileNetV2 0.35)

Select FOMO (Faster Objects, More Objects) at 96×96 resolution. Unlike heavy YOLOv8 (which needs 100+ MB RAM), FOMO predicts object centroids using <250 KB RAM and runs smoothly at ~5 FPS on ESP32-S3.

4

Export & Flash with PSRAM

Go to Deployment → Arduino Library (.zip) (Int8 quantized). In Arduino IDE, select XIAO_ESP32S3, set Tools → PSRAM → OPI PSRAM, import the zip, and flash the starter sketch below.

6. Copy-Ready Arduino Starter Code (Seeed XIAO ESP32S3 Sense)

Install ESP32Servo and Adafruit SSD1306 from Library Manager, select XIAO_ESP32S3, enable OPI PSRAM, and upload.

xiao_esp32s3_ewaste_fomo_sorter.ino • OV2640 + FOMO Hook + Dual MG90S Servos + OLED
// ============================================================================
// Vision-Based Automated E-Waste Sorter & Battery Hazard Detector (Under ₹4,000)
// Board: Seeed XIAO ESP32S3 Sense (Enable Tools -> PSRAM -> OPI PSRAM!)
// Pins: D0=Servo1(Hazard), D1=Servo2(PCB), D2=IR Trigger, D3=Buzzer,
//       D4=OLED SDA, D5=OLED SCL, D6=Red Hazard LED, D7=Green Safe LED
//       D8-D10 kept FREE for onboard microSD card slot.
// ============================================================================

#include "esp_camera.h"
#include <Wire.h>
#include <ESP32Servo.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// #include <your_ewaste_fomo_inferencing.h> // Uncomment after Edge Impulse export

// --- Seeed XIAO ESP32S3 Sense OV2640 Camera Pin Map ---
#define PWDN_GPIO_NUM  -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM  10
#define SIOD_GPIO_NUM  40
#define SIOC_GPIO_NUM  39
#define Y9_GPIO_NUM    48
#define Y8_GPIO_NUM    11
#define Y7_GPIO_NUM    12
#define Y6_GPIO_NUM    14
#define Y5_GPIO_NUM    16
#define Y4_GPIO_NUM    18
#define Y3_GPIO_NUM    17
#define Y2_GPIO_NUM    15
#define VSYNC_GPIO_NUM 38
#define HREF_GPIO_NUM  47
#define PCLK_GPIO_NUM  13

// --- External Actuator, Sensor & Alert Pins ---
#define SERVO_HAZARD_PIN  D0  // GPIO1: Battery Hazard Diverter Gate 1
#define SERVO_PCB_PIN     D1  // GPIO2: PCB/Cable Recovery Gate 2
#define IR_TRIGGER_PIN    D2  // GPIO3: FC-51 IR Sensor (Active LOW)
#define BUZZER_PIN        D3  // GPIO4: Active Piezo Buzzer
#define RED_LED_PIN       D6  // GPIO43: Red Hazard LED (+220 Ohm)
#define GREEN_LED_PIN     D7  // GPIO44: Green Safe LED (+220 Ohm)

Servo gateHazard, gatePcb;
Adafruit_SSD1306 display(128, 64, &Wire, -1);

int batteryCount = 0, pcbCount = 0, plasticCount = 0;

bool initCamera() {
  camera_config_t cfg = {};
  cfg.ledc_channel = LEDC_CHANNEL_0;
  cfg.ledc_timer   = LEDC_TIMER_0;
  cfg.pin_d0 = Y2_GPIO_NUM; cfg.pin_d1 = Y3_GPIO_NUM;
  cfg.pin_d2 = Y4_GPIO_NUM; cfg.pin_d3 = Y5_GPIO_NUM;
  cfg.pin_d4 = Y6_GPIO_NUM; cfg.pin_d5 = Y7_GPIO_NUM;
  cfg.pin_d6 = Y8_GPIO_NUM; cfg.pin_d7 = Y9_GPIO_NUM;
  cfg.pin_xclk = XCLK_GPIO_NUM; cfg.pin_pclk = PCLK_GPIO_NUM;
  cfg.pin_vsync = VSYNC_GPIO_NUM; cfg.pin_href = HREF_GPIO_NUM;
  cfg.pin_sccb_sda = SIOD_GPIO_NUM; cfg.pin_sccb_scl = SIOC_GPIO_NUM;
  cfg.pin_pwdn = PWDN_GPIO_NUM; cfg.pin_reset = RESET_GPIO_NUM;
  cfg.xclk_freq_hz = 20000000;
  cfg.pixel_format = PIXFORMAT_RGB565;
  cfg.frame_size   = FRAMESIZE_96X96; // Matches Edge Impulse FOMO input
  cfg.fb_location  = CAMERA_FB_IN_PSRAM;
  cfg.fb_count     = 1;
  return (esp_camera_init(&cfg) == ESP_OK);
}

void updateOLED(String title, String detail) {
  display.clearDisplay();
  display.setTextSize(1);
  display.setCursor(0, 0);
  display.println("E-WASTE FOMO SORTER");
  display.drawLine(0, 10, 128, 10, SSD1306_WHITE);
  display.setTextSize(2);
  display.setCursor(0, 18);
  display.println(title);
  display.setTextSize(1);
  display.setCursor(0, 42);
  display.println(detail);
  display.setCursor(0, 54);
  display.printf("BAT:%d PCB:%d PLS:%d", batteryCount, pcbCount, plasticCount);
  display.display();
}

// Replace this hook with your Edge Impulse run_classifier() FOMO loop
String runFomoDetection(camera_fb_t *fb, float &confOut) {
  // In Edge Impulse: convert fb->buf RGB565 -> signal_t, call run_classifier()
  // and read result.bounding_boxes[i].label + .value (confidence).
  confOut = 0.92;
  return "battery"; // Demo placeholder until FOMO library is linked
}

void sortItem(String label, float conf, unsigned long infMs) {
  String info = "Conf:" + String((int)(conf * 100)) + "% " + String(infMs) + "ms";

  if (label == "battery") {
    batteryCount++;
    digitalWrite(GREEN_LED_PIN, LOW);
    digitalWrite(RED_LED_PIN, HIGH);
    digitalWrite(BUZZER_PIN, HIGH);
    updateOLED("HAZARD!", info);

    gateHazard.write(75);   // Swing Gate 1 -> Fire-Safe Bin
    delay(900);
    gateHazard.write(0);    // Return Gate 1 to home
    digitalWrite(BUZZER_PIN, LOW);
    digitalWrite(RED_LED_PIN, LOW);
    digitalWrite(GREEN_LED_PIN, HIGH);
  } else if (label == "pcb" || label == "cable") {
    pcbCount++;
    updateOLED("PCB/WIRE", info);
    delay(350);             // Wait for belt travel to Gate 2
    gatePcb.write(75);      // Swing Gate 2 -> PCB Recovery Bin
    delay(800);
    gatePcb.write(0);
  } else {
    plasticCount++;
    updateOLED("PLASTIC", info);
    delay(600);             // Pass straight through to General Bin
  }

  // Print JSON packet (publish over Wi-Fi MQTT in full deployment)
  Serial.printf("{\"class\":\"%s\",\"conf\":%.2f,\"inf_ms\":%lu,\"hazards\":%d}\n",
                label.c_str(), conf, infMs, batteryCount);
}

void setup() {
  Serial.begin(115200);
  pinMode(IR_TRIGGER_PIN, INPUT);
  pinMode(BUZZER_PIN, OUTPUT);
  pinMode(RED_LED_PIN, OUTPUT);
  pinMode(GREEN_LED_PIN, OUTPUT);
  digitalWrite(GREEN_LED_PIN, HIGH);

  // I2C OLED on D4 (SDA) & D5 (SCL)
  Wire.begin();
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  display.setTextColor(SSD1306_WHITE);

  // Attach MG90S Servos (50 Hz PWM)
  gateHazard.attach(SERVO_HAZARD_PIN, 500, 2400);
  gatePcb.attach(SERVO_PCB_PIN, 500, 2400);
  gateHazard.write(0);
  gatePcb.write(0);

  if (!initCamera()) {
    updateOLED("CAM ERR", "Enable OPI PSRAM");
    while (1) delay(1000);
  }
  updateOLED("READY", "Waiting for IR...");
}

void loop() {
  // FC-51 IR Sensor outputs LOW when an e-waste item enters camera zone
  if (digitalRead(IR_TRIGGER_PIN) == LOW) {
    unsigned long t0 = millis();
    camera_fb_t *fb = esp_camera_fb_get();
    if (fb) {
      float conf = 0.0;
      String detected = runFomoDetection(fb, conf);
      esp_camera_fb_return(fb);
      unsigned long infMs = millis() - t0;

      if (conf >= 0.75) {
        sortItem(detected, conf, infMs);
      }
    }
    while (digitalRead(IR_TRIGGER_PIN) == LOW) delay(30); // Wait until item clears
    updateOLED("READY", "Waiting for IR...");
  }
  delay(25);
}

7. College Viva & Evaluation Q&A (6 Questions)

Expand each question to prepare confident, engineering-backed answers for your project demo and external examiners.

Full YOLOv8 models require hundreds of megabytes of RAM and dedicated CUDA GPUs—costing ₹25,000+ and drawing 10–15W of power. On a conveyor belt, we don't need pixel-perfect bounding boxes; we only need to know what the object is and its center point (centroid) to trigger a diverter gate. Edge Impulse FOMO removes the heavy bounding-box regression heads, cutting RAM usage to <250 KB so a sub-₹2,200 XIAO ESP32S3 Sense can sort e-waste at ~5 FPS for a fraction of the cost and power.
The ESP32-S3 has only ~512 KB of internal SRAM, which must hold the Wi-Fi/TCP stack, OLED framebuffer, RTOS tasks, and neural network tensor arena. Storing uncompressed OV2640 RGB565 camera frames alongside intermediate FOMO feature maps would immediately cause an out-of-memory crash without external memory. The XIAO ESP32S3 Sense's 8 MB Octal PSRAM (OPI PSRAM) stores camera framebuffers cleanly while internal SRAM stays fast for AI math.
Micro servos experience brief stall current spikes of 500–700 mA each when starting to swing. Drawing that spike from the XIAO's USB port or 3.3V regulator drags the voltage down below 2.8V, triggering an instant ESP32-S3 brownout reset right in the middle of sorting. An external 5V 2A adapter + 470μF capacitor absorbs those current spikes, while tying both grounds together (Common GND) gives the PWM signal pins (D0/D1) a shared voltage reference.
The FC-51 IR proximity sensor acts as a fast, deterministic hardware trigger. Instead of running continuous vision inference on an empty conveyor belt (wasting heat, power, and risking false triggers on belt scratches), the IR beam ensures the OV2640 captures an image at the exact moment an object is centered directly beneath the lens—improving accuracy and synchronizing the servo timing delay.
Computer vision models are sensitive to shadows and glare. We stabilize accuracy using three practical techniques: (1) Building a small light-hood box over the camera zone with a constant diffused white LED strip; (2) Using a matte dark-gray conveyor belt surface for high contrast against green PCBs and shiny batteries; and (3) Training the FOMO model with slight brightness/rotation variations plus a confidence threshold (≥ 0.75).
In an industrial recycling plant, the same 4-stage architecture scales up by replacing the MG90S micro-servos with pneumatic air-jet ejectors or heavy-duty linear actuators, adding a thermal/IR camera alongside RGB vision to spot overheating lithium cells, upgrading the compute node to a multi-camera industrial edge gateway, and connecting the MQTT stream directly to an automated conveyor emergency-stop PLC.