Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino Nano Based Smart Waste Management System with GSM Notification

Image of Arduino Nano Based Smart Waste Management System with GSM Notification

Smart Waste Management System Circuit Documentation

Summary

The Smart Waste Management System is designed to monitor the fill level of a waste bin and alert maintenance personnel when the bin is nearing full capacity. The system uses an Arduino Nano microcontroller to process signals from an HC-SR04 Ultrasonic Sensor, which measures the distance to the waste inside the bin. Depending on the fill level, different colored LEDs (green, yellow, red) indicate the bin's status, and a buzzer sounds an alarm when the bin is more than 80% full. The system also includes a SIM800L GSM Module to send SMS alerts for high fill levels. Power is supplied by a Lithium-ion Battery, which is charged by a solar panel through a Charge Controller.

Component List

  • Arduino Nano: A compact microcontroller board based on the ATmega328P, featuring digital and analog I/O pins.
  • HC-SR04 Ultrasonic Sensor: A sensor that measures distance by emitting ultrasonic waves and timing their return after bouncing off objects.
  • Buzzer: An audible signaling device that emits a tone when powered.
  • LEDs (Green, Yellow, Red): Light Emitting Diodes that illuminate in different colors to indicate the bin's fill level status.
  • Resistors (220 Ohms): Three resistors used to limit current to the LEDs, preventing damage.
  • SIM800L GSM Module: A module that allows the system to send SMS messages over the cellular network.
  • Solar Panel: A photovoltaic panel that converts sunlight into electrical energy to charge the battery.
  • Lithium-ion Battery (10000mAh, 11.1V): A rechargeable battery that provides power to the system.
  • Charge Controller: A device that regulates the voltage and current coming from the solar panel to charge the battery safely.

Wiring Details

Arduino Nano

  • GND: Connected to the ground pins of the buzzer, HC-SR04 Ultrasonic Sensor, and all LEDs.
  • D2: Connected to the TRIG pin of the HC-SR04 Ultrasonic Sensor.
  • D3: Connected to the ECHO pin of the HC-SR04 Ultrasonic Sensor.
  • D4: Connected to the SIM_TXD pin of the SIM800L GSM Module.
  • D5: Connected to the SIM_RXD pin of the SIM800L GSM Module.
  • D6: Connected to the PIN of the buzzer.
  • D7, D8, D9: Connected to the anodes of the green, yellow, and red LEDs through 220 Ohm resistors, respectively.
  • VIN: Connected to the BAT pin of the Charge Controller and the 11.1V pin of the Lithium-ion Battery.
  • 5V: Connected to the 5V pin of the SIM800L GSM Module and the VCC pin of the HC-SR04 Ultrasonic Sensor.

HC-SR04 Ultrasonic Sensor

  • VCC: Connected to the 5V output from the Arduino Nano.
  • TRIG: Connected to pin D2 of the Arduino Nano.
  • ECHO: Connected to pin D3 of the Arduino Nano.
  • GND: Connected to the ground pin of the Arduino Nano.

Buzzer

  • PIN: Connected to pin D6 of the Arduino Nano.
  • GND: Connected to the ground pin of the Arduino Nano.

LEDs (Green, Yellow, Red)

  • Anode (Green LED): Connected to pin D7 of the Arduino Nano through a 220 Ohm resistor.
  • Anode (Yellow LED): Connected to pin D8 of the Arduino Nano through a 220 Ohm resistor.
  • Anode (Red LED): Connected to pin D9 of the Arduino Nano through a 220 Ohm resistor.
  • Cathode (All LEDs): Connected to the ground pin of the Arduino Nano.

SIM800L GSM Module

  • 5V: Connected to the 5V output from the Arduino Nano.
  • GND: Connected to the ground pin of the Arduino Nano.
  • SIM_TXD: Connected to pin D4 of the Arduino Nano.
  • SIM_RXD: Connected to pin D5 of the Arduino Nano.

Solar Panel

  • +: Connected to the Vin pin of the Charge Controller.
  • -: Connected to the GND pin of the Charge Controller.

