Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino-Based Smart Waste Sorting System with Ultrasonic, Rain, and Proximity Sensors

View and Edit Project In Cirkit DesignerImage of Arduino-Based Smart Waste Sorting System with Ultrasonic, Rain, and Proximity Sensors

Circuit Documentation

Summary

This circuit is designed to detect and classify objects based on their material and moisture content. It uses an Arduino UNO microcontroller to interface with various sensors and actuators, including a rain sensor, ultrasonic sensor, capacitive proximity sensor, LCD display, servo motor, and stepper motor. The system can differentiate between metal, wet, and dry objects and sort them accordingly.

Component List

  1. 9V Battery

    • Description: Provides power to the circuit.
    • Pins: +, -
  2. Arduino UNO

    • Description: Microcontroller used to control the circuit.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  3. RAIN SENSOR

    • Description: Detects the presence of rain or moisture.
    • Pins: AO, DO, GRD, VCC
  4. Lcd 20x4 i2c

    • Description: Displays information to the user.
    • Pins: GND, 5v, SCA, SCL
  5. HC-SR04 Ultrasonic Sensor

    • Description: Measures distance to an object.
    • Pins: VCC, TRIG, ECHO, GND
  6. LJC18A3-B-Z/BY Capacitive Proximity Sensor

    • Description: Detects the presence of metal objects.
    • Pins: VO (BLU), VI (BRN), SIG (BLK)
  7. Micro servo 9G

    • Description: Actuator used to move objects.
    • Pins: GND, +5V, PWM
  8. 28BYJ-48 Stepper Motor

    • Description: Motor used to rotate objects to different positions.
    • Pins: BLUE, PINK, YELLOW, ORANGE, RED
  9. ULN 2003

    • Description: Driver for the stepper motor.
    • Pins: IN1, IN2, IN3, IN4, IN5, IN6, IN7, GND, +, COIL1, COIL2, COIL3, COIL4, COIL5

Wiring Details

9V Battery

Arduino UNO

RAIN SENSOR

Lcd 20x4 i2c

HC-SR04 Ultrasonic Sensor

LJC18A3-B-Z/BY Capacitive Proximity Sensor

Micro servo 9G

28BYJ-48 Stepper Motor

ULN 2003

Documented Code

#include <Stepper.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>

#define POWER_PIN 6  // The Arduino pin that provides the power to the rain sensor
#define DO_PIN 0     // The Arduino's pin connected to DO pin of the rain sensor
#define SERVO_PIN 13 // Pin for the servo motor

// Ultrasonic
const int trigPin = 3;
const int echoPin = 2;
long duration;
int distance;

// Inductive Sensor
const int InductiveSensor = 7;

// Stepper Motor
int stepsPerRevolution = 2048;
int rpm = 10;
Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11);

// Servo Motor
Servo myServo;

// LCD
LiquidCrystal_I2C lcd(0x27, 16, 2); // 16x2 LCD display

// Dry Object Detection Counter
int dryCounter = 0;
const int dryThreshold = 3; // Number of consecutive detections to confirm dry

// Stepper position tracker
int currentPosition = 0;
const int dryPosition = 0;
const int wetPosition = stepsPerRevolution / 3; // 120 degrees
const int metalPosition = stepsPerRevolution * 2 / 3; // 240 degrees

void setup() {
  myStepper.setSpeed(rpm);
  myServo.attach(SERVO_PIN); // Attach the Servo to pin 13
  pinMode(InductiveSensor, INPUT);
  pinMode(trigPin, OUTPUT); // Ultrasonic trig pin
  pinMode(echoPin, INPUT);  // Ultrasonic echo pin
  pinMode(POWER_PIN, OUTPUT);  // Rain sensor power pin
  pinMode(DO_PIN, INPUT);      // Rain sensor digital output pin
  lcd.init();               // Initialize LCD
  lcd.backlight();          // Turn on LCD backlight
  Serial.begin(9600);
}

void loop() {
  getDistance();

  // Check for metal detection first
  int inductiveValue = digitalRead(