Arduino-Controlled Waste Collection System with Ultrasonic Sensing and GSM Notifications
View and Edit Project In Cirkit Designer
Waste Collection System Circuit Documentation
Summary
This circuit is designed to control a waste collection system that includes the following phases: Collection, Lifting, Dumping, and Resetting. It utilizes an HC-SR04 Ultrasonic Sensor to monitor the fill level of a bin, a GSM SIM900 module for sending updates, a DC Motor for movement, and a 1-Channel Relay to control the motor based on the bin's fill level. An Arduino Uno R3 serves as the central microcontroller, interfacing with an LCD I2C Display for user feedback. The circuit is powered by a 12V 5A Power Supply, with a LM2956 Buck Converter regulating the voltage for the Arduino and other 5V components.
Component List
HC-SR04 Ultrasonic Sensor
- Pins: VCC, TRIG, ECHO, GND
- Description: Used to measure the distance to the waste in the bin and determine the fill level.
Arduino Uno R3
- Pins: USB Port, Power Jack, IOREF, RESET, 3.3V, 5V, GND, VIN, A0-A5, SCL, SDA, AREF, Digital IO (0-13)
- Description: Acts as the central microcontroller to control the system's operations.
GSM SIM900
- Pins: A5, A4, A3, A2, A1, A0, 5V, GND, 3.3V, RESET, D0-D13, AREF
- Description: Provides GSM communication capabilities to send updates about the system's status.
1-Channel Relay (5V 10A)
- Pins: NC, signal, C, power, NO, ground
- Description: Controls the power to the DC Motor based on signals from the Arduino.
LCD I2C Display
- Pins: GND, VCC, SDA, SCL
- Description: Displays the system status and the measured distance to the user.
DC Motor
- Pins: pin 1, pin 2
- Description: Provides the mechanical action for the waste collection system.
L298N DC Motor Driver
- Pins: OUT1, OUT2, 12V, GND, 5V, OUT3, OUT4, ENA, IN1-IN4, ENB
- Description: Drives the DC Motor based on control signals from the Arduino.
POWER SUPPLY 12V 5AMP
- Pins: 220V Positive Pole (AC), 220V Negative Pole (AC), GND (DC), 12V-24V Output (DC)
- Description: Supplies power to the motor driver and the buck converter.
LM2956 Buck Converter DC-DC
- Pins: OUT+, OUT-, IN+, IN-
- Description: Steps down the voltage from the power supply to a level suitable for the Arduino and other 5V components.
Ac Supply
- Pins: +ve, -ve
- Description: Provides the AC voltage input to the power supply.
Wiring Details
HC-SR04 Ultrasonic Sensor
- VCC: Connected to 5V net.
- TRIG: Connected to Arduino pin 9.
- ECHO: Connected to Arduino pin 10.
- GND: Connected to GND net.
Arduino Uno R3
- 5V: Supplies 5V to the 5V net.
- GND: Common ground for GND net.
- VIN: Receives voltage from the buck converter OUT+.
- Digital IO Pins: Various connections to relay, motor driver, and GSM module.
- SDA/SCL: I2C communication with the LCD display.
GSM SIM900
- 5V: Connected to 5V net.
- GND: Connected to GND net.
- D0/D1: Serial communication with Arduino pins 0 and 1.
1-Channel Relay (5V 10A)
- power: Connected to 5V net.
- ground: Connected to GND net.
- signal: Controlled by Arduino pin 7.
LCD I2C Display
- VCC: Connected to 5V net.
- GND: Connected to GND net.
- SDA/SCL: I2C communication with Arduino.
DC Motor
- pin 1/pin 2: Connected to motor driver OUT3 and OUT4.
L298N DC Motor Driver
- 12V: Receives power from the power supply 12V-24V Output (DC).
- GND: Connected to GND net.
- 5V: Connected to 5V net.
- IN1/IN2: Controlled by Arduino pins 2 and 3.
- ENA: Connected to relay NC.
POWER SUPPLY 12V 5AMP
- 220V Positive/Negative Pole (AC): Connected to Ac Supply.
- GND (DC): Connected to GND net.
- 12V-24V Output (DC): Supplies power to the motor driver and buck converter.
LM2956 Buck Converter DC-DC
- IN+/IN-: Receives 12V from the power supply.
- OUT+/OUT-: Supplies regulated voltage to Arduino VIN and GND.
Ac Supply
- +ve/-ve: Provides AC input to the power supply.
Documented Code
/*
* This Arduino sketch controls a waste collection system with the following phases:
* Collection, Lifting, Dumping, and Resetting. It uses an ultrasonic sensor to
* monitor the bin's fill level and a GSM module to send updates. The motor is
* turned off when the bin is full to prevent overfilling.
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <SoftwareSerial.h>
// Pin definitions
const int trigPin = 9;
const int echoPin = 10;
const int motorPin1 = 2;
const int motorPin2 = 3;
const int relayPin = 7;
const int binFullLevel = 20; // Example threshold in cm
// LCD and GSM setup
LiquidCrystal_I2C lcd(0x27, 16, 2);
SoftwareSerial gsm(0, 1); // RX, TX
void setup() {
// Initialize serial communication
Serial.begin(9600);
gsm.begin(9600);
// Initialize LCD
lcd.begin();
lcd.backlight();
// Initialize pins
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(motorPin1, OUTPUT);
pinMode(motorPin2, OUTPUT);
pinMode(relayPin, OUTPUT);
// Initial state
digitalWrite(relayPin, LOW);
lcd.print("System Ready");
}
void loop() {
// Measure distance
long duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration / 2) / 29.1;
// Display distance on LCD
lcd.setCursor(0, 1);
lcd.print("Distance: ");
lcd.print(distance);
lcd.print(" cm");
// Check if bin is full
if (distance < binFullLevel) {
digitalWrite(relayPin, LOW); // Turn off motor
lcd.setCursor(0, 0);
lcd.print("Bin Full");
gsm.println("Bin is full");
} else {
// Collection Phase
digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
delay(5000); // Adjust delay as needed
// Lifting Phase
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
delay(5000); // Adjust delay as needed
// Dumping Phase
digitalWrite(relayPin, HIGH);
delay(2000); // Adjust delay as needed
digitalWrite(relayPin, LOW);
// Resetting Phase
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
delay(5000); // Adjust delay as needed
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
}
delay(1000); // Adjust delay as needed
}
This code is responsible for the operation of the waste collection system. It initializes the components, measures the distance to the waste using the ultrasonic sensor, displays the distance on the LCD, and controls the motor and relay based on the bin's fill level. The GSM module is used to send a message when the bin is full.