Lithium-ion Battery

  • 11.1V: Connected to the VIN pin of the Arduino Nano and the BAT pin of the Charge Controller.
  • GND: Connected to the ground pin of the Arduino Nano and the GND pin of the Charge Controller.

Charge Controller

  • BAT: Connected to the VIN pin of the Arduino Nano and the 11.1V pin of the Lithium-ion Battery.
  • Vin: Connected to the + pin of the Solar Panel.
  • GND: Connected to the ground pin of the Arduino Nano, the - pin of the Solar Panel, and the GND pin of the Lithium-ion Battery.

Documented Code

#include <SoftwareSerial.h>

#define TRIG_PIN 2        // Ultrasonic sensor trigger pin
#define ECHO_PIN 3        // Ultrasonic sensor echo pin
#define GSM_TX 4          // GSM Module TX
#define GSM_RX 5          // GSM Module RX
#define BUZZER_PIN 6      // Buzzer pin
#define GREEN_LED 7       // Green LED pin
#define YELLOW_LED 8      // Yellow LED pin
#define RED_LED 9         // Red LED pin

SoftwareSerial gsm(GSM_RX, GSM_TX);  // Software serial for GSM

const int binHeight = 30;  // Bin height in cm (adjust according to your bin)
long duration;
int distance, fillLevel;

void setup() {
  pinMode(TRIG_PIN, OUTPUT);
  pinMode(ECHO_PIN, INPUT);
  pinMode(BUZZER_PIN, OUTPUT);
  pinMode(GREEN_LED, OUTPUT);
  pinMode(YELLOW_LED, OUTPUT);
  pinMode(RED_LED, OUTPUT);

  Serial.begin(9600);
  gsm.begin(9600);
  
  // GSM Module Initialization
  sendSMS("Smart Waste Management System Initialized");
}

void loop() {
  // Measure distance
  digitalWrite(TRIG_PIN, LOW);
  delayMicroseconds(2);
  digitalWrite(TRIG_PIN, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG_PIN, LOW);
  
  duration = pulseIn(ECHO_PIN, HIGH);
  distance = duration * 0.034 / 2;

  // Calculate fill level percentage
  fillLevel = map(distance, 0, binHeight, 100, 0);

  // Determine bin status and set LEDs and buzzer accordingly
  if (fillLevel <= 50) {
    digitalWrite(GREEN_LED, HIGH);
    digitalWrite(YELLOW_LED, LOW);
    digitalWrite(RED_LED, LOW);
    digitalWrite(BUZZER_PIN, LOW);
    Serial.println("Bin Status: Less than 50% full");
  } 
  else if (fillLevel > 50 && fillLevel < 80) {
    digitalWrite(GREEN_LED, LOW);
    digitalWrite(YELLOW_LED, HIGH);
    digitalWrite(RED_LED, LOW);
    digitalWrite(BUZZER_PIN, LOW);
    Serial.println("Bin Status: Between 50% and 80% full");
  } 
  else if (fillLevel >= 80) {
    digitalWrite(GREEN_LED, LOW);
    digitalWrite(YELLOW_LED, LOW);
    digitalWrite(RED_LED, HIGH);
    digitalWrite(BUZZER_PIN, HIGH);
    Serial.println("Bin Status: More than 80% full");
    sendSMS("Bin is 80% full. Please empty.");
  }

  delay(60000);  // Wait for 1 minute before next reading
}

// Function to send SMS alert
void sendSMS(String message) {
  gsm.print("AT+CMGF=1\r");  // Set SMS mode
  delay(100);
  gsm.print("AT+CMGS=\"+91xxxxxxxxxx\"\r");  // Replace with your phone number
  delay(100);
  gsm.print(message);
  delay(100);
  gsm.write(26);  // ASCII code for Ctrl+Z (end of message)
  delay(1000);
}

This code is responsible for the operation of the Smart Waste Management System. It initializes the hardware components, takes measurements from the ultrasonic sensor, calculates the fill level, updates the status LEDs, sounds the buzzer if necessary, and sends SMS alerts when the bin is 80% full